mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-29 21:28:52 +00:00
perf: update account risk list
This commit is contained in:
@@ -34,6 +34,7 @@ export default {
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasLeftActions: false,
|
||||
hasRefresh: true,
|
||||
hasExport: false,
|
||||
hasImport: false
|
||||
|
||||
65
src/views/pam/AccountCheck/AccountRiskSummary.vue
Normal file
65
src/views/pam/AccountCheck/AccountRiskSummary.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<GenericListTable ref="listTable" :header-actions="headerActions" :table-config="tableConfig" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DetailFormatter } from '@/components/Table/TableFormatters'
|
||||
import { GenericListTable } from '@/layout/components'
|
||||
import RiskSummaryFormatter from './RiskSummaryFormatter.vue'
|
||||
|
||||
export default {
|
||||
name: 'AccountPushList',
|
||||
components: {
|
||||
GenericListTable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableConfig: {
|
||||
url: '/api/v1/accounts/account-risks/assets/',
|
||||
columns: [
|
||||
'name', 'address', 'platform', 'risk_total', 'risk_summary'
|
||||
],
|
||||
columnsShow: {
|
||||
min: ['name', 'actions'],
|
||||
default: [
|
||||
'name', 'address', 'platform', 'risk_total',
|
||||
'risk_summary', 'actions'
|
||||
]
|
||||
},
|
||||
columnsMeta: {
|
||||
name: {
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
route: 'AccountPushDetail'
|
||||
}
|
||||
},
|
||||
risk_summary: {
|
||||
formatter: RiskSummaryFormatter
|
||||
},
|
||||
risk_total: {
|
||||
width: '80px'
|
||||
},
|
||||
platform: {
|
||||
width: '80px'
|
||||
},
|
||||
address: {
|
||||
width: '160px'
|
||||
},
|
||||
actions: {
|
||||
formatterArgs: {
|
||||
hasUpdate: false,
|
||||
hasDelete: false,
|
||||
hasClone: false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasRefresh: true,
|
||||
hasExport: false,
|
||||
hasImport: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
76
src/views/pam/AccountCheck/RiskSummaryFormatter.vue
Normal file
76
src/views/pam/AccountCheck/RiskSummaryFormatter.vue
Normal file
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<span class="risk">
|
||||
<span v-for="[k, v] of Object.entries(cellValue) " :key="k">
|
||||
<span v-if="v !== 0" size="mini" type="getRiskType(k)">
|
||||
{{ getRiskLabel(k) }}: {{ v }};
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
<script>
|
||||
import BaseFormatter from '@/components/Table/TableFormatters/base.vue'
|
||||
|
||||
export default {
|
||||
name: 'RiskSummaryFormatter',
|
||||
extends: BaseFormatter,
|
||||
props: {
|
||||
formatterArgsDefault: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs),
|
||||
riskLabel: {
|
||||
zombie: '长时间未使用',
|
||||
ghost: '未托管',
|
||||
long_time_password: '长时间未修改密码',
|
||||
weak_password: '弱密码',
|
||||
password_error: '密码错误',
|
||||
password_expired: '密码过期',
|
||||
group_changed: '组变更',
|
||||
sudo_changed: 'sudo提权',
|
||||
account_deleted: '账号删除',
|
||||
no_admin_account: '无管理账号',
|
||||
no_user_account: '无用户账号',
|
||||
other: '其它'
|
||||
},
|
||||
riskType: {
|
||||
zombie: 'warning',
|
||||
ghost: 'danger',
|
||||
long_time_password: 'warning',
|
||||
weak_password: 'warning',
|
||||
password_error: 'danger',
|
||||
password_expired: 'danger',
|
||||
group_changed: 'warning',
|
||||
sudo_changed: 'warning',
|
||||
account_deleted: 'danger',
|
||||
no_admin_account: 'danger',
|
||||
no_user_account: 'danger',
|
||||
other: 'warning'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getRiskLabel(key) {
|
||||
return this.riskLabel[key.replace('_count', '')] || key
|
||||
},
|
||||
getRiskType(key) {
|
||||
return this.riskType[key.replace('_count', '')] || 'info'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.risk {
|
||||
font-size: 12px;
|
||||
color: #1c84c6;
|
||||
|
||||
.el-tag {
|
||||
margin-right: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -17,9 +17,9 @@ export default {
|
||||
submenu: [
|
||||
{
|
||||
title: this.$t('检查结果'),
|
||||
name: 'AccountPushList',
|
||||
hidden: !this.$hasPerm('accounts.view_pushaccountautomation'),
|
||||
component: () => import('@/views/accounts/AccountPush/AccountPushList.vue')
|
||||
name: 'AccountRisks',
|
||||
hidden: !this.$hasPerm('accounts.view_accountrisk'),
|
||||
component: () => import('@/views/pam/AccountCheck/AccountRiskSummary.vue')
|
||||
},
|
||||
{
|
||||
title: this.$t('检查任务'),
|
||||
|
||||
Reference in New Issue
Block a user