From f6125f0e75359ab81cc492780e4a26857faa9c10 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Tue, 21 Feb 2023 17:52:45 +0800 Subject: [PATCH] perf: change secret is_active --- .../AccountChangeSecretInfo.vue | 2 +- .../AccountChangeSecret/AccountChangeSecretList.vue | 9 ++++++--- .../AccountPush/AccountPushDetail/AccountPushInfo.vue | 2 +- src/views/accounts/AccountPush/AccountPushList.vue | 8 +++++--- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/views/accounts/AccountChangeSecret/AccountChangeSecretDetail/AccountChangeSecretInfo.vue b/src/views/accounts/AccountChangeSecret/AccountChangeSecretDetail/AccountChangeSecretInfo.vue index e1b6ebdac..d9f0ec47d 100644 --- a/src/views/accounts/AccountChangeSecret/AccountChangeSecretDetail/AccountChangeSecretInfo.vue +++ b/src/views/accounts/AccountChangeSecret/AccountChangeSecretDetail/AccountChangeSecretInfo.vue @@ -81,7 +81,7 @@ export default { return {this.object.is_periodic ? val : ''} } }, - 'date_created', 'date_updated', 'comment' + 'date_created', 'date_updated', 'comment', 'is_active' ] } }, diff --git a/src/views/accounts/AccountChangeSecret/AccountChangeSecretList.vue b/src/views/accounts/AccountChangeSecret/AccountChangeSecretList.vue index 7cee2016e..5b1473b2f 100644 --- a/src/views/accounts/AccountChangeSecret/AccountChangeSecretList.vue +++ b/src/views/accounts/AccountChangeSecret/AccountChangeSecretList.vue @@ -20,13 +20,13 @@ export default { columnsExclude: ['password_rules'], columns: [ 'name', 'accounts', 'secret_strategy', 'is_periodic', - 'periodic_display', 'executed_amount', 'actions' + 'periodic_display', 'executed_amount', 'is_active', 'actions' ], columnsShow: { min: ['name', 'actions'], default: [ 'name', 'accounts', 'secret_strategy', 'is_periodic', - 'periodic_display', 'executed_amount', 'actions' + 'periodic_display', 'executed_amount', 'is_active', 'actions' ] }, columnsMeta: { @@ -92,8 +92,11 @@ export default { { title: vm.$t('xpack.Execute'), name: 'execute', - can: this.$hasPerm('accounts.add_changesecretexection'), + can: ({ row }) => { + return row.is_active && vm.$hasPerm('accounts.add_changesecretexection') + }, type: 'info', + disabled: ({ row }) => !row.is_active, callback: function({ row }) { this.$axios.post( `/api/v1/accounts/change-secret-executions/`, diff --git a/src/views/accounts/AccountPush/AccountPushDetail/AccountPushInfo.vue b/src/views/accounts/AccountPush/AccountPushDetail/AccountPushInfo.vue index 66bb7d57e..4182fc4f4 100644 --- a/src/views/accounts/AccountPush/AccountPushDetail/AccountPushInfo.vue +++ b/src/views/accounts/AccountPush/AccountPushDetail/AccountPushInfo.vue @@ -81,7 +81,7 @@ export default { return {this.object.is_periodic ? val : ''} } }, - 'date_created', 'date_updated', 'comment' + 'date_created', 'date_updated', 'comment', 'is_active' ] } }, diff --git a/src/views/accounts/AccountPush/AccountPushList.vue b/src/views/accounts/AccountPush/AccountPushList.vue index cac314e5b..9b5988156 100644 --- a/src/views/accounts/AccountPush/AccountPushList.vue +++ b/src/views/accounts/AccountPush/AccountPushList.vue @@ -19,13 +19,13 @@ export default { url: '/api/v1/accounts/push-account-automations/', columns: [ 'name', 'accounts', 'secret_strategy', 'is_periodic', - 'periodic_display', 'executed_amount', 'actions' + 'periodic_display', 'executed_amount', 'is_active', 'actions' ], columnsShow: { min: ['name', 'actions'], default: [ 'name', 'accounts', 'secret_strategy', 'is_periodic', - 'periodic_display', 'executed_amount', 'actions' + 'periodic_display', 'executed_amount', 'is_active', 'actions' ] }, columnsMeta: { @@ -96,7 +96,9 @@ export default { { title: vm.$t('xpack.Execute'), name: 'execute', - can: this.$hasPerm('accounts.add_pushaccountexecution'), + can: ({ row }) => { + return row.is_active && vm.$hasPerm('accounts.add_pushaccountexecution') + }, type: 'info', callback: function({ row }) { this.$axios.post(