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.class.Class,
core.mixin.IndexConfiguration, core.mixin.IndexConfiguration,
{ {
searchDisabled: true searchDisabled: true,
indexes: []
} }
) )
@ -384,7 +385,8 @@ export function createModel (builder: Builder): void {
core.class.Class, core.class.Class,
core.mixin.IndexConfiguration, 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 view, { createAction, template, actionTemplates as viewTemplates } from '@hcengineering/model-view'
import workbench from '@hcengineering/model-workbench' import workbench from '@hcengineering/model-workbench'
import { type AnyComponent } from '@hcengineering/ui/src/types' 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 { TActivityMessage } from '@hcengineering/model-activity'
import chunter from './plugin' import chunter from './plugin'
@ -190,7 +190,6 @@ export class TChatMessageViewlet extends TDoc implements ChatMessageViewlet {
@Mixin(chunter.mixin.ObjectChatPanel, core.class.Class) @Mixin(chunter.mixin.ObjectChatPanel, core.class.Class)
export class TObjectChatPanel extends TClass implements ObjectChatPanel { export class TObjectChatPanel extends TClass implements ObjectChatPanel {
ignoreKeys!: string[] ignoreKeys!: string[]
titleProvider!: Resource<(object: Doc) => string>
} }
const actionTemplates = template({ const actionTemplates = template({

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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