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: '僵尸账号', label: '僵尸账号',
filter: { filter: {
is_zombie: 'true' risk: 'zombie'
} }
}, },
{ {
label: '幽灵账号', label: '幽灵账号',
filter: { filter: {
is_ghost: 'true' risk: 'ghost'
} }
}, },
{ {
label: '弱密码', label: '弱密码',
filter: { filter: {
is_weak_password: 'true' risk: 'week_password'
} }
}, },
{ {
@@ -217,11 +217,15 @@ export default {
}, },
{ {
label: '长时间未改密', label: '长时间未改密',
value: 'true' filter: {
long_time_no_change_secret: 'true'
}
}, },
{ {
label: '长时间未验证', 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 { return {
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs) formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs)
} }
},
methods: {
cellValueIsLabelChoice() {
return typeof this.cellValue === 'object' && this.cellValue['value'] !== undefined
}
} }
} }
</script> </script>

View File

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

View File

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

View File

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