Clarify upstream key usage status
This commit is contained in:
@@ -402,12 +402,12 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态" width="96">
|
<el-table-column label="状态" width="96">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tooltip v-if="row.error || (row.status === 'orphaned' && row.imported_account_id)" :content="orphanedKeyTooltip(row)" placement="top" :show-after="300">
|
<el-tooltip v-if="hasKeyTooltip(row)" :content="keyRowTooltip(row)" placement="top" :show-after="300">
|
||||||
<el-tag size="small" :type="keyStatusTagType(row.status)">
|
<el-tag size="small" :type="keyStatusTagType(row)">
|
||||||
{{ keyStatusLabel(row) }}
|
{{ keyStatusLabel(row) }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tag v-else size="small" :type="keyStatusTagType(row.status)">
|
<el-tag v-else size="small" :type="keyStatusTagType(row)">
|
||||||
{{ keyStatusLabel(row) }}
|
{{ keyStatusLabel(row) }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
@@ -518,10 +518,10 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态" width="120">
|
<el-table-column label="状态" width="120">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tooltip v-if="row.error" :content="row.error" placement="top" :show-after="300">
|
<el-tooltip v-if="hasKeyTooltip(row)" :content="keyRowTooltip(row)" placement="top" :show-after="300">
|
||||||
<el-tag size="small" :type="keyStatusTagType(row.status)">{{ keyStatusLabel(row) }}</el-tag>
|
<el-tag size="small" :type="keyStatusTagType(row)">{{ keyStatusLabel(row) }}</el-tag>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tag v-else size="small" :type="keyStatusTagType(row.status)">{{ keyStatusLabel(row) }}</el-tag>
|
<el-tag v-else size="small" :type="keyStatusTagType(row)">{{ keyStatusLabel(row) }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -1058,15 +1058,20 @@ function shrinkError(value: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const keyStatusLabel = (row: GeneratedUpstreamKey) => {
|
const keyStatusLabel = (row: GeneratedUpstreamKey) => {
|
||||||
|
// orphaned 先区分是否仍有关联账号;无关联显示未被使用,有关联再按归档原因细分
|
||||||
if (row.status === 'orphaned') {
|
if (row.status === 'orphaned') {
|
||||||
|
if (!row.imported_account_id) return '未被使用'
|
||||||
if (row.error?.startsWith('重复旧 Key')) return '重复旧 Key'
|
if (row.error?.startsWith('重复旧 Key')) return '重复旧 Key'
|
||||||
if (row.error === '远端 Key 已不存在') return '远端缺失'
|
if (row.error === '远端 Key 已不存在') return '远端缺失'
|
||||||
if (row.error === '来源分组已不存在') return '来源分组缺失'
|
if (row.error === '来源分组已不存在') return '来源分组缺失'
|
||||||
return '已归档'
|
return '已归档'
|
||||||
}
|
}
|
||||||
|
// 有关联下游账号 → 已导入(优先于上游 Key 的原始状态)
|
||||||
|
if (row.imported_account_id) return '已导入'
|
||||||
|
// 无下游关联 → 按上游 Key 状态显示
|
||||||
return ({
|
return ({
|
||||||
created: '已创建',
|
created: '已创建',
|
||||||
exists: '已存在',
|
exists: '上游已存在',
|
||||||
imported: '已导入',
|
imported: '已导入',
|
||||||
remote: '远端存在',
|
remote: '远端存在',
|
||||||
replaced: '已替换',
|
replaced: '已替换',
|
||||||
@@ -1076,23 +1081,36 @@ const keyStatusLabel = (row: GeneratedUpstreamKey) => {
|
|||||||
}[row.status] || '未知状态')
|
}[row.status] || '未知状态')
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyStatusTagType = (s: string) => {
|
const keyStatusTagType = (row: GeneratedUpstreamKey) => {
|
||||||
|
const s = row.status
|
||||||
|
// orphaned 按是否有下游关联区分颜色
|
||||||
|
if (s === 'orphaned') return row.imported_account_id ? 'warning' : 'info'
|
||||||
|
// 有关联下游账号 → success
|
||||||
|
if (row.imported_account_id) return 'success'
|
||||||
|
// 按上游 Key 状态
|
||||||
if (s === 'created' || s === 'imported') return 'success'
|
if (s === 'created' || s === 'imported') return 'success'
|
||||||
if (s === 'exists' || s === 'remote') return 'info'
|
if (s === 'exists' || s === 'remote') return 'info'
|
||||||
if (s === 'orphaned' || s === 'replaced' || s === 'created_pending_key') return 'warning'
|
if (s === 'replaced' || s === 'created_pending_key') return 'warning'
|
||||||
if (s === 'failed' || s === 'import_failed') return 'danger'
|
if (s === 'failed' || s === 'import_failed') return 'danger'
|
||||||
return 'info'
|
return 'info'
|
||||||
}
|
}
|
||||||
|
|
||||||
const orphanedKeyTooltip = (row: GeneratedUpstreamKey) => {
|
const keyRowTooltip = (row: GeneratedUpstreamKey) => {
|
||||||
const parts: string[] = []
|
const parts: string[] = []
|
||||||
if (row.error) parts.push(row.error)
|
if (row.error) parts.push(row.error)
|
||||||
|
if (row.imported_account_id) {
|
||||||
|
parts.push(`已关联下游账号 ID: ${row.imported_account_id}`)
|
||||||
|
}
|
||||||
if (row.status === 'orphaned' && row.imported_account_id) {
|
if (row.status === 'orphaned' && row.imported_account_id) {
|
||||||
parts.push('可到目标站「清理异常账号」中处理')
|
parts.push('可到目标站「清理异常账号」中处理')
|
||||||
}
|
}
|
||||||
return parts.join('\n')
|
return parts.join('\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hasKeyTooltip = (row: GeneratedUpstreamKey) => {
|
||||||
|
return !!(row.error || row.imported_account_id)
|
||||||
|
}
|
||||||
|
|
||||||
async function loadList() {
|
async function loadList() {
|
||||||
tableLoading.value = true
|
tableLoading.value = true
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user