Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workspace creation issues #5362

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions models/activity/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ export function createModel (builder: Builder): void {
core.class.Class,
core.mixin.IndexConfiguration,
{
searchDisabled: true
searchDisabled: true,
indexes: []
}
)

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

Expand Down
3 changes: 1 addition & 2 deletions models/chunter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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({
Expand Down
3 changes: 2 additions & 1 deletion models/guest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export function createModel (builder: Builder): void {
core.class.Class,
core.mixin.IndexConfiguration,
{
searchDisabled: true
searchDisabled: true,
indexes: []
}
)
}
Expand Down
3 changes: 1 addition & 2 deletions models/tracker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ function defineFilters (builder: Builder): void {
'description',
'remainingTime',
'reportedTime'
],
titleProvider: tracker.function.IssueChatTitleProvider
]
})

//
Expand Down
4 changes: 2 additions & 2 deletions packages/model/src/dsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import core, {
IndexKind,
Interface,
Markup,
MixinUpdate,
MixinData,
Obj,
PropertyType,
Rank,
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions plugins/chunter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -83,7 +83,6 @@ export interface DirectMessageInput extends Class<Doc> {
*/
export interface ObjectChatPanel extends Class<Doc> {
ignoreKeys: string[]
titleProvider: Resource<(object: Doc) => string>
}

/**
Expand Down
5 changes: 3 additions & 2 deletions pods/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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)
Expand Down
38 changes: 26 additions & 12 deletions server/tool/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
await db.dropCollection(d)
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))
}
Expand Down Expand Up @@ -458,13 +464,17 @@ async function createUpdateIndexes (
}
if (allIndexes.length > 0) {
for (const c of allIndexes) {
if (cfg?.skip !== undefined) {
if (Array.from(cfg.skip ?? []).some((it) => c.name.includes(it))) {
continue
try {
if (cfg?.skip !== undefined) {
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)
}
}

Expand All @@ -483,8 +493,12 @@ async function createUpdateIndexes (
if (collections.length > 0) {
// We could drop unused collections.
for (const c of collections) {
logger.log('drop unused collection', { name: c.name })
await db.dropCollection(c.name)
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 })
}
}
}
}