mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 03:14:40 +03:00
uberf-8068: rework space type delete UX (#6525)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
parent
bf1de1f436
commit
e983d402a5
@ -115,6 +115,8 @@
|
||||
"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?",
|
||||
"DeleteSpaceType": "Delete space type",
|
||||
"DeleteSpaceTypeConfirm": "Are you sure you want to delete this space type?",
|
||||
"WorkspaceName": "Workspace name",
|
||||
"Workspace": "Workspace"
|
||||
}
|
||||
|
@ -106,6 +106,8 @@
|
||||
"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?",
|
||||
"DeleteSpaceType": "Eliminar tipo de espacio",
|
||||
"DeleteSpaceTypeConfirm": "¿Estás seguro de que quieres eliminar este tipo de espacio?",
|
||||
"WorkspaceName": "Nombre del espacio de trabajo",
|
||||
"Workspace": "Espacio de trabajo"
|
||||
}
|
||||
|
@ -115,6 +115,8 @@
|
||||
"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?",
|
||||
"DeleteSpaceType": "Supprimer le type d'espace",
|
||||
"DeleteSpaceTypeConfirm": "Êtes-vous sûr de vouloir supprimer ce type d'espace ?",
|
||||
"WorkspaceName": "Nom de l'espace de travail",
|
||||
"Workspace": "Espace de travail"
|
||||
}
|
||||
|
@ -106,6 +106,8 @@
|
||||
"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?",
|
||||
"DeleteSpaceType": "Eliminar tipo de espaço",
|
||||
"DeleteSpaceTypeConfirm": "Tem certeza de que deseja excluir este tipo de espaço?",
|
||||
"WorkspaceName": "Nome do espaço de trabalho",
|
||||
"Workspace": "Espaço de trabalho"
|
||||
}
|
||||
|
@ -116,6 +116,8 @@
|
||||
"DeleteRoleConfirmation": "Вы действительно хотите удалить эту роль? Все пользователи с этой ролью потеряют имеющиеся разрешения.",
|
||||
"DeleteWorkspace": "Удалить рабочее пространство",
|
||||
"DeleteWorkspaceConfirm": "Вы действительно хотите удалить это рабочее пространство? Вы и все остальные пользователи потеряют доступ к этому рабочему пространству. Вся информация из рабочего пространства будет утеряна. Это действие нельзя отменить. Вы хотите продолжить?",
|
||||
"DeleteSpaceType": "Удалить тип пространства",
|
||||
"DeleteSpaceTypeConfirm": "Вы действительно хотите удалить этот тип пространства?",
|
||||
"WorkspaceName": "Название рабочего пространства",
|
||||
"Workspace": "Рабочее пространство"
|
||||
}
|
||||
|
@ -115,6 +115,8 @@
|
||||
"DeleteRoleConfirmation": "您确定要删除此角色吗?拥有此角色的所有用户将失去其权限。",
|
||||
"DeleteWorkspace": "删除工作区",
|
||||
"DeleteWorkspaceConfirm": "您确定要删除此工作区吗?您和所有其他成员将失去对此工作区的访问权限。工作区中的所有信息将丢失。此操作无法撤销。您要继续吗?",
|
||||
"DeleteSpaceType": "删除空间类型",
|
||||
"DeleteSpaceTypeConfirm": "您确定要删除此空间类型吗?",
|
||||
"WorkspaceName": "工作区名称",
|
||||
"Workspace": "工作区"
|
||||
}
|
||||
|
@ -148,34 +148,6 @@
|
||||
>
|
||||
{#if type !== undefined && descriptor !== undefined}
|
||||
<Header>
|
||||
{#if canEdit}
|
||||
<ButtonIcon
|
||||
icon={IconCopy}
|
||||
size={'small'}
|
||||
kind={'secondary'}
|
||||
disabled
|
||||
on:click={(ev) => {
|
||||
// TODO: copy space type
|
||||
}}
|
||||
/>
|
||||
<ButtonIcon
|
||||
icon={IconDelete}
|
||||
size={'small'}
|
||||
kind={'secondary'}
|
||||
disabled
|
||||
on:click={(ev) => {
|
||||
// TODO: delete space type
|
||||
}}
|
||||
/>
|
||||
<ButtonIcon
|
||||
icon={IconMoreV}
|
||||
size={'small'}
|
||||
kind={'secondary'}
|
||||
on:click={(ev) => {
|
||||
showMenu(ev, { object: type })
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
<Breadcrumbs
|
||||
items={bcItems}
|
||||
size="large"
|
||||
|
@ -16,8 +16,19 @@
|
||||
import contact from '@hcengineering/contact'
|
||||
import { AccountArrayEditor } from '@hcengineering/contact-resources'
|
||||
import core, { Account, reduceCalls, Ref, type SpaceType, type SpaceTypeDescriptor } from '@hcengineering/core'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { ButtonIcon, IconSquareExpand, Label, ModernButton, ModernEditbox, TextArea, Toggle } from '@hcengineering/ui'
|
||||
import { createQuery, getClient, MessageBox } from '@hcengineering/presentation'
|
||||
import {
|
||||
ButtonIcon,
|
||||
IconDelete,
|
||||
IconSquareExpand,
|
||||
Label,
|
||||
ModernButton,
|
||||
ModernEditbox,
|
||||
showPopup,
|
||||
TextArea,
|
||||
Toggle
|
||||
} from '@hcengineering/ui'
|
||||
import { deleteObjects } from '@hcengineering/view-resources'
|
||||
|
||||
import settingRes from '../../../plugin'
|
||||
|
||||
@ -28,6 +39,7 @@
|
||||
const client = getClient()
|
||||
let shortDescription = type?.shortDescription ?? ''
|
||||
|
||||
let loading: boolean = true
|
||||
let spacesCount: number = 0
|
||||
const spacesCountQuery = createQuery()
|
||||
$: if (type !== undefined) {
|
||||
@ -36,6 +48,7 @@
|
||||
{ type: type._id },
|
||||
(res) => {
|
||||
spacesCount = res.length
|
||||
loading = false
|
||||
},
|
||||
{
|
||||
projection: { _id: 1 }
|
||||
@ -45,6 +58,8 @@
|
||||
spacesCountQuery.unsubscribe()
|
||||
}
|
||||
|
||||
$: canDelete = !loading && spacesCount === 0
|
||||
|
||||
async function attributeUpdated<T extends keyof SpaceType> (field: T, value: SpaceType[T]): Promise<void> {
|
||||
if (disabled || type === undefined || type[field] === value) {
|
||||
return
|
||||
@ -79,6 +94,24 @@
|
||||
}
|
||||
await ops.commit()
|
||||
})
|
||||
|
||||
async function handleDelete (): Promise<void> {
|
||||
if (!canDelete || disabled || type == null) {
|
||||
return
|
||||
}
|
||||
|
||||
showPopup(MessageBox, {
|
||||
label: settingRes.string.DeleteSpaceType,
|
||||
message: settingRes.string.DeleteSpaceTypeConfirm,
|
||||
action: async () => {
|
||||
if (type == null) {
|
||||
return
|
||||
}
|
||||
|
||||
await deleteObjects(client, [type])
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if descriptor !== undefined}
|
||||
@ -97,15 +130,20 @@
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<ModernButton
|
||||
icon={IconSquareExpand}
|
||||
label={settingRes.string.CountSpaces}
|
||||
labelParams={{ count: spacesCount }}
|
||||
disabled={spacesCount === 0}
|
||||
kind="tertiary"
|
||||
size="medium"
|
||||
hasMenu
|
||||
/>
|
||||
<div class="flex-row">
|
||||
<ModernButton
|
||||
icon={IconSquareExpand}
|
||||
label={settingRes.string.CountSpaces}
|
||||
labelParams={{ count: spacesCount }}
|
||||
disabled={spacesCount === 0}
|
||||
kind="tertiary"
|
||||
size="medium"
|
||||
hasMenu
|
||||
/>
|
||||
{#if canDelete}
|
||||
<ButtonIcon icon={IconDelete} size="small" kind="secondary" {disabled} on:click={handleDelete} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<TextArea
|
||||
placeholder={settingRes.string.Description}
|
||||
|
@ -104,6 +104,8 @@ export default mergeIds(settingId, setting, {
|
||||
DeleteRoleConfirmation: '' as IntlString,
|
||||
DeleteWorkspace: '' as IntlString,
|
||||
DeleteWorkspaceConfirm: '' as IntlString,
|
||||
DeleteSpaceType: '' as IntlString,
|
||||
DeleteSpaceTypeConfirm: '' as IntlString,
|
||||
WorkspaceName: '' as IntlString,
|
||||
Workspace: '' as IntlString
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user