mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-15 14:24:39 +00:00
feat: 批量测试账号可连接性
This commit is contained in:
@@ -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'),
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"accounts": {
|
||||
"BulkVerify": "批量测试可连接性",
|
||||
"Test": "测试",
|
||||
"QuickTest": "测试",
|
||||
"AutoPush": "自动推送",
|
||||
"GeneralAccounts": "普通账号",
|
||||
"VirtualAccounts": "虚拟账号",
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row :gutter="24">
|
||||
<el-col :md="24" :sm="24">
|
||||
<el-col :md="14" :sm="24">
|
||||
<AccountListTable
|
||||
ref="ListTable"
|
||||
:asset="object"
|
||||
@@ -20,17 +20,23 @@
|
||||
@onConfirm="onConfirm"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :md="10" :sm="24">
|
||||
<QuickActions :actions="quickActions" :title="title" type="primary" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { AccountListTable } from '@/components'
|
||||
import QuickActions from '@/components/QuickActions'
|
||||
import AccountTemplateDialog from '@/views/assets/Asset/AssetCreateUpdate/components/AccountTemplateDialog'
|
||||
import { openTaskPage } from '@/utils/jms'
|
||||
|
||||
export default {
|
||||
name: 'Detail',
|
||||
components: {
|
||||
QuickActions,
|
||||
AccountListTable,
|
||||
AccountTemplateDialog
|
||||
},
|
||||
@@ -46,6 +52,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: this.$t('accounts.QuickTest'),
|
||||
templateDialogVisible: false,
|
||||
headerExtraActions: [
|
||||
{
|
||||
@@ -56,6 +63,25 @@ export default {
|
||||
this.templateDialogVisible = true
|
||||
}
|
||||
}
|
||||
],
|
||||
quickActions: [
|
||||
{
|
||||
title: this.$t('accounts.BulkVerify'),
|
||||
attrs: {
|
||||
type: 'primary',
|
||||
label: this.$tc('accounts.Test')
|
||||
},
|
||||
callbacks: Object.freeze({
|
||||
click: () => {
|
||||
this.$axios.post(
|
||||
`/api/v1/accounts/accounts/tasks/`,
|
||||
{ action: 'verify', assets: [this.object.id] }
|
||||
).then(res => {
|
||||
openTaskPage(res['task'])
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user