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

View File

@@ -5,7 +5,7 @@
<script> <script>
import { GenericCreateUpdatePage } from '@/layout/components' import { GenericCreateUpdatePage } from '@/layout/components'
import { getChangeSecretFields } from '@/views/accounts/AccountChangeSecret/fields' 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' import { crontab, interval, is_periodic } from '@/views/accounts/const'
export default { export default {
@@ -32,6 +32,7 @@ export default {
fields: [ fields: [
[this.$t('Basic'), ['name']], [this.$t('Basic'), ['name']],
[this.$t('Asset'), ['assets', 'nodes']], [this.$t('Asset'), ['assets', 'nodes']],
[this.$t('Engine'), ['engines']],
[this.$t('Periodic'), ['is_periodic', 'interval', 'crontab']], [this.$t('Periodic'), ['is_periodic', 'interval', 'crontab']],
[this.$t('Other'), ['is_active', 'comment']] [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: { nodes: {
el: { el: {
multiple: true, multiple: true,
@@ -82,20 +100,10 @@ export default {
}, },
is_periodic, is_periodic,
crontab, crontab,
interval, interval
params: {
component: AutomationParams,
label: this.$t('PushParams'),
el: {
method: 'push_account_method',
assets: this.assetIds,
nodes: this.nodeIds
}, },
helpText: this.$t('ParamsHelpText') createSuccessNextRoute: { name: 'AccountCheckList' },
} updateSuccessNextRoute: { name: 'AccountCheckList' },
},
createSuccessNextRoute: { name: 'AccountPushList' },
updateSuccessNextRoute: { name: 'AccountPushList' },
afterGetRemoteMeta: this.handleAfterGetRemoteMeta, afterGetRemoteMeta: this.handleAfterGetRemoteMeta,
cleanFormValue(data) { cleanFormValue(data) {
const secretType = data.secret_type || '' const secretType = data.secret_type || ''

View File

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

View File

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

View File

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