perf: add account status action

This commit is contained in:
ibuler 2024-10-28 18:57:03 +08:00
parent b1acb62889
commit c0b4029917
6 changed files with 99 additions and 12 deletions

View File

@ -194,19 +194,19 @@ export default {
{
label: '僵尸账号',
filter: {
is_zombie: 'true'
risk: 'zombie'
}
},
{
label: '幽灵账号',
filter: {
is_ghost: 'true'
risk: 'ghost'
}
},
{
label: '弱密码',
filter: {
is_weak_password: 'true'
risk: 'week_password'
}
},
{
@ -217,11 +217,15 @@ export default {
},
{
label: '长时间未改密',
value: 'true'
filter: {
long_time_no_change_secret: 'true'
}
},
{
label: '长时间未验证',
value: 'true'
filter: {
long_time_no_verify: 'true'
}
}
]
},

View File

@ -0,0 +1,67 @@
<template>
<span class="conform-td">
<span v-if="!iValue" class="confirm-action">
<el-tooltip :content="$tc('Confirm')" :open-delay="400">
<el-button class="confirm action" icon="el-icon-check" size="mini" type="primary" />
</el-tooltip>
<el-tooltip :content="$tc('Ignore')" :open-delay="400">
<el-button class="ignore action" icon="el-icon-close-notification" size="mini" />
</el-tooltip>
</span>
<span v-else class="platform-status">{{ iLabel }}</span>
</span>
</template>
<script>
import BaseFormatter from './base.vue'
export default {
name: 'ConfirmOrIgnoreFormatter',
extends: BaseFormatter,
props: {
formatterArgsDefault: {
type: Object,
default() {
return {}
}
}
},
data() {
return {
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs)
}
},
computed: {
iValue() {
if (this.cellValueIsLabelChoice()) {
return this.cellValue.value
} else {
return this.cellValue
}
},
iLabel() {
if (this.cellValueIsLabelChoice()) {
return this.cellValue.label
} else {
return this.cellValue
}
}
}
}
</script>
<style scoped>
.action.el-button--mini {
cursor: pointer;
padding: 1px 4px;
&.confirm {
}
}
.action.ignore {
margin-left: 2px;
}
</style>

View File

@ -47,6 +47,11 @@ export default {
return {
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs)
}
},
methods: {
cellValueIsLabelChoice() {
return typeof this.cellValue === 'object' && this.cellValue['value'] !== undefined
}
}
}
</script>

View File

@ -19,6 +19,7 @@ import TagChoicesFormatter from './TagChoicesFormatter.vue'
import SwitchFormatter from './SwitchFormatter.vue'
import AccountInfoFormatter from './AccountInfoFormatter.vue'
import PlatformFormatter from './PlatformFormatter.vue'
import ConfirmFormatter from './ConfirmOrIgnore.vue'
export default {
DetailFormatter,
@ -41,7 +42,8 @@ export default {
LabelsFormatter,
SwitchFormatter,
PlatformFormatter,
AccountInfoFormatter
AccountInfoFormatter,
ConfirmFormatter
}
export {
@ -65,5 +67,6 @@ export {
LabelsFormatter,
SwitchFormatter,
PlatformFormatter,
ConfirmFormatter,
AccountInfoFormatter
}

View File

@ -19,7 +19,7 @@
<script>
import AssetTreeTable from '@/components/Apps/AssetTreeTable/index.vue'
import { toSafeLocalDateStr } from '@/utils/time'
import { ActionsFormatter } from '@/components/Table/TableFormatters'
import { ActionsFormatter, ConfirmFormatter } from '@/components/Table/TableFormatters'
import RemoveAccount from '@/components/Apps/AccountListTable/RemoveAccount.vue'
export default {
@ -111,13 +111,13 @@ export default {
url: '/api/v1/accounts/gathered-accounts/',
hasTree: true,
columns: [
'asset', 'username', 'date_last_login', 'present',
'address_last_login', 'date_updated'
'asset', 'username', 'date_last_login',
'address_last_login', 'present', 'date_updated', 'status'
],
columnsShow: {
default: [
'asset', 'username', 'date_last_login', 'present',
'address_last_login'
'asset', 'username', 'address_last_login',
'date_last_login', 'present', 'status'
]
},
columnsMeta: {
@ -145,6 +145,9 @@ export default {
return toSafeLocalDateStr(row.date_updated)
}
},
status: {
formatter: ConfirmFormatter
},
actions: {
formatter: ActionsFormatter,
formatterArgs: {

View File

@ -236,7 +236,12 @@ export default {
},
{
name: 'AddAccount',
title: '添加账号'
title: '添加账号',
divided: true
},
{
name: 'DiscoverAccounts',
title: 'Discover accounts'
},
...this.addExtraMoreColActions
]