Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 23 additions & 3 deletions foundations/core/packages/account-client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
type PersonId,
type PersonInfo,
type PersonUuid,
type PluginConfiguration,
type SocialIdType,
Version,
type UsageStatus,
Expand Down Expand Up @@ -55,6 +56,7 @@ import type {
Subscription,
SubscriptionData,
UserProfile,
WorkspaceConfiguration,
WorkspaceLoginInfo,
WorkspaceOperation
} from './types'
Expand Down Expand Up @@ -134,7 +136,12 @@ export interface AccountClient {
getWorkspacesInfo: (workspaces: WorkspaceUuid[]) => Promise<WorkspaceInfoWithStatus[]>
updateLastVisit: (workspaces: WorkspaceUuid[]) => Promise<void>
getRegionInfo: () => Promise<RegionInfo[]>
createWorkspace: (name: string, region?: string) => Promise<WorkspaceLoginInfo>
createWorkspace: (
name: string,
region?: string,
configuration?: WorkspaceConfiguration
) => Promise<WorkspaceLoginInfo>
getDefaultPluginConfigurations: () => Promise<Data<PluginConfiguration>[] | null>
signUpOtp: (email: string, first: string, last: string) => Promise<OtpInfo>
/**
* Deprecated. Only to be used for dev setups without mail service.
Expand Down Expand Up @@ -668,10 +675,23 @@ class AccountClientImpl implements AccountClient {
return await this.rpc(request)
}

async createWorkspace (workspaceName: string, region?: string): Promise<WorkspaceLoginInfo> {
async createWorkspace (
workspaceName: string,
region?: string,
configuration?: WorkspaceConfiguration
): Promise<WorkspaceLoginInfo> {
const request = {
method: 'createWorkspace' as const,
params: { workspaceName, region }
params: { workspaceName, region, configuration }
}

return await this.rpc(request)
}

async getDefaultPluginConfigurations (): Promise<Data<PluginConfiguration>[] | null> {
const request = {
method: 'getDefaultPluginConfigurations' as const,
params: {}
}

return await this.rpc(request)
Expand Down
2 changes: 2 additions & 0 deletions foundations/core/packages/account-client/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
IntegrationKind
} from '@hcengineering/core'

export type { WorkspaceConfiguration } from '@hcengineering/core'

export interface LoginInfo {
account: AccountUuid
name?: string
Expand Down
26 changes: 26 additions & 0 deletions foundations/core/packages/core/src/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,29 @@ export type WorkspaceUpdateEvent =
| 'delete-started'
| 'delete-done'

/**
* Initial-state configuration captured at workspace creation: which apps to
* disable on first run and whether to populate with demo content. Lives on
* `WorkspaceInfo.pendingConfiguration` until consumed by workspace-service
* after model init, then cleared back to `null`.
*
* @public
*/
export interface WorkspaceConfiguration {
/**
* Whether to run the workspace init script (sample projects and other demo content).
* Defaults to `true` on the server side to preserve legacy behavior.
*/
withDemoContent?: boolean

/**
* List of `pluginId`s to mark as `enabled: false` in the new workspace's
* `core.class.PluginConfiguration` documents right after model initialization.
* Only non-system, non-hidden plugins are honored; unknown ids are ignored.
*/
disabledPlugins?: Plugin[]
}

export interface WorkspaceInfo {
uuid: WorkspaceUuid
dataId?: WorkspaceDataId // Old workspace identifier. E.g. Database name in Mongo, bucket in R2, etc.
Expand All @@ -911,6 +934,9 @@ export interface WorkspaceInfo {
allowReadOnlyGuest?: boolean // Should always be set for NEW workspaces
allowGuestSignUp?: boolean // Should always be set for NEW workspaces
passwordAgingRule?: number // in days
// Initial-state configuration set by the user at workspace creation. Read once
// by workspace-service after model init, then cleared back to `null`.
pendingConfiguration?: WorkspaceConfiguration | null
}

export interface BackupStatus {
Expand Down
12 changes: 12 additions & 0 deletions foundations/core/packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,18 @@ export function getBranding (brandings: BrandingMap, key: string | undefined): B
return Object.values(brandings).find((branding) => branding.key === key) ?? null
}

/**
* Returns the full set of `PluginConfiguration` documents that the given model
* would create in a freshly-initialized workspace.
*
* @public
*/
export function getDefaultPluginConfigurations (systemTx: Tx[]): PluginConfiguration[] {
const configs = new Map<Ref<PluginConfiguration>, PluginConfiguration>()
fillConfiguration(systemTx, configs)
return Array.from(configs.values())
}

export function fillConfiguration (systemTx: Tx[], configs: Map<Ref<PluginConfiguration>, PluginConfiguration>): void {
for (const t of systemTx) {
if (t._class === core.class.TxCreateDoc) {
Expand Down
14 changes: 11 additions & 3 deletions models/all/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ import documents, { documentsId, createModel as documentsModel } from '@hcengine
import { hulyMailId, createModel as hulyMailModel } from '@hcengineering/model-huly-mail'
import { mailId, createModel as mailModel } from '@hcengineering/model-mail'
import products, { productsId, createModel as productsModel } from '@hcengineering/model-products'
import { questionsId, createModel as questionsModel } from '@hcengineering/model-questions'
import questions, { questionsId, createModel as questionsModel } from '@hcengineering/model-questions'
import { serverProductsId, createModel as serverProductsModel } from '@hcengineering/model-server-products'
import { serverTrainingId, createModel as serverTrainingModel } from '@hcengineering/model-server-training'
import testManagement, {
Expand Down Expand Up @@ -246,6 +246,7 @@ export default function buildModel (): Builder {
description: telegram.string.ConfigDescription,
enabled: true,
beta: true,
icon: contact.icon.Telegram,
classFilter: defaultFilter
}
],
Expand All @@ -269,6 +270,7 @@ export default function buildModel (): Builder {
description: gmail.string.ConfigDescription,
enabled: true,
beta: true,
icon: contact.icon.Email,
classFilter: defaultFilter
}
],
Expand Down Expand Up @@ -420,17 +422,19 @@ export default function buildModel (): Builder {
description: documents.string.ConfigDescription,
enabled: false,
beta: false,
icon: documents.icon.DocumentApplication,
classFilter: defaultFilter
}
],
[
questionsModel,
questionsId,
{
label: setting.string.Configure,
label: questions.string.ConfigLabel,
description: questions.string.ConfigDescription,
enabled: true,
beta: false,
hidden: false,
icon: questions.icon.Question,
classFilter: defaultFilter
}
],
Expand All @@ -442,6 +446,7 @@ export default function buildModel (): Builder {
description: trainings.string.ConfigDescription,
enabled: false,
beta: false,
icon: trainings.icon.TrainingApplication,
classFilter: defaultFilter
}
],
Expand All @@ -453,6 +458,7 @@ export default function buildModel (): Builder {
description: products.string.ConfigDescription,
enabled: false,
beta: false,
icon: products.icon.ProductsApplication,
classFilter: defaultFilter
}
],
Expand All @@ -464,6 +470,7 @@ export default function buildModel (): Builder {
description: testManagement.string.ConfigDescription,
enabled: true,
beta: true,
icon: testManagement.icon.TestManagementApplication,
classFilter: defaultFilter
}
],
Expand All @@ -475,6 +482,7 @@ export default function buildModel (): Builder {
description: survey.string.ConfigDescription,
enabled: false,
beta: true,
icon: survey.icon.Survey,
classFilter: defaultFilter
}
],
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "Čára",
"RectangleTool": "Obdélník",
"EllipseTool": "Elipsa",
"PaletteManagementMenu": "Spravovat barevné předvolby"
"PaletteManagementMenu": "Spravovat barevné předvolby",
"BetaVersion": "Beta verze"
},
"status": {
"FileTooLarge": "Soubor je příliš velký"
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "Linie",
"RectangleTool": "Rechteck",
"EllipseTool": "Ellipse",
"PaletteManagementMenu": "Farbpresets verwalten"
"PaletteManagementMenu": "Farbpresets verwalten",
"BetaVersion": "Beta-Version"
},
"status": {
"FileTooLarge": "Datei zu groß"
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "Line",
"RectangleTool": "Rectangle",
"EllipseTool": "Ellipse",
"PaletteManagementMenu": "Manage color presets"
"PaletteManagementMenu": "Manage color presets",
"BetaVersion": "Beta version"
},
"status": {
"FileTooLarge": "File too large"
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "Línea",
"RectangleTool": "Rectángulo",
"EllipseTool": "Elipse",
"PaletteManagementMenu": "Gestionar preajustes de color"
"PaletteManagementMenu": "Gestionar preajustes de color",
"BetaVersion": "Versión beta"
},
"status": {
"FileTooLarge": "Archivo demasiado grande"
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "Ligne",
"RectangleTool": "Rectangle",
"EllipseTool": "Ellipse",
"PaletteManagementMenu": "Gérer les préréglages de couleur"
"PaletteManagementMenu": "Gérer les préréglages de couleur",
"BetaVersion": "Version bêta"
},
"status": {
"FileTooLarge": "Fichier trop volumineux"
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "Linea",
"RectangleTool": "Rettangolo",
"EllipseTool": "Ellisse",
"PaletteManagementMenu": "Gestisci i preset di colore"
"PaletteManagementMenu": "Gestisci i preset di colore",
"BetaVersion": "Versione beta"
},
"status": {
"FileTooLarge": "File troppo grande"
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "直線",
"RectangleTool": "長方形",
"EllipseTool": "楕円",
"PaletteManagementMenu": "カラープリセットを管理"
"PaletteManagementMenu": "カラープリセットを管理",
"BetaVersion": "ベータ版"
},
"status": {
"FileTooLarge": "ファイルサイズが大きすぎます"
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "Linha",
"RectangleTool": "Retângulo",
"EllipseTool": "Elipse",
"PaletteManagementMenu": "Gerenciar predefinições de cor"
"PaletteManagementMenu": "Gerenciar predefinições de cor",
"BetaVersion": "Versão beta"
},
"status": {
"FileTooLarge": "Arquivo muito grande"
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "Linha",
"RectangleTool": "Retângulo",
"EllipseTool": "Elipse",
"PaletteManagementMenu": "Gerenciar predefinições de cor"
"PaletteManagementMenu": "Gerenciar predefinições de cor",
"BetaVersion": "Versão beta"
},
"status": {
"FileTooLarge": "Ficheiro demasiado grande"
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "Линия",
"RectangleTool": "Прямоугольник",
"EllipseTool": "Эллипс",
"PaletteManagementMenu": "Управление цветовыми пресетами"
"PaletteManagementMenu": "Управление цветовыми пресетами",
"BetaVersion": "Бета-версия"
},
"status": {
"FileTooLarge": "Файл слишком большой"
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "Çizgi",
"RectangleTool": "Dikdörtgen",
"EllipseTool": "Elips",
"PaletteManagementMenu": "Renk önayarlarını yönet"
"PaletteManagementMenu": "Renk önayarlarını yönet",
"BetaVersion": "Beta sürümü"
},
"status": {
"FileTooLarge": "Dosya çok büyük"
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"LineTool": "直线",
"RectangleTool": "矩形",
"EllipseTool": "椭圆",
"PaletteManagementMenu": "管理颜色预设"
"PaletteManagementMenu": "管理颜色预设",
"BetaVersion": "Beta 版本"
},
"status": {
"FileTooLarge": "文件太大"
Expand Down
Loading
Loading