From e8cf8347e9b5282333c6b2fce1b56b4b9c844183 Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 14 Oct 2024 14:49:20 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=9F=BA=E6=9C=AC=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=A1=86=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Apps/AccountCreateUpdateForm/const.js | 3 +- .../Apps/AccountCreateUpdateForm/index.vue | 3 +- .../Apps/AccountListTable/AccountList.vue | 19 +- src/router/console/accounts.js | 650 +++++++++--------- src/router/pam/index.js | 2 +- src/views/pam/Account/AccountList.vue | 1 + 6 files changed, 345 insertions(+), 333 deletions(-) diff --git a/src/components/Apps/AccountCreateUpdateForm/const.js b/src/components/Apps/AccountCreateUpdateForm/const.js index bbfcc4d9c..5b82a6d68 100644 --- a/src/components/Apps/AccountCreateUpdateForm/const.js +++ b/src/components/Apps/AccountCreateUpdateForm/const.js @@ -163,7 +163,8 @@ export const accountFieldsMeta = (vm) => { !automation.ansible_enabled || !vm.$hasPerm('accounts.push_account') || (formValue.secret_type === 'ssh_key' && vm.iPlatform.type.value === 'windows') || - vm.addTemplate + vm.addTemplate || + !formValue.secret_reset } }, params: { diff --git a/src/components/Apps/AccountCreateUpdateForm/index.vue b/src/components/Apps/AccountCreateUpdateForm/index.vue index e3c138fc6..a4d45de91 100644 --- a/src/components/Apps/AccountCreateUpdateForm/index.vue +++ b/src/components/Apps/AccountCreateUpdateForm/index.vue @@ -65,7 +65,8 @@ export default { [this.$t('Basic'), ['assets', 'name', 'username', 'privileged', 'su_from', 'su_from_username']], [this.$t('Secret'), [ 'secret_type', 'password', 'ssh_key', 'token', - 'access_key', 'passphrase', 'api_key' + 'access_key', 'passphrase', 'api_key', + 'secret_reset' ]], [this.$t('Other'), ['push_now', 'params', 'on_invalid', 'is_active', 'comment']] ], diff --git a/src/components/Apps/AccountListTable/AccountList.vue b/src/components/Apps/AccountListTable/AccountList.vue index cd237a392..019deaac8 100644 --- a/src/components/Apps/AccountListTable/AccountList.vue +++ b/src/components/Apps/AccountListTable/AccountList.vue @@ -177,7 +177,7 @@ export default { formatter: () => { // Todo: 通用的 formatter, 点击后 10s 后还原为 * return ( - + ****** ) @@ -189,8 +189,8 @@ export default { formatter: () => { return ( - - + + ) @@ -248,7 +248,7 @@ export default { formatterArgs: { hasUpdate: false, // can set function(row, value) hasDelete: false, // can set function(row, value) - hasClone: this.hasClone, + hasClone: false, canClone: true, moreActionsTitle: this.$t('More'), extraActions: [ @@ -287,7 +287,7 @@ export default { }, { name: 'Test', - title: this.$t('验证密码'), + title: this.$t('验证密文'), can: ({ row }) => !this.$store.getters.currentOrgIsRoot && this.$hasPerm('accounts.verify_account') && @@ -330,6 +330,11 @@ export default { name: 'MoveToOther', title: '移动到其他资产', type: 'primary' + }, + { + name: 'Clone', + title: this.$t('Duplicate'), + divided: true } ] } @@ -558,4 +563,8 @@ export default { .cell a { color: var(--color-info); } + +.secret-col { + cursor: pointer; +} diff --git a/src/router/console/accounts.js b/src/router/console/accounts.js index 4aefb95ed..5402dc250 100644 --- a/src/router/console/accounts.js +++ b/src/router/console/accounts.js @@ -119,330 +119,330 @@ export default [ hidden: true } ] - }, - { - path: 'automations', - component: empty, - name: 'AccountAutomation', - meta: { - title: i18n.t('Automations'), - name: 'Automations', - icon: 'automation', - permissions: [] - }, - children: [ - { - path: 'account-push', - name: 'AccountPush', - component: empty, - redirect: { - name: 'AccountPushList' - }, - meta: { - app: 'accounts', - name: 'BaseAccountPushList', - resource: 'pushaccountautomation' - }, - children: [ - { - path: '', - component: () => import('@/views/accounts/AccountPush/index.vue'), - name: 'AccountPushList', - meta: { - title: i18n.t('AccountPushList'), - menuTitle: i18n.t('AccountPushList'), - permissions: ['accounts.view_pushaccountautomation'] - } - }, - { - path: 'create', - component: () => import('@/views/accounts/AccountPush/AccountPushCreateUpdate.vue'), - name: 'AccountPushCreate', - hidden: true, - meta: { - title: i18n.t('AccountPushCreate'), - // activeMenu: '/console/accounts/automations', - permissions: ['accounts.add_pushaccountautomation'] - } - }, - { - path: ':id/update', - component: () => import('@/views/accounts/AccountPush/AccountPushCreateUpdate.vue'), - name: 'AccountPushUpdate', - hidden: true, - meta: { - title: i18n.t('AccountPushUpdate'), - // activeMenu: '/console/accounts/automations', - permissions: ['accounts.change_pushaccountautomation'] - } - }, - { - path: ':id', - component: () => import('@/views/accounts/AccountPush/AccountPushDetail/index.vue'), - name: 'AccountPushDetail', - hidden: true, - meta: { - title: i18n.t('AccountPushList'), - // activeMenu: '/console/accounts/automations', - permissions: ['accounts.view_pushaccountautomation'] - } - }, - { - path: 'executions', - component: () => import('@/views/accounts/AccountPush/AccountPushExecutionList.vue'), - name: 'AccountPushExecutionList', - hidden: true, - meta: { - title: i18n.t('ExecutionList'), - // activeMenu: '/console/accounts/automations', - permissions: ['accounts.view_pushaccountexecution'] - } - }, - { - path: 'executions/:id', - component: () => import('@/views/accounts/AccountPush/AccountPushExecutionDetail/index.vue'), - name: 'AccountPushExecutionDetail', - hidden: true, - meta: { - title: i18n.t('ExecutionDetail'), - // activeMenu: '/console/accounts/automations', - permissions: ['accounts.view_pushaccountexecution'] - } - } - ] - }, - { - path: 'account-change-secret', - name: 'AccountChangeSecret', - component: empty, - redirect: { - name: 'AccountChangeSecretList' - }, - meta: { - title: i18n.t('BaseAccountChangeSecret'), - app: 'accounts', - licenseRequired: true - }, - children: [ - { - path: '', - component: () => import('@/views/accounts/AccountChangeSecret/index.vue'), - name: 'AccountChangeSecretList', - meta: { - menuTitle: i18n.t('ChangeCredentials'), - title: i18n.t('AccountChangeSecret'), - permissions: ['accounts.view_changesecretautomation'] - } - }, - { - path: 'create', - component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretCreateUpdate.vue'), - name: 'AccountChangeSecretCreate', - hidden: true, - meta: { - title: i18n.t('AssetChangeSecretCreate'), - permissions: ['accounts.add_changesecretautomation'] - } - }, - { - path: ':id/update', - component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretCreateUpdate.vue'), - name: 'AccountChangeSecretUpdate', - hidden: true, - meta: { - title: i18n.t('AssetChangeSecretUpdate'), - permissions: ['accounts.change_changesecretautomation'] - } - }, - { - path: ':id', - component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretDetail/index.vue'), - name: 'AccountChangeSecretDetail', - hidden: true, - meta: { - title: i18n.t('AccountChangeSecret'), - permissions: ['accounts.view_changesecretautomation'] - } - }, - { - path: 'executions', - component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretDetail/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue'), - name: 'AccountChangeSecretExecutionList', - hidden: true, - meta: { - title: i18n.t('ExecutionList'), - permissions: ['accounts.view_changesecretexecution'] - } - }, - { - path: 'executions/:id', - component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretDetail/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/index.vue'), - name: 'AccountChangeSecretExecutionDetail', - hidden: true, - meta: { - title: i18n.t('ExecutionDetail'), - permissions: ['accounts.view_changesecretexecution'] - } - } - ] - }, - { - path: 'account-gather', - component: empty, - redirect: { - name: 'AccountGatherList' - }, - name: 'AccountGather', - meta: { - title: i18n.t('AccountGatherList'), - app: 'accounts', - // activeMenu: '/console/accounts/automations', - licenseRequired: true - }, - children: [ - { - path: '', - component: () => import('@/views/accounts/AccountGather/index.vue'), - name: 'AccountGatherList', - meta: { - menuTitle: i18n.t('GatherAccounts'), - title: i18n.t('AccountGatherTaskList'), - // activeMenu: '/console/accounts/automations', - permissions: ['accounts.view_gatheredaccount'] - } - }, - { - path: 'create', - component: () => import('@/views/accounts/AccountGather/TaskCreateUpdate'), - name: 'AccountGatherTaskCreate', - hidden: true, - meta: { - title: i18n.t('AccountGatherTaskCreate'), - // activeMenu: '/console/accounts/automations', - permissions: ['accounts.add_gatheraccountsautomation'] - } - }, - { - path: ':id', - component: () => import('@/views/accounts/AccountGather/TaskDetail/index'), - name: 'AccountGatherTaskDetail', - hidden: true, - meta: { - title: i18n.t('AccountGatherTaskDetail'), - // activeMenu: '/console/accounts/automations', - permissions: ['accounts.view_gatheraccountsautomation'] - } - }, - { - path: ':id/update', - component: () => import('@/views/accounts/AccountGather/TaskCreateUpdate'), - name: 'AccountGatherTaskUpdate', - hidden: true, - meta: { - title: i18n.t('AccountGatherTaskUpdate'), - action: 'update', - permissions: ['accounts.change_gatheraccountsautomation'], - activeMenu: '/accounts/account-gather' - } - }, - { - path: 'executions', - component: () => import('@/views/accounts/AccountGather/TaskDetail/TaskExecutionList.vue'), - name: 'AccountGatherTaskExecutionList', - hidden: true, - meta: { - title: i18n.t('ExecutionList'), - // activeMenu: '/console/accounts/automations', - permissions: ['accounts.view_gatheraccountsexecution'] - } - }, - { - path: 'executions/:id', - component: () => import('@/views/accounts/AccountGather/TaskDetail/AccountGatherExecutionDetail/index.vue'), - name: 'AccountGatherExecutionDetail', - hidden: true, - meta: { - title: i18n.t('ExecutionDetail'), - // activeMenu: '/console/accounts/automations', - permissions: ['accounts.view_gatheraccountsexecution'] - } - } - ] - }, - { - path: 'account-backup', - component: empty, - name: 'AccountBackup', - redirect: { - name: 'AccountBackupList' - }, - meta: { - title: i18n.t('AccountBackup'), - app: 'accounts', - resource: 'accountbackupautomation', - licenseRequired: true - }, - children: [ - { - path: '', - component: () => import('@/views/accounts/AccountBackup/index.vue'), - name: 'AccountBackupList', - meta: { - menuTitle: i18n.t('AccountBackup'), - title: i18n.t('AccountBackupList'), - // activeMenu: '/console/accounts/automations', - permissions: ['accounts.view_accountbackupautomation'] - } - }, - { - path: 'create', - component: () => import('@/views/accounts/AccountBackup/AccountBackupCreateUpdate.vue'), - name: 'AccountBackupCreate', - meta: { - title: i18n.t('AccountBackupCreate'), - // activeMenu: '/console/accounts/automations', - action: 'create' - }, - hidden: true - }, - { - path: ':id/update', - component: () => import('@/views/accounts/AccountBackup/AccountBackupCreateUpdate.vue'), - name: 'AccountBackupUpdate', - meta: { - title: i18n.t('AccountBackupUpdate'), - // activeMenu: '/console/accounts/automations', - action: 'update' - }, - hidden: true - }, - { - path: ':id', - component: () => import('@/views/accounts/AccountBackup/AccountBackupDetail/index.vue'), - name: 'AccountBackupDetail', - // activeMenu: '/console/accounts/automations', - meta: { - title: i18n.t('AccountBackupDetail'), - activeMenu: '/console/accounts/automations' - }, - hidden: true - }, - { - path: 'executions', - component: () => import('@/views/accounts/AccountBackup/AccountBackupDetail/AccountBackupExecution/AccountBackupExecutionList.vue'), - name: 'AccountBackupExecutionList', - meta: { title: i18n.t('ExecutionDetail') }, - hidden: true - }, - { - path: 'executions/:id', - component: () => import('@/views/accounts/AccountBackup/AccountBackupDetail/AccountBackupExecution/AccountBackupExecutionDetail/index.vue'), - name: 'AccountBackupExecutionDetail', - meta: { title: i18n.t('ExecutionDetail') }, - hidden: true - } - ] - } - ] } + // { + // path: 'automations', + // component: empty, + // name: 'AccountAutomation', + // meta: { + // title: i18n.t('Automations'), + // name: 'Automations', + // icon: 'automation', + // permissions: [] + // }, + // children: [ + // { + // path: 'account-push', + // name: 'AccountPush', + // component: empty, + // redirect: { + // name: 'AccountPushList' + // }, + // meta: { + // app: 'accounts', + // name: 'BaseAccountPushList', + // resource: 'pushaccountautomation' + // }, + // children: [ + // { + // path: '', + // component: () => import('@/views/accounts/AccountPush/index.vue'), + // name: 'AccountPushList', + // meta: { + // title: i18n.t('AccountPushList'), + // menuTitle: i18n.t('AccountPushList'), + // permissions: ['accounts.view_pushaccountautomation'] + // } + // }, + // { + // path: 'create', + // component: () => import('@/views/accounts/AccountPush/AccountPushCreateUpdate.vue'), + // name: 'AccountPushCreate', + // hidden: true, + // meta: { + // title: i18n.t('AccountPushCreate'), + // // activeMenu: '/console/accounts/automations', + // permissions: ['accounts.add_pushaccountautomation'] + // } + // }, + // { + // path: ':id/update', + // component: () => import('@/views/accounts/AccountPush/AccountPushCreateUpdate.vue'), + // name: 'AccountPushUpdate', + // hidden: true, + // meta: { + // title: i18n.t('AccountPushUpdate'), + // // activeMenu: '/console/accounts/automations', + // permissions: ['accounts.change_pushaccountautomation'] + // } + // }, + // { + // path: ':id', + // component: () => import('@/views/accounts/AccountPush/AccountPushDetail/index.vue'), + // name: 'AccountPushDetail', + // hidden: true, + // meta: { + // title: i18n.t('AccountPushList'), + // // activeMenu: '/console/accounts/automations', + // permissions: ['accounts.view_pushaccountautomation'] + // } + // }, + // { + // path: 'executions', + // component: () => import('@/views/accounts/AccountPush/AccountPushExecutionList.vue'), + // name: 'AccountPushExecutionList', + // hidden: true, + // meta: { + // title: i18n.t('ExecutionList'), + // // activeMenu: '/console/accounts/automations', + // permissions: ['accounts.view_pushaccountexecution'] + // } + // }, + // { + // path: 'executions/:id', + // component: () => import('@/views/accounts/AccountPush/AccountPushExecutionDetail/index.vue'), + // name: 'AccountPushExecutionDetail', + // hidden: true, + // meta: { + // title: i18n.t('ExecutionDetail'), + // // activeMenu: '/console/accounts/automations', + // permissions: ['accounts.view_pushaccountexecution'] + // } + // } + // ] + // }, + // { + // path: 'account-change-secret', + // name: 'AccountChangeSecret', + // component: empty, + // redirect: { + // name: 'AccountChangeSecretList' + // }, + // meta: { + // title: i18n.t('BaseAccountChangeSecret'), + // app: 'accounts', + // licenseRequired: true + // }, + // children: [ + // { + // path: '', + // component: () => import('@/views/accounts/AccountChangeSecret/index.vue'), + // name: 'AccountChangeSecretList', + // meta: { + // menuTitle: i18n.t('ChangeCredentials'), + // title: i18n.t('AccountChangeSecret'), + // permissions: ['accounts.view_changesecretautomation'] + // } + // }, + // { + // path: 'create', + // component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretCreateUpdate.vue'), + // name: 'AccountChangeSecretCreate', + // hidden: true, + // meta: { + // title: i18n.t('AssetChangeSecretCreate'), + // permissions: ['accounts.add_changesecretautomation'] + // } + // }, + // { + // path: ':id/update', + // component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretCreateUpdate.vue'), + // name: 'AccountChangeSecretUpdate', + // hidden: true, + // meta: { + // title: i18n.t('AssetChangeSecretUpdate'), + // permissions: ['accounts.change_changesecretautomation'] + // } + // }, + // { + // path: ':id', + // component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretDetail/index.vue'), + // name: 'AccountChangeSecretDetail', + // hidden: true, + // meta: { + // title: i18n.t('AccountChangeSecret'), + // permissions: ['accounts.view_changesecretautomation'] + // } + // }, + // { + // path: 'executions', + // component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretDetail/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue'), + // name: 'AccountChangeSecretExecutionList', + // hidden: true, + // meta: { + // title: i18n.t('ExecutionList'), + // permissions: ['accounts.view_changesecretexecution'] + // } + // }, + // { + // path: 'executions/:id', + // component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretDetail/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/index.vue'), + // name: 'AccountChangeSecretExecutionDetail', + // hidden: true, + // meta: { + // title: i18n.t('ExecutionDetail'), + // permissions: ['accounts.view_changesecretexecution'] + // } + // } + // ] + // }, + // { + // path: 'account-gather', + // component: empty, + // redirect: { + // name: 'AccountGatherList' + // }, + // name: 'AccountGather', + // meta: { + // title: i18n.t('AccountGatherList'), + // app: 'accounts', + // // activeMenu: '/console/accounts/automations', + // licenseRequired: true + // }, + // children: [ + // { + // path: '', + // component: () => import('@/views/accounts/AccountGather/index.vue'), + // name: 'AccountGatherList', + // meta: { + // menuTitle: i18n.t('GatherAccounts'), + // title: i18n.t('AccountGatherTaskList'), + // // activeMenu: '/console/accounts/automations', + // permissions: ['accounts.view_gatheredaccount'] + // } + // }, + // { + // path: 'create', + // component: () => import('@/views/accounts/AccountGather/TaskCreateUpdate'), + // name: 'AccountGatherTaskCreate', + // hidden: true, + // meta: { + // title: i18n.t('AccountGatherTaskCreate'), + // // activeMenu: '/console/accounts/automations', + // permissions: ['accounts.add_gatheraccountsautomation'] + // } + // }, + // { + // path: ':id', + // component: () => import('@/views/accounts/AccountGather/TaskDetail/index'), + // name: 'AccountGatherTaskDetail', + // hidden: true, + // meta: { + // title: i18n.t('AccountGatherTaskDetail'), + // // activeMenu: '/console/accounts/automations', + // permissions: ['accounts.view_gatheraccountsautomation'] + // } + // }, + // { + // path: ':id/update', + // component: () => import('@/views/accounts/AccountGather/TaskCreateUpdate'), + // name: 'AccountGatherTaskUpdate', + // hidden: true, + // meta: { + // title: i18n.t('AccountGatherTaskUpdate'), + // action: 'update', + // permissions: ['accounts.change_gatheraccountsautomation'], + // activeMenu: '/accounts/account-gather' + // } + // }, + // { + // path: 'executions', + // component: () => import('@/views/accounts/AccountGather/TaskDetail/TaskExecutionList.vue'), + // name: 'AccountGatherTaskExecutionList', + // hidden: true, + // meta: { + // title: i18n.t('ExecutionList'), + // // activeMenu: '/console/accounts/automations', + // permissions: ['accounts.view_gatheraccountsexecution'] + // } + // }, + // { + // path: 'executions/:id', + // component: () => import('@/views/accounts/AccountGather/TaskDetail/AccountGatherExecutionDetail/index.vue'), + // name: 'AccountGatherExecutionDetail', + // hidden: true, + // meta: { + // title: i18n.t('ExecutionDetail'), + // // activeMenu: '/console/accounts/automations', + // permissions: ['accounts.view_gatheraccountsexecution'] + // } + // } + // ] + // }, + // { + // path: 'account-backup', + // component: empty, + // name: 'AccountBackup', + // redirect: { + // name: 'AccountBackupList' + // }, + // meta: { + // title: i18n.t('AccountBackup'), + // app: 'accounts', + // resource: 'accountbackupautomation', + // licenseRequired: true + // }, + // children: [ + // { + // path: '', + // component: () => import('@/views/accounts/AccountBackup/index.vue'), + // name: 'AccountBackupList', + // meta: { + // menuTitle: i18n.t('AccountBackup'), + // title: i18n.t('AccountBackupList'), + // // activeMenu: '/console/accounts/automations', + // permissions: ['accounts.view_accountbackupautomation'] + // } + // }, + // { + // path: 'create', + // component: () => import('@/views/accounts/AccountBackup/AccountBackupCreateUpdate.vue'), + // name: 'AccountBackupCreate', + // meta: { + // title: i18n.t('AccountBackupCreate'), + // // activeMenu: '/console/accounts/automations', + // action: 'create' + // }, + // hidden: true + // }, + // { + // path: ':id/update', + // component: () => import('@/views/accounts/AccountBackup/AccountBackupCreateUpdate.vue'), + // name: 'AccountBackupUpdate', + // meta: { + // title: i18n.t('AccountBackupUpdate'), + // // activeMenu: '/console/accounts/automations', + // action: 'update' + // }, + // hidden: true + // }, + // { + // path: ':id', + // component: () => import('@/views/accounts/AccountBackup/AccountBackupDetail/index.vue'), + // name: 'AccountBackupDetail', + // // activeMenu: '/console/accounts/automations', + // meta: { + // title: i18n.t('AccountBackupDetail'), + // activeMenu: '/console/accounts/automations' + // }, + // hidden: true + // }, + // { + // path: 'executions', + // component: () => import('@/views/accounts/AccountBackup/AccountBackupDetail/AccountBackupExecution/AccountBackupExecutionList.vue'), + // name: 'AccountBackupExecutionList', + // meta: { title: i18n.t('ExecutionDetail') }, + // hidden: true + // }, + // { + // path: 'executions/:id', + // component: () => import('@/views/accounts/AccountBackup/AccountBackupDetail/AccountBackupExecution/AccountBackupExecutionDetail/index.vue'), + // name: 'AccountBackupExecutionDetail', + // meta: { title: i18n.t('ExecutionDetail') }, + // hidden: true + // } + // ] + // } + // ] + // } ] diff --git a/src/router/pam/index.js b/src/router/pam/index.js index 55d7eb0a5..8e9c21c6f 100644 --- a/src/router/pam/index.js +++ b/src/router/pam/index.js @@ -36,7 +36,7 @@ export default { name: 'PamAccounts', component: () => import('@/views/pam/Account/index.vue'), meta: { - title: i18n.t('Accounts'), + title: i18n.t('特权账号'), icon: 'accounts', permissions: [] } diff --git a/src/views/pam/Account/AccountList.vue b/src/views/pam/Account/AccountList.vue index 0c7e68ed8..361db5a50 100644 --- a/src/views/pam/Account/AccountList.vue +++ b/src/views/pam/Account/AccountList.vue @@ -123,6 +123,7 @@ export default { .expanded-filter-zone { display: flex; + justify-content: space-between; h5 { font-weight: 600;