fix: workspace creation issues (#5362)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-04-15 19:43:39 +07:00 committed by GitHub
parent 2220d7e19e
commit b34b70feeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 40 additions and 25 deletions

View File

@ -375,7 +375,8 @@ export function createModel (builder: Builder): void {
core.class.Class,
core.mixin.IndexConfiguration,
{
searchDisabled: true
searchDisabled: true,
indexes: []
}
)
@ -384,7 +385,8 @@ export function createModel (builder: Builder): void {
core.class.Class,
core.mixin.IndexConfiguration,
{
searchDisabled: true
searchDisabled: true,
indexes: []
}
)

View File

@ -62,7 +62,7 @@ import notification, { notificationActionTemplates } from '@hcengineering/model-
import view, { createAction, template, actionTemplates as viewTemplates } from '@hcengineering/model-view'
import workbench from '@hcengineering/model-workbench'
import { type AnyComponent } from '@hcengineering/ui/src/types'
import type { IntlString, Resource } from '@hcengineering/platform'
import type { IntlString } from '@hcengineering/platform'
import { TActivityMessage } from '@hcengineering/model-activity'
import chunter from './plugin'
@ -190,7 +190,6 @@ export class TChatMessageViewlet extends TDoc implements ChatMessageViewlet {
@Mixin(chunter.mixin.ObjectChatPanel, core.class.Class)
export class TObjectChatPanel extends TClass implements ObjectChatPanel {
ignoreKeys!: string[]
titleProvider!: Resource<(object: Doc) => string>
}
const actionTemplates = template({

View File

@ -51,7 +51,8 @@ export function createModel (builder: Builder): void {
core.class.Class,
core.mixin.IndexConfiguration,
{
searchDisabled: true
searchDisabled: true,
indexes: []
}
)
}

View File

@ -182,8 +182,7 @@ function defineFilters (builder: Builder): void {
'description',
'remainingTime',
'reportedTime'
],
titleProvider: tracker.function.IssueChatTitleProvider
]
})
//

View File

@ -32,7 +32,7 @@ import core, {
IndexKind,
Interface,
Markup,
MixinUpdate,
MixinData,
Obj,
PropertyType,
Rank,
@ -359,7 +359,7 @@ export class Builder {
objectId: Ref<D>,
objectClass: Ref<Class<D>>,
mixin: Ref<IMixin<M>>,
attributes: MixinUpdate<D, M>
attributes: MixinData<D, M>
): void {
const tx = txFactory.createTxMixin(objectId, objectClass, core.space.Model, mixin, attributes)
this.txes.push(tx)

View File

@ -17,7 +17,7 @@ import { ActivityMessage, ActivityMessageViewlet } from '@hcengineering/activity
import type { Person } from '@hcengineering/contact'
import type { Account, AttachedDoc, Class, Doc, Markup, Mixin, Ref, Space, Timestamp } from '@hcengineering/core'
import { NotificationType } from '@hcengineering/notification'
import type { Asset, Plugin, Resource } from '@hcengineering/platform'
import type { Asset, Plugin } from '@hcengineering/platform'
import { IntlString, plugin } from '@hcengineering/platform'
import { AnyComponent } from '@hcengineering/ui'
import { Action } from '@hcengineering/view'
@ -83,7 +83,6 @@ export interface DirectMessageInput extends Class<Doc> {
*/
export interface ObjectChatPanel extends Class<Doc> {
ignoreKeys: string[]
titleProvider: Resource<(object: Doc) => string>
}
/**

View File

@ -36,7 +36,7 @@ import {
} from '@hcengineering/middleware'
import { createMongoAdapter, createMongoTxAdapter } from '@hcengineering/mongo'
import { OpenAIEmbeddingsStage, openAIId, openAIPluginImpl } from '@hcengineering/openai'
import { addLocation, addStringsLoader } from '@hcengineering/platform'
import { addLocation, addStringsLoader, platformId } from '@hcengineering/platform'
import {
BackupClientSession,
buildStorageFromConfig,
@ -123,8 +123,8 @@ import { viewId } from '@hcengineering/view'
import { workbenchId } from '@hcengineering/workbench'
import coreEng from '@hcengineering/core/lang/en.json'
import loginEng from '@hcengineering/login-assets/lang/en.json'
import platformEng from '@hcengineering/platform/lang/en.json'
import activityEn from '@hcengineering/activity-assets/lang/en.json'
import attachmentEn from '@hcengineering/attachment-assets/lang/en.json'
@ -154,6 +154,7 @@ import workbenchEn from '@hcengineering/workbench-assets/lang/en.json'
addStringsLoader(coreId, async (lang: string) => coreEng)
addStringsLoader(loginId, async (lang: string) => loginEng)
addStringsLoader(platformId, async (lang: string) => platformEng)
addStringsLoader(taskId, async (lang: string) => taskEn)
addStringsLoader(viewId, async (lang: string) => viewEn)

View File

@ -356,8 +356,8 @@ async function createUpdateIndexes (
// Find all domains and indexed fields inside
for (const c of classes) {
try {
const domain = hierarchy.getDomain(c._id)
if (domain === DOMAIN_MODEL) {
const domain = hierarchy.findDomain(c._id)
if (domain === undefined || domain === DOMAIN_MODEL) {
continue
}
const attrs = hierarchy.getAllAttributes(c._id)
@ -396,11 +396,17 @@ async function createUpdateIndexes (
for (const [d, v] of allDomains) {
const cfg = domainConfigurations.find((it) => it.domain === d)
if (cfg?.disableCollection === true) {
const collInfo = collections.find((it) => it.name === d)
if (cfg?.disableCollection === true && collInfo != null) {
try {
await db.dropCollection(d)
} catch (err) {
logger.error('error: failed to delete collection', { d, err })
}
continue
}
const collInfo = collections.find((it) => it.name === d)
if (collInfo == null) {
await ctx.with('create-collection', { d }, async () => await db.createCollection(d))
}
@ -458,6 +464,7 @@ async function createUpdateIndexes (
}
if (allIndexes.length > 0) {
for (const c of allIndexes) {
try {
if (cfg?.skip !== undefined) {
if (Array.from(cfg.skip ?? []).some((it) => c.name.includes(it))) {
continue
@ -465,6 +472,9 @@ async function createUpdateIndexes (
}
logger.log('drop unused indexes', { name: c.name })
await collection.dropIndex(c.name)
} catch (err) {
console.error('error: failed to drop index', { c, err })
}
}
}
@ -483,8 +493,12 @@ async function createUpdateIndexes (
if (collections.length > 0) {
// We could drop unused collections.
for (const c of collections) {
try {
logger.log('drop unused collection', { name: c.name })
await db.dropCollection(c.name)
} catch (err) {
console.error('error: failed to drop collection', { c, err })
}
}
}
}