perf: update pam

This commit is contained in:
ibuler
2024-11-14 19:01:25 +08:00
parent e18726efc2
commit 636630fe57
5 changed files with 71 additions and 37 deletions

View File

@@ -16,7 +16,7 @@ export default [
{
path: '',
component: () => import('@/views/pam/AccountCheck/index.vue'),
name: 'AccountCheckSummary',
name: 'AccountCheckList',
meta: {
title: i18n.t('账号检查'),
menuTitle: i18n.t('账号检查')
@@ -25,7 +25,7 @@ export default [
{
path: 'create',
component: () => import('@/views/pam/AccountCheck/AccountCheckCreateUpdate.vue'),
name: 'AccountCheckCreate',
name: 'AccountCheckCreateUpdate',
hidden: true,
meta: {
title: i18n.t('AccountCheckCreate')

View File

@@ -5,7 +5,7 @@
<script>
import { GenericCreateUpdatePage } from '@/layout/components'
import { getChangeSecretFields } from '@/views/accounts/AccountChangeSecret/fields'
import { AssetSelect, AutomationParams } from '@/components'
import { AssetSelect } from '@/components'
import { crontab, interval, is_periodic } from '@/views/accounts/const'
export default {
@@ -32,6 +32,7 @@ export default {
fields: [
[this.$t('Basic'), ['name']],
[this.$t('Asset'), ['assets', 'nodes']],
[this.$t('Engine'), ['engines']],
[this.$t('Periodic'), ['is_periodic', 'interval', 'crontab']],
[this.$t('Other'), ['is_active', 'comment']]
],
@@ -52,6 +53,23 @@ export default {
}
}
},
engines: {
el: {
url: '/api/v1/accounts/account-check-engines/',
multiple: true,
ajax: {
transformOption: (item) => {
let name = item.name
let disabled = false
if (item.slug === 'check_gathered_account') {
name = `${name} (使用创建账号发现任务替代)`
disabled = true
}
return { label: name, value: item.id, disabled: disabled }
}
}
}
},
nodes: {
el: {
multiple: true,
@@ -82,20 +100,10 @@ export default {
},
is_periodic,
crontab,
interval,
params: {
component: AutomationParams,
label: this.$t('PushParams'),
el: {
method: 'push_account_method',
assets: this.assetIds,
nodes: this.nodeIds
interval
},
helpText: this.$t('ParamsHelpText')
}
},
createSuccessNextRoute: { name: 'AccountPushList' },
updateSuccessNextRoute: { name: 'AccountPushList' },
createSuccessNextRoute: { name: 'AccountCheckList' },
updateSuccessNextRoute: { name: 'AccountCheckList' },
afterGetRemoteMeta: this.handleAfterGetRemoteMeta,
cleanFormValue(data) {
const secretType = data.secret_type || ''

View File

@@ -16,12 +16,12 @@ export default {
tableConfig: {
url: '/api/v1/accounts/account-check-engines/',
columns: [
'name', 'display_name', 'description'
'name', 'comment'
],
columnsShow: {
min: ['name', 'actions'],
default: [
'name', 'display_name', 'description', 'actions'
'name', 'comment', 'actions'
]
},
columnsMeta: {

View File

@@ -6,6 +6,7 @@
import { DetailFormatter } from '@/components/Table/TableFormatters'
import { openTaskPage } from '@/utils/jms'
import { GenericListTable } from '@/layout/components'
import AmountFormatter from '@/components/Table/TableFormatters/AmountFormatter.vue'
export default {
name: 'AccountPushList',
@@ -18,13 +19,13 @@ export default {
tableConfig: {
url: '/api/v1/accounts/check-account-automations/',
columns: [
'name', 'assets', 'accounts', 'secret_strategy', 'is_periodic',
'name', 'assets', 'nodes', 'is_periodic',
'periodic_display', 'is_active', 'actions'
],
columnsShow: {
min: ['name', 'actions'],
default: [
'name', 'accounts', 'periodic_display',
'name', 'assets', 'nodes', 'periodic_display',
'executed_amount', 'is_active', 'actions'
]
},
@@ -35,9 +36,32 @@ export default {
route: 'AccountCheckDetail'
}
},
accounts: {
formatter: function(row) {
return <span> {row.accounts.join(', ')} </span>
assets: {
formatter: AmountFormatter,
formatterArgs: {
async: false,
getRoute({ row }) {
return {
name: 'AssetDetail',
params: {
id: row.id
}
}
}
}
},
nodes: {
formatter: AmountFormatter,
formatterArgs: {
async: false,
getRoute({ row }) {
return {
name: 'AssetDetail',
params: {
id: row.id
}
}
}
}
},
secret_strategy: {
@@ -82,6 +106,8 @@ export default {
},
actions: {
formatterArgs: {
canUpdate: () => true,
updateRoute: 'AccountCheckCreateUpdate',
extraActions: [
{
title: vm.$t('Execute'),
@@ -92,7 +118,7 @@ export default {
type: 'info',
callback: function({ row }) {
this.$axios.post(
`/api/v1/accounts/push-account-executions/`,
`/api/v1/accounts/check-account-executions/`,
{
automation: row.id,
type: row.type.value
@@ -111,7 +137,7 @@ export default {
hasRefresh: true,
hasExport: false,
hasImport: false,
createRoute: 'AccountCheckCreate',
createRoute: 'AccountCheckCreateUpdate',
canCreate: vm.$hasPerm('accounts.add_accountcheckautomation')
}
}

View File

@@ -21,18 +21,18 @@ export default {
hidden: !this.$hasPerm('accounts.view_accountrisk'),
component: () => import('@/views/pam/AccountCheck/AccountRiskList.vue')
},
// {
// title: this.$t('检查任务'),
// name: 'AccountCheckTask',
// hidden: !this.$hasPerm('accounts.view_accountcheckautomation'),
// component: () => import('./AccountCheckList.vue')
// },
// {
// title: this.$t('执行历史'),
// name: 'AccountCheckExecution',
// hidden: !this.$hasPerm('accounts.view_accountcheckautomation'),
// component: () => import('@/views/accounts/AccountPush/AccountPushExecutionList.vue')
// },
{
title: this.$t('检查任务'),
name: 'AccountCheckTask',
hidden: !this.$hasPerm('accounts.view_accountcheckautomation'),
component: () => import('./AccountCheckTaskList.vue')
},
{
title: this.$t('执行历史'),
name: 'AccountCheckExecution',
hidden: !this.$hasPerm('accounts.view_accountcheckautomation'),
component: () => import('@/views/accounts/AccountPush/AccountPushExecutionList.vue')
},
{
title: this.$t('检查引擎'),
name: 'AccountCheckEngine',