perf: risk detail

This commit is contained in:
feng 2025-02-28 11:37:23 +08:00 committed by feng626
parent fa93f52f87
commit 485f45a2ea
4 changed files with 80 additions and 103 deletions

View File

@ -119,6 +119,16 @@ export default [
title: i18n.t('AccountCheckUpdate'),
permissions: ['accounts.view_accountrisk']
}
},
{
path: ':id',
component: () => import('@/views/pam/RiskDetect/AccountCheckDetail/index.vue'),
name: 'AccountCheckDetail',
meta: {
title: i18n.t('RiskDetectionDetail'),
permissions: ['accounts.view_accountrisk']
},
hidden: true
}
]
}

View File

@ -1,97 +0,0 @@
<template>
<TwoCol>
<template>
<AutoDetailCard :fields="detailFields" :object="object" :url="url" />
</template>
<template #right>
<QuickActions :actions="quickActions" type="primary" />
</template>
</TwoCol>
</template>
<script>
import { QuickActions } from '@/components'
import AutoDetailCard from '@/components/Cards/DetailCard/auto'
import { openTaskPage } from '@/utils/jms'
import TwoCol from '@/layout/components/Page/TwoColPage.vue'
export default {
name: 'AccountPushInfo',
components: {
TwoCol,
AutoDetailCard,
QuickActions
},
props: {
object: {
type: Object,
required: true,
default: () => ({})
}
},
data() {
return {
quickActions: [
{
title: this.$t('ManualExecution'),
attrs: {
type: 'primary',
label: this.$t('Execute'),
disabled: !this.$hasPerm('accounts.add_changesecretexecution') || !this.object.is_active
},
callbacks: {
click: function() {
this.$axios.post(
`/api/v1/accounts/push-account-executions/`,
{ automation: this.object.id }
).then(res => {
openTaskPage(res['task'])
})
}.bind(this)
}
}
],
url: `/api/v1/accounts/push-account-automations/${this.object.id}`,
detailFields: [
'id', 'name',
{
key: this.$t('Accounts'),
value: this.object.accounts.join(', ')
},
{
key: this.$t('AssetsOfNumber'),
value: this.object.assets.length
},
{
key: this.$t('NodeOfNumber'),
value: this.object.nodes.length
},
{
key: this.$t('PasswordStrategy'),
value: this.object.secret_strategy.label
},
{
key: this.$t('Crontab'),
value: this.object.crontab,
formatter: (item, val) => {
return <span>{this.object.is_periodic ? val : '-'}</span>
}
},
{
key: this.$t('Interval'),
value: this.object.interval,
formatter: (item, val) => {
return <span>{this.object.is_periodic ? val : '-'}</span>
}
},
'date_created', 'date_updated', 'comment', 'is_active'
]
}
},
computed: {}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,65 @@
<template>
<TwoCol>
<template>
<AutoDetailCard :fields="detailFields" :object="object" :url="url" />
</template>
<template #right>
<QuickActions :actions="quickActions" type="primary" />
</template>
</TwoCol>
</template>
<script>
import { QuickActions } from '@/components'
import AutoDetailCard from '@/components/Cards/DetailCard/auto'
import { openTaskPage } from '@/utils/jms'
import TwoCol from '@/layout/components/Page/TwoColPage.vue'
export default {
name: 'AccountCheckDetail',
components: {
TwoCol,
AutoDetailCard,
QuickActions
},
props: {
object: {
type: Object,
required: true,
default: () => ({})
}
},
data() {
return {
quickActions: [
{
title: this.$t('ManualExecution'),
attrs: {
type: 'primary',
label: this.$t('Execute'),
disabled: !this.$hasPerm('accounts.add_checkaccountautomation') || !this.object.is_active
},
callbacks: {
click: function() {
this.$axios.post(
`/api/v1/accounts/check-account-executions/`,
{ automation: this.object.id }
).then(res => {
openTaskPage(res['task'])
})
}.bind(this)
}
}
],
url: `/api/v1/accounts/check-account-automations/${this.object.id}`,
detailFields: [
'id', 'name', 'date_created', 'date_updated', 'comment'
]
}
}
}
</script>
<style scoped>
</style>

View File

@ -8,25 +8,24 @@
<script>
import { GenericDetailPage } from '@/layout/components'
import AccountPushInfo from './AccountPushInfo'
import AccountCheckDetail from './Detail.vue'
export default {
components: {
GenericDetailPage,
AccountPushInfo
AccountCheckDetail
},
data() {
return {
plan: { name: '', username: '', comment: '' },
config: {
titlePrefix: this.$t('AccountCheckDetail'),
activeMenu: 'AccountPushInfo',
url: '/api/v1/accounts/push-account-automations',
url: '/api/v1/accounts/check-account-automations',
submenu: [
{
title: this.$t('Basic'),
name: 'AccountPushInfo',
hidden: () => !this.$hasPerm('accounts.view_changesecretautomation')
name: 'AccountCheckDetail',
hidden: () => !this.$hasPerm('accounts.view_accountrisk')
}
]
}