From 581e00353cc82d10b0d309fb450fdc74334ffff2 Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Wed, 11 Sep 2024 13:45:52 +0700 Subject: [PATCH] UBERF-8063 Unarchive action for wiki and drive (#6522) Signed-off-by: Alexander Onnikov --- models/document/src/index.ts | 26 +++++++++++++++++++++- models/document/src/plugin.ts | 3 ++- models/drive/src/index.ts | 32 +++++++++++++++++++++++++++- models/drive/src/plugin.ts | 3 ++- plugins/document-assets/lang/en.json | 3 ++- plugins/document-assets/lang/es.json | 3 ++- plugins/document-assets/lang/fr.json | 3 ++- plugins/document-assets/lang/pt.json | 3 ++- plugins/document-assets/lang/ru.json | 3 ++- plugins/document-assets/lang/zh.json | 3 ++- plugins/drive-assets/lang/en.json | 3 ++- plugins/drive-assets/lang/es.json | 3 ++- plugins/drive-assets/lang/fr.json | 3 ++- plugins/drive-assets/lang/pt.json | 3 ++- plugins/drive-assets/lang/ru.json | 3 ++- plugins/drive-assets/lang/zh.json | 3 ++- 16 files changed, 84 insertions(+), 16 deletions(-) diff --git a/models/document/src/index.ts b/models/document/src/index.ts index a3f167cc0e..19a7ca1139 100644 --- a/models/document/src/index.ts +++ b/models/document/src/index.ts @@ -47,7 +47,7 @@ import { generateClassNotificationTypes } from '@hcengineering/model-notificatio import preference, { TPreference } from '@hcengineering/model-preference' import presentation from '@hcengineering/model-presentation' import tracker from '@hcengineering/model-tracker' -import view, { actionTemplates, createAction } from '@hcengineering/model-view' +import view, { actionTemplates, createAction, type ViewAction } from '@hcengineering/model-view' import workbench from '@hcengineering/model-workbench' import notification from '@hcengineering/notification' import { getEmbeddedLabel, type Asset } from '@hcengineering/platform' @@ -233,6 +233,30 @@ function defineTeamspace (builder: Builder): void { actions: [tracker.action.EditRelatedTargets, tracker.action.NewRelatedIssue] }) + createAction(builder, { + label: view.string.UnArchive, + icon: view.icon.Archive, + action: view.actionImpl.UpdateDocument as ViewAction, + actionProps: { + key: 'archived', + ask: true, + value: false, + label: view.string.UnArchive, + message: document.string.UnarchiveConfirm + }, + input: 'any', + category: view.category.General, + target: document.class.Teamspace, + visibilityTester: view.function.CanArchiveSpace, + query: { + archived: true + }, + context: { + mode: ['context', 'browser'], + group: 'tools' + } + }) + createAction( builder, { diff --git a/models/document/src/plugin.ts b/models/document/src/plugin.ts index b300742654..f09f46de22 100644 --- a/models/document/src/plugin.ts +++ b/models/document/src/plugin.ts @@ -64,6 +64,7 @@ export default mergeIds(documentId, document, { ConfigDescription: '' as IntlString, ParentDocument: '' as IntlString, ChildDocument: '' as IntlString, - LockedBy: '' as IntlString + LockedBy: '' as IntlString, + UnarchiveConfirm: '' as IntlString } }) diff --git a/models/drive/src/index.ts b/models/drive/src/index.ts index 249da898a1..6ed7b8cbdf 100644 --- a/models/drive/src/index.ts +++ b/models/drive/src/index.ts @@ -58,7 +58,13 @@ import { TAttachedDoc, TDoc, TType, TTypedSpace } from '@hcengineering/model-cor import presentation from '@hcengineering/model-presentation' import print from '@hcengineering/model-print' import tracker from '@hcengineering/model-tracker' -import view, { type Viewlet, actionTemplates, classPresenter, createAction } from '@hcengineering/model-view' +import view, { + type ViewAction, + type Viewlet, + actionTemplates, + classPresenter, + createAction +} from '@hcengineering/model-view' import workbench from '@hcengineering/model-workbench' import { getEmbeddedLabel } from '@hcengineering/platform' @@ -279,6 +285,30 @@ function defineDrive (builder: Builder): void { actions: [tracker.action.EditRelatedTargets, print.action.Print, tracker.action.NewRelatedIssue] }) + createAction(builder, { + label: view.string.UnArchive, + icon: view.icon.Archive, + action: view.actionImpl.UpdateDocument as ViewAction, + actionProps: { + key: 'archived', + ask: true, + value: false, + label: view.string.UnArchive, + message: drive.string.UnarchiveConfirm + }, + input: 'any', + category: view.category.General, + target: drive.class.Drive, + visibilityTester: view.function.CanArchiveSpace, + query: { + archived: true + }, + context: { + mode: ['context', 'browser'], + group: 'tools' + } + }) + createAction( builder, { diff --git a/models/drive/src/plugin.ts b/models/drive/src/plugin.ts index 533cb025d5..2d5e2873fe 100644 --- a/models/drive/src/plugin.ts +++ b/models/drive/src/plugin.ts @@ -103,6 +103,7 @@ export default mergeIds(driveId, drive, { Files: '' as IntlString, Folders: '' as IntlString, Version: '' as IntlString, - Restore: '' as IntlString + Restore: '' as IntlString, + UnarchiveConfirm: '' as IntlString } }) diff --git a/plugins/document-assets/lang/en.json b/plugins/document-assets/lang/en.json index 76c77d4a14..0e2b8e0413 100644 --- a/plugins/document-assets/lang/en.json +++ b/plugins/document-assets/lang/en.json @@ -58,6 +58,7 @@ "Icon": "Icon", "Color": "Color", "RoleLabel": "Role: {role}", - "Embeddings": "Embeddings" + "Embeddings": "Embeddings", + "UnarchiveConfirm": "Do you want to unarchive teamspace?" } } \ No newline at end of file diff --git a/plugins/document-assets/lang/es.json b/plugins/document-assets/lang/es.json index 5564f90024..df1b1e855b 100644 --- a/plugins/document-assets/lang/es.json +++ b/plugins/document-assets/lang/es.json @@ -51,6 +51,7 @@ "Icon": "Icono", "Color": "Color", "RoleLabel": "Role: {role}", - "Embeddings": "Incrustaciones" + "Embeddings": "Incrustaciones", + "UnarchiveConfirm": "¿Quieres desarchivar el trabajo?" } } \ No newline at end of file diff --git a/plugins/document-assets/lang/fr.json b/plugins/document-assets/lang/fr.json index 49badd7dbf..929b6f6067 100644 --- a/plugins/document-assets/lang/fr.json +++ b/plugins/document-assets/lang/fr.json @@ -51,6 +51,7 @@ "Icon": "Icône", "Color": "Couleur", "RoleLabel": "Rôle : {role}", - "Embeddings": "Intégrations" + "Embeddings": "Intégrations", + "UnarchiveConfirm": "Voulez-vous désarchiver le l'espace d'équipe ?" } } \ No newline at end of file diff --git a/plugins/document-assets/lang/pt.json b/plugins/document-assets/lang/pt.json index eb96844d02..6e287e3e76 100644 --- a/plugins/document-assets/lang/pt.json +++ b/plugins/document-assets/lang/pt.json @@ -51,6 +51,7 @@ "Icon": "Ícone", "Color": "Cor", "RoleLabel": "Papel: {role}", - "Embeddings": "Incorporações" + "Embeddings": "Incorporações", + "UnarchiveConfirm": "Você deseja desarquivar o trabalho?" } } \ No newline at end of file diff --git a/plugins/document-assets/lang/ru.json b/plugins/document-assets/lang/ru.json index f3c71698e0..b199cba30e 100644 --- a/plugins/document-assets/lang/ru.json +++ b/plugins/document-assets/lang/ru.json @@ -58,6 +58,7 @@ "Icon": "Иконка", "Color": "Цвет", "RoleLabel": "Роль: {role}", - "Embeddings": "Вложения" + "Embeddings": "Вложения", + "UnarchiveConfirm": "Вы уверены, что хотите разархивировать пространство?" } } \ No newline at end of file diff --git a/plugins/document-assets/lang/zh.json b/plugins/document-assets/lang/zh.json index 6868575a08..ccefd569c4 100644 --- a/plugins/document-assets/lang/zh.json +++ b/plugins/document-assets/lang/zh.json @@ -62,6 +62,7 @@ "Icon": "图标", "Color": "颜色", "RoleLabel": "角色:{role}", - "Embeddings": "嵌入" + "Embeddings": "嵌入", + "UnarchiveConfirm": "您确定要取消存档吗?" } } diff --git a/plugins/drive-assets/lang/en.json b/plugins/drive-assets/lang/en.json index 917295a9c3..25c79994d0 100644 --- a/plugins/drive-assets/lang/en.json +++ b/plugins/drive-assets/lang/en.json @@ -27,6 +27,7 @@ "Rename": "Rename", "Restore": "Restore", "RoleLabel": "Role", - "Root": "/" + "Root": "/", + "UnarchiveConfirm": "Are you sure you want to unarchive the drive?" } } diff --git a/plugins/drive-assets/lang/es.json b/plugins/drive-assets/lang/es.json index c93bd5a2f8..17873b4daf 100644 --- a/plugins/drive-assets/lang/es.json +++ b/plugins/drive-assets/lang/es.json @@ -27,6 +27,7 @@ "Rename": "Renombrar", "Restore": "Restaurar", "RoleLabel": "Rol", - "Root": "/" + "Root": "/", + "UnarchiveConfirm": "¿Estás seguro de que deseas desarchivar la unidad?" } } \ No newline at end of file diff --git a/plugins/drive-assets/lang/fr.json b/plugins/drive-assets/lang/fr.json index 4b1a26856d..6012992cf4 100644 --- a/plugins/drive-assets/lang/fr.json +++ b/plugins/drive-assets/lang/fr.json @@ -27,6 +27,7 @@ "Rename": "Renommer", "Restore": "Restaurer", "RoleLabel": "Rôle", - "Root": "/" + "Root": "/", + "UnarchiveConfirm": "Êtes-vous sûr de vouloir désarchiver le disque?" } } \ No newline at end of file diff --git a/plugins/drive-assets/lang/pt.json b/plugins/drive-assets/lang/pt.json index 0a2039008e..4755fcec3f 100644 --- a/plugins/drive-assets/lang/pt.json +++ b/plugins/drive-assets/lang/pt.json @@ -27,6 +27,7 @@ "Rename": "Renomear", "Restore": "Restaurar", "RoleLabel": "Papel", - "Root": "/" + "Root": "/", + "UnarchiveConfirm": "Tem a certeza de que deseja desarquivar a unidade?" } } \ No newline at end of file diff --git a/plugins/drive-assets/lang/ru.json b/plugins/drive-assets/lang/ru.json index 5faa793790..9c4c846a2a 100644 --- a/plugins/drive-assets/lang/ru.json +++ b/plugins/drive-assets/lang/ru.json @@ -27,6 +27,7 @@ "Rename": "Переименовать", "Restore": "Восстановить", "RoleLabel": "Роль", - "Root": "/" + "Root": "/", + "UnarchiveConfirm": "Вы уверены, что хотите разархивировать диск?" } } diff --git a/plugins/drive-assets/lang/zh.json b/plugins/drive-assets/lang/zh.json index 6309c7cd7a..a9400d352b 100644 --- a/plugins/drive-assets/lang/zh.json +++ b/plugins/drive-assets/lang/zh.json @@ -27,6 +27,7 @@ "Rename": "重命名", "Restore": "恢复", "RoleLabel": "角色", - "Root": "/" + "Root": "/", + "UnarchiveConfirm": "您确定要取消存档磁盘吗?" } }