Skip to content

UBERF-8017: Support updating workspace name and deleting workspace #6476

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

Merged
merged 2 commits into from
Sep 3, 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
26 changes: 13 additions & 13 deletions models/setting/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,19 @@ export function createModel (builder: Builder): void {
},
setting.ids.Integrations
)
builder.createDoc(
setting.class.WorkspaceSettingCategory,
core.space.Model,
{
name: 'general',
label: setting.string.General,
icon: setting.icon.Setting,
component: setting.component.General,
order: 900,
role: AccountRole.Owner
},
setting.ids.General
)
builder.createDoc(
setting.class.WorkspaceSettingCategory,
core.space.Model,
Expand Down Expand Up @@ -241,19 +254,6 @@ export function createModel (builder: Builder): void {
},
setting.ids.Configure
)
builder.createDoc(
setting.class.WorkspaceSettingCategory,
core.space.Model,
{
name: 'workspaceSettings',
label: setting.string.Branding,
icon: setting.icon.AccountSettings,
component: setting.component.WorkspaceSetting,
order: 1300,
role: AccountRole.Owner
},
setting.ids.WorkspaceSetting
)
builder.createDoc(
setting.class.WorkspaceSettingCategory,
core.space.Model,
Expand Down
1 change: 1 addition & 0 deletions models/setting/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default mergeIds(settingId, setting, {
DateTypeEditor: '' as AnyComponent,
RefEditor: '' as AnyComponent,
EnumTypeEditor: '' as AnyComponent,
General: '' as AnyComponent,
Owners: '' as AnyComponent,
CreateMixin: '' as AnyComponent,
InviteSetting: '' as AnyComponent,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ export interface DomainIndexConfiguration extends Doc {
skip?: string[]
}

export type WorkspaceMode = 'pending-creation' | 'creating' | 'upgrading' | 'deleting' | 'active'
export type WorkspaceMode = 'pending-creation' | 'creating' | 'upgrading' | 'pending-deletion' | 'deleting' | 'active'

export interface BaseWorkspaceInfo {
workspace: string // An uniq workspace name, Database names
Expand Down
14 changes: 13 additions & 1 deletion packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import {
Role,
roleOrder,
Space,
TypedSpace
TypedSpace,
WorkspaceMode
} from './classes'
import core from './component'
import { Hierarchy } from './hierarchy'
Expand Down Expand Up @@ -152,6 +153,17 @@ export function toWorkspaceString (id: WorkspaceId): string {
return id.name
}

/**
* @public
*/
export function isWorkspaceCreating (mode?: WorkspaceMode): boolean {
if (mode === undefined) {
return false
}

return ['pending-creation', 'creating'].includes(mode)
}

const attributesPrefix = 'attributes.'

/**
Expand Down
5 changes: 3 additions & 2 deletions packages/presentation/src/components/MessageBox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
export let richMessage: boolean = false
export let params: Record<string, any> = {}
export let okLabel: IntlString | undefined = undefined
export let dangerous: boolean = false
export let canSubmit = true
export let action: (() => Promise<void>) | undefined = undefined

Expand All @@ -48,11 +49,11 @@
</div>
<div class="footer">
<Button
focus
focus={!dangerous}
focusIndex={1}
label={okLabel ?? presentation.string.Ok}
size={'large'}
kind={'primary'}
kind={dangerous ? 'dangerous' : 'primary'}
loading={processing}
on:click={() => {
processing = true
Expand Down
1 change: 1 addition & 0 deletions packages/theme/styles/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@
background-color: var(--dangerous-bg-color);
border-color: var(--dangerous-bg-color);

.btn-icon { color: var(--white-color); }
&:hover { background-color: var(--dangerous-bg-hover); }
&:not(.no-focus):focus { box-shadow: var(--dangerous-shadow); }
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/client-resources/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class Connection implements ClientConnection {

handleMsg (socketId: number, resp: Response<any>): void {
if (resp.error !== undefined) {
if (resp.error?.code === UNAUTHORIZED.code) {
if (resp.error?.code === UNAUTHORIZED.code || resp.terminate === true) {
Analytics.handleError(new PlatformError(resp.error))
this.closed = true
this.websocket?.close()
Expand Down
1 change: 1 addition & 0 deletions plugins/contact-resources/src/components/Avatar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
const blobURL = await getBlobURL(direct)
url = blobURL
avatarProvider = undefined
srcSet = undefined
} else if (avatar != null) {
const avatarProviderId = getAvatarProviderId(avatar.avatarType)
avatarProvider = avatarProviderId !== undefined ? await getProvider(avatarProviderId) : undefined
Expand Down
4 changes: 2 additions & 2 deletions plugins/login/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export interface Workspace {
* @public
*/
export interface WorkspaceLoginInfo extends LoginInfo {
workspace: string
workspaceId: string
workspace: string // worspaceUrl in db
workspaceId: string // workspace in db (actual ID)
mode?: WorkspaceMode
progress?: number
}
Expand Down
7 changes: 5 additions & 2 deletions plugins/setting-assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"Automations": "Automations",
"Collections": "Collections",
"ClassColon": "Class:",
"Branding": "Branding",
"SpaceTypes": "Space types",
"NewSpaceType": "New space type",
"SpaceTypeTitle": "Space type title",
Expand All @@ -113,6 +112,10 @@
"Permissions": "Permissions",
"Assignees": "Assignees",
"DeleteRole": "Delete role",
"DeleteRoleConfirmation": "Are you sure you want to delete this role? All users with this role will lose their permissions."
"DeleteRoleConfirmation": "Are you sure you want to delete this role? All users with this role will lose their permissions.",
"DeleteWorkspace": "Delete workspace",
"DeleteWorkspaceConfirm": "Are you sure you want to delete this workspace? You and all other members will lose access to this workspace. All information from the workspace will be lost. This action cannot be undone. Do you want to proceed?",
"WorkspaceName": "Workspace name",
"Workspace": "Workspace"
}
}
7 changes: 5 additions & 2 deletions plugins/setting-assets/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@
"Automations": "Automatizaciones",
"Collections": "Colecciones",
"ClassColon": "Clase:",
"Branding": "Marca",
"Assignees": "Atribuídos",
"DeleteRole": "Eliminar función",
"DeleteRoleConfirmation": "¿Está seguro de que desea eliminar esta función? Todos los usuarios con este rol perderán sus permisos"
"DeleteRoleConfirmation": "¿Está seguro de que desea eliminar esta función? Todos los usuarios con este rol perderán sus permisos",
"DeleteWorkspace": "Eliminar espacio de trabajo",
"DeleteWorkspaceConfirm": "¿Estás seguro de que quieres eliminar este espacio de trabajo? Tú y todos los demás miembros perderán el acceso a este espacio de trabajo. Toda la información del espacio de trabajo se perderá. Esta acción no se puede deshacer. ¿Quieres continuar?",
"WorkspaceName": "Nombre del espacio de trabajo",
"Workspace": "Espacio de trabajo"
}
}
7 changes: 5 additions & 2 deletions plugins/setting-assets/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"Automations": "Automatisations",
"Collections": "Collections",
"ClassColon": "Classe :",
"Branding": "Image de marque",
"SpaceTypes": "Types d'espace",
"NewSpaceType": "Nouveau type d'espace",
"SpaceTypeTitle": "Titre du type d'espace",
Expand All @@ -113,6 +112,10 @@
"Permissions": "Permissions",
"Assignees": "Assignés",
"DeleteRole": "Supprimer le rôle",
"DeleteRoleConfirmation": "Êtes-vous sûr de vouloir supprimer ce rôle ? Tous les utilisateurs ayant ce rôle perdront leurs permissions."
"DeleteRoleConfirmation": "Êtes-vous sûr de vouloir supprimer ce rôle ? Tous les utilisateurs ayant ce rôle perdront leurs permissions.",
"DeleteWorkspace": "Supprimer l'espace de travail",
"DeleteWorkspaceConfirm": "Êtes-vous sûr de vouloir supprimer cet espace de travail ? Vous et tous les autres membres perdrez l'accès à cet espace de travail. Toutes les informations de l'espace de travail seront perdues. Cette action est irréversible. Voulez-vous continuer?",
"WorkspaceName": "Nom de l'espace de travail",
"Workspace": "Espace de travail"
}
}
7 changes: 5 additions & 2 deletions plugins/setting-assets/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@
"Automations": "Automações",
"Collections": "Coleções",
"ClassColon": "Classe:",
"Branding": "Marca",
"Assignees": "Atribuídos",
"DeleteRole": "Eliminar função",
"DeleteRoleConfirmation": "Tem a certeza de que pretende eliminar esta função? Todos os utilizadores com esta função perderão as suas permissões."
"DeleteRoleConfirmation": "Tem a certeza de que pretende eliminar esta função? Todos os utilizadores com esta função perderão as suas permissões.",
"DeleteWorkspace": "Eliminar espaço de trabalho",
"DeleteWorkspaceConfirm": "Tem certeza de que deseja excluir este espaço de trabalho? Você e todos os outros membros perderão o acesso a este espaço de trabalho. Todas as informações do espaço de trabalho serão perdidas. Esta ação não pode ser desfeita. Deseja prosseguir?",
"WorkspaceName": "Nome do espaço de trabalho",
"Workspace": "Espaço de trabalho"
}
}
7 changes: 5 additions & 2 deletions plugins/setting-assets/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"Automations": "Автоматизация",
"Collections": "Коллекции",
"ClassColon": "Класс:",
"Branding": "Брендинг",
"SpaceTypes": "Типы пространств",
"NewSpaceType": "Новый тип пространства",
"SpaceTypeTitle": "Название типа пространства",
Expand All @@ -114,6 +113,10 @@
"Permissions": "Разрешения",
"Assignees": "Назначенные",
"DeleteRole": "Удалить роль",
"DeleteRoleConfirmation": "Вы действительно хотите удалить эту роль? Все пользователи с этой ролью потеряют имеющиеся разрешения."
"DeleteRoleConfirmation": "Вы действительно хотите удалить эту роль? Все пользователи с этой ролью потеряют имеющиеся разрешения.",
"DeleteWorkspace": "Удалить рабочее пространство",
"DeleteWorkspaceConfirm": "Вы действительно хотите удалить это рабочее пространство? Вы и все остальные пользователи потеряют доступ к этому рабочему пространству. Вся информация из рабочего пространства будет утеряна. Это действие нельзя отменить. Вы хотите продолжить?",
"WorkspaceName": "Название рабочего пространства",
"Workspace": "Рабочее пространство"
}
}
7 changes: 5 additions & 2 deletions plugins/setting-assets/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"Automations": "自动化",
"Collections": "集合",
"ClassColon": "类别:",
"Branding": "品牌",
"SpaceTypes": "空间类型",
"NewSpaceType": "新空间类型",
"SpaceTypeTitle": "空间类型标题",
Expand All @@ -113,6 +112,10 @@
"Permissions": "权限",
"Assignees": "受托人",
"DeleteRole": "删除角色",
"DeleteRoleConfirmation": "您确定要删除此角色吗?拥有此角色的所有用户将失去其权限。"
"DeleteRoleConfirmation": "您确定要删除此角色吗?拥有此角色的所有用户将失去其权限。",
"DeleteWorkspace": "删除工作区",
"DeleteWorkspaceConfirm": "您确定要删除此工作区吗?您和所有其他成员将失去对此工作区的访问权限。工作区中的所有信息将丢失。此操作无法撤销。您要继续吗?",
"WorkspaceName": "工作区名称",
"Workspace": "工作区"
}
}
Loading