From b6d6309b13407b4ab842daa4a19894b9698a368e Mon Sep 17 00:00:00 2001 From: xlsea Date: Thu, 11 Jul 2024 11:28:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(sj=5F1.1.0-beta3):=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=88=A0=E9=99=A4=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/delete-alert.vue | 56 ++++++++++++++++++++++++++ src/store/modules/auth/index.ts | 22 +++++++++- src/store/modules/auth/shared.ts | 8 +++- src/typings/api.d.ts | 5 +++ src/typings/storage.d.ts | 3 ++ src/views/job/task/index.vue | 1 + src/views/retry/scene/index.vue | 1 + src/views/workflow/task/index.vue | 3 +- 8 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 src/components/common/delete-alert.vue diff --git a/src/components/common/delete-alert.vue b/src/components/common/delete-alert.vue new file mode 100644 index 0000000..ae47e2d --- /dev/null +++ b/src/components/common/delete-alert.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/src/store/modules/auth/index.ts b/src/store/modules/auth/index.ts index 5e85fa4..0f0488d 100644 --- a/src/store/modules/auth/index.ts +++ b/src/store/modules/auth/index.ts @@ -35,7 +35,12 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { userName: '', roles: [], buttons: [], - namespaceIds: [] + namespaceIds: [], + deleteAlert: { + 'job-task': true, + 'retry-scene': true, + 'workflow-task': true + } }); /** is super role in static route */ @@ -140,6 +145,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { info!.userName = info?.username; info!.roles = [roleTypeRecord[info.role]]; localStg.set('userInfo', info); + localStg.set('userInfo', info); Object.assign(userInfo, info); themeStore.setWatermarkText(`${userInfo.userName}@${appTitle}`); @@ -178,6 +184,16 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { localStg.set('namespaceId', namespaceId); } + function setDeleteAlert(type: Api.Auth.DeleteAlertType, value: boolean) { + userInfo.deleteAlert[type] = value; + localStg.set('deleteAlert', userInfo.deleteAlert); + } + + function getDeleteAlert(type: Api.Auth.DeleteAlertType) { + const deleteAlert = localStg.get('deleteAlert') || userInfo.deleteAlert; + return deleteAlert[type]; + } + return { token, userInfo, @@ -190,6 +206,8 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { getUserInfo, initUserInfo, initAppVersion, - setNamespaceId + setNamespaceId, + setDeleteAlert, + getDeleteAlert }; }); diff --git a/src/store/modules/auth/shared.ts b/src/store/modules/auth/shared.ts index 1eda573..eac0078 100644 --- a/src/store/modules/auth/shared.ts +++ b/src/store/modules/auth/shared.ts @@ -16,7 +16,12 @@ export function getUserInfo() { role: 1, roles: [], buttons: [], - namespaceIds: [] + namespaceIds: [], + deleteAlert: { + 'job-task': true, + 'retry-scene': true, + 'workflow-task': true + } }; const userInfo = localStg.get('userInfo') || emptyInfo; @@ -34,4 +39,5 @@ export function clearAuthStorage() { // localStg.remove('refreshToken'); localStg.remove('namespaceId'); localStg.remove('userInfo'); + localStg.remove('deleteAlert'); } diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index 54f4ba5..00b9cc9 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -130,6 +130,8 @@ declare namespace Api { namespaceIds: NamespaceId[]; } + type DeleteAlertType = 'job-task' | 'retry-scene' | 'workflow-task'; + interface UserInfo { id: string; userId: string; @@ -140,6 +142,9 @@ declare namespace Api { roles: string[]; buttons: string[]; namespaceIds: NamespaceId[]; + deleteAlert: { + [key in DeleteAlertType]: boolean; + }; } interface NamespaceId { diff --git a/src/typings/storage.d.ts b/src/typings/storage.d.ts index 0929db7..c662515 100644 --- a/src/typings/storage.d.ts +++ b/src/typings/storage.d.ts @@ -49,5 +49,8 @@ declare namespace StorageType { taskBatchId: string; data: Api.JobLog.JobMessage[]; }; + deleteAlert: { + [key in Api.Auth.DeleteAlertType]: boolean; + }; } } diff --git a/src/views/job/task/index.vue b/src/views/job/task/index.vue index 8ff0fc7..c0179c4 100644 --- a/src/views/job/task/index.vue +++ b/src/views/job/task/index.vue @@ -281,6 +281,7 @@ function handleExport() {