From ce80d36b8b9bfb67de44ff88bc27071f96ded647 Mon Sep 17 00:00:00 2001
From: feng <1304903146@qq.com>
Date: Mon, 29 Jan 2024 14:40:49 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=B9=E9=87=8F=E6=B5=8B=E8=AF=95?=
=?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=8F=AF=E8=BF=9E=E6=8E=A5=E6=80=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Apps/AccountListTable/AccountList.vue | 21 +++++++++++++-
src/i18n/langs/zh.json | 3 ++
.../accounts/Account/AccountDetail/Detail.vue | 4 +--
.../assets/Asset/AssetDetail/Account.vue | 28 ++++++++++++++++++-
4 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/src/components/Apps/AccountListTable/AccountList.vue b/src/components/Apps/AccountListTable/AccountList.vue
index fe50f58a8..903efbd77 100644
--- a/src/components/Apps/AccountListTable/AccountList.vue
+++ b/src/components/Apps/AccountListTable/AccountList.vue
@@ -239,7 +239,7 @@ export default {
},
{
name: 'Test',
- title: this.$t('common.Test'),
+ title: this.$t('accounts.Test'),
can: ({ row }) =>
!this.$store.getters.currentOrgIsRoot &&
this.$hasPerm('accounts.change_account') &&
@@ -339,6 +339,25 @@ export default {
...this.headerExtraActions
],
extraMoreActions: [
+ {
+ name: 'BulkVerify',
+ title: this.$t('accounts.BulkVerify'),
+ type: 'primary',
+ fa: 'fa-handshake-o',
+ can: ({ selectedRows }) => {
+ return selectedRows.length > 0
+ },
+ callback: function({ selectedRows }) {
+ const ids = selectedRows.map(v => { return v.id })
+ this.$axios.post(
+ '/api/v1/accounts/accounts/tasks/',
+ { action: 'verify', accounts: ids }).then(res => {
+ openTaskPage(res['task'])
+ }).catch(err => {
+ this.$message.error(this.$tc('common.bulkVerifyErrorMsg' + ' ' + err))
+ })
+ }.bind(this)
+ },
{
name: 'ClearSecrets',
title: this.$t('common.ClearSecret'),
diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json
index d35df60c2..63827c8b7 100644
--- a/src/i18n/langs/zh.json
+++ b/src/i18n/langs/zh.json
@@ -1,5 +1,8 @@
{
"accounts": {
+ "BulkVerify": "批量测试可连接性",
+ "Test": "测试",
+ "QuickTest": "测试",
"AutoPush": "自动推送",
"GeneralAccounts": "普通账号",
"VirtualAccounts": "虚拟账号",
diff --git a/src/views/accounts/Account/AccountDetail/Detail.vue b/src/views/accounts/Account/AccountDetail/Detail.vue
index dac119f50..9e8dbe20b 100644
--- a/src/views/accounts/Account/AccountDetail/Detail.vue
+++ b/src/views/accounts/Account/AccountDetail/Detail.vue
@@ -91,7 +91,7 @@ export default {
title: this.$t('assets.TestAccountConnective'),
attrs: {
type: 'primary',
- label: this.$t('assets.Test'),
+ label: this.$t('accounts.Test'),
disabled: (
!vm.$hasPerm('accounts.verify_account') ||
!vm.object.asset.auto_config?.ansible_enabled ||
@@ -104,7 +104,7 @@ export default {
this.$axios.post(
`/api/v1/accounts/accounts/tasks/`,
{
- action: 'test',
+ action: 'verify',
accounts: [this.object.id]
}
).then(res => {
diff --git a/src/views/assets/Asset/AssetDetail/Account.vue b/src/views/assets/Asset/AssetDetail/Account.vue
index 81e966a2d..2eb4a90c9 100644
--- a/src/views/assets/Asset/AssetDetail/Account.vue
+++ b/src/views/assets/Asset/AssetDetail/Account.vue
@@ -1,7 +1,7 @@