mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-17 18:05:42 +02:00
feat: Ability to skip initial content creation (#10812)
* feat: Configure workspaces during creation
Signed-off-by: Artem Savchenko <armisav@gmail.com>
* Fix question description
Signed-off-by: Artem Savchenko <armisav@gmail.com>
* Clean up
Signed-off-by: Artem Savchenko <armisav@gmail.com>
* Fix formatting
Signed-off-by: Artem Savchenko <armisav@gmail.com>
* Fix tests
Signed-off-by: Artem Savchenko <armisav@gmail.com>
* Fix tests
Signed-off-by: Artem Savchenko <armisav@gmail.com>
* Potential fix for pull request finding 'CodeQL / Insecure randomness'
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Artyom Savchenko <armisav@gmail.com>
* Revert "Potential fix for pull request finding 'CodeQL / Insecure randomness'"
This reverts commit e37b6de69c.
Signed-off-by: Artem Savchenko <armisav@gmail.com>
* Simplify workspace creation
Signed-off-by: Artem Savchenko <armisav@gmail.com>
* Fix layout
Signed-off-by: Artem Savchenko <armisav@gmail.com>
* Clean up
Signed-off-by: Artem Savchenko <armisav@gmail.com>
* Keep redesigned version
Signed-off-by: Artem Savchenko <armisav@gmail.com>
* Fix tests
Signed-off-by: Artem Savchenko <armisav@gmail.com>
---------
Signed-off-by: Artem Savchenko <armisav@gmail.com>
Signed-off-by: Artyom Savchenko <armisav@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
parent
a78630fa4d
commit
e3d3276451
@@ -55,6 +55,7 @@ import type {
|
||||
Subscription,
|
||||
SubscriptionData,
|
||||
UserProfile,
|
||||
WorkspaceConfiguration,
|
||||
WorkspaceLoginInfo,
|
||||
WorkspaceOperation
|
||||
} from './types'
|
||||
@@ -134,7 +135,11 @@ 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>
|
||||
signUpOtp: (email: string, first: string, last: string) => Promise<OtpInfo>
|
||||
/**
|
||||
* Deprecated. Only to be used for dev setups without mail service.
|
||||
@@ -668,10 +673,14 @@ 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)
|
||||
|
||||
@@ -14,6 +14,8 @@ import {
|
||||
IntegrationKind
|
||||
} from '@hcengineering/core'
|
||||
|
||||
export type { WorkspaceConfiguration } from '@hcengineering/core'
|
||||
|
||||
export interface LoginInfo {
|
||||
account: AccountUuid
|
||||
name?: string
|
||||
|
||||
@@ -899,6 +899,25 @@ export type WorkspaceUpdateEvent =
|
||||
| 'delete-started'
|
||||
| 'delete-done'
|
||||
|
||||
/**
|
||||
* Initial-state configuration captured at workspace creation. Currently only
|
||||
* carries whether the workspace should be populated with demo content. Lives
|
||||
* on `WorkspaceInfo.pendingConfiguration` until consumed by workspace-service
|
||||
* after model init, then cleared back to `null`.
|
||||
*
|
||||
* Kept as a struct (rather than a bare boolean) so future opt-in fields can
|
||||
* be added without breaking the wire format.
|
||||
*
|
||||
* @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
|
||||
}
|
||||
|
||||
export interface WorkspaceInfo {
|
||||
uuid: WorkspaceUuid
|
||||
dataId?: WorkspaceDataId // Old workspace identifier. E.g. Database name in Mongo, bucket in R2, etc.
|
||||
@@ -912,6 +931,9 @@ export interface WorkspaceInfo {
|
||||
allowReadOnlyGuest?: boolean // Should always be set for NEW workspaces
|
||||
allowGuestSignUp?: boolean // Should always be set for NEW workspaces
|
||||
passwordAgingRule?: number | null // 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 {
|
||||
|
||||
Reference in New Issue
Block a user