From 632be611869a32cc2d24eb32fb81dee4db3dbc26 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Wed, 14 Aug 2024 16:05:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E5=BA=93=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=A1=A5=E5=85=85=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fileManagement/components/rightBox.vue | 59 ++++++++++--------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/frontend/src/views/project-management/fileManagement/components/rightBox.vue b/frontend/src/views/project-management/fileManagement/components/rightBox.vue index cb0ce5ffff..c61a225a1c 100644 --- a/frontend/src/views/project-management/fileManagement/components/rightBox.vue +++ b/frontend/src/views/project-management/fileManagement/components/rightBox.vue @@ -493,23 +493,23 @@ label: 'project.fileManagement.delete', eventTag: 'delete', danger: true, + permission: ['PROJECT_FILE_MANAGEMENT:READ+DELETE'], }, ]; } - const moveActions = [ + const normalActions = [ { label: 'project.fileManagement.move', eventTag: 'move', + permission: ['PROJECT_FILE_MANAGEMENT:READ+UPDATE'], }, { isDivider: true, }, - ]; - - const normalActions = [ { label: 'project.fileManagement.delete', eventTag: 'delete', + permission: ['PROJECT_FILE_MANAGEMENT:READ+DELETE'], danger: true, }, ]; @@ -518,8 +518,8 @@ { label: 'project.fileManagement.download', eventTag: 'download', + permission: ['PROJECT_FILE_MANAGEMENT:READ+DOWNLOAD'], }, - ...moveActions, ...normalActions, ]; } @@ -527,58 +527,63 @@ }); function getJarFileActions(record: FileItem) { - let enableActions: ActionsItem[] = [ + const moveFileActions: ActionsItem[] = [ + { + label: 'project.fileManagement.move', + eventTag: 'move', + permission: ['PROJECT_FILE_MANAGEMENT:READ+UPDATE'], + }, + ]; + let enableFileActions = [ { label: 'common.enable', eventTag: 'toggle', + permission: ['PROJECT_FILE_MANAGEMENT:READ+UPDATE'], }, { label: 'common.disable', eventTag: 'toggle', + permission: ['PROJECT_FILE_MANAGEMENT:READ+UPDATE'], }, ]; if (record.enable) { - enableActions = enableActions.filter((e) => e.label !== 'common.enable'); + enableFileActions = enableFileActions.filter((e) => e.label !== 'common.enable'); } else if (record.enable === false) { - enableActions = enableActions.filter((e) => e.label !== 'common.disable'); + enableFileActions = enableFileActions.filter((e) => e.label !== 'common.disable'); } - const deleteActions = [ - { - label: 'project.fileManagement.delete', - eventTag: 'delete', - danger: true, - }, - ]; - - const jarFileActions: ActionsItem[] = [ - { - label: 'project.fileManagement.move', - eventTag: 'move', - }, + const deleteFileActions: ActionsItem[] = [ { isDivider: true, }, + { + label: 'project.fileManagement.delete', + eventTag: 'delete', + permission: ['PROJECT_FILE_MANAGEMENT:READ+DELETE'], + danger: true, + }, ]; - if (showType.value === 'card') { return [ { label: 'project.fileManagement.download', eventTag: 'download', + permission: ['PROJECT_FILE_MANAGEMENT:READ+DOWNLOAD'], }, - ...jarFileActions, - ...enableActions, - ...deleteActions, + ...moveFileActions, + ...enableFileActions, + ...deleteFileActions, ]; } if (record.storage === 'GIT') { - return jarFileActions.filter((e) => e.eventTag !== 'move'); + enableFileActions = showType.value === 'list' ? [] : enableFileActions; + + return [...enableFileActions, ...deleteFileActions]; } - return [...jarFileActions, ...deleteActions]; + return [...moveFileActions, ...deleteFileActions]; } const hasOperationPermission = computed(() => hasAnyPermission([