Refine orphaned key status labels
This commit is contained in:
@@ -402,8 +402,13 @@
|
|||||||
</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" :content="row.error" placement="top" :show-after="300">
|
||||||
<el-tag size="small" :type="keyStatusTagType(row.status)">
|
<el-tag size="small" :type="keyStatusTagType(row.status)">
|
||||||
{{ keyStatusLabel(row.status) }}
|
{{ keyStatusLabel(row) }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tag v-else size="small" :type="keyStatusTagType(row.status)">
|
||||||
|
{{ keyStatusLabel(row) }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -513,7 +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-tag size="small" :type="keyStatusTagType(row.status)">{{ keyStatusLabel(row.status) }}</el-tag>
|
<el-tooltip v-if="row.error" :content="row.error" placement="top" :show-after="300">
|
||||||
|
<el-tag size="small" :type="keyStatusTagType(row.status)">{{ keyStatusLabel(row) }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tag v-else size="small" :type="keyStatusTagType(row.status)">{{ keyStatusLabel(row) }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -1049,17 +1057,24 @@ function shrinkError(value: string) {
|
|||||||
return value.length > 40 ? `${value.slice(0, 40)}…` : value
|
return value.length > 40 ? `${value.slice(0, 40)}…` : value
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyStatusLabel = (s: string) => ({
|
const keyStatusLabel = (row: GeneratedUpstreamKey) => {
|
||||||
|
if (row.status === 'orphaned') {
|
||||||
|
if (row.error?.startsWith('重复旧 Key')) return '重复旧 Key'
|
||||||
|
if (row.error === '远端 Key 已不存在') return '远端缺失'
|
||||||
|
if (row.error === '来源分组已不存在') return '来源分组缺失'
|
||||||
|
return '已归档'
|
||||||
|
}
|
||||||
|
return ({
|
||||||
created: '已创建',
|
created: '已创建',
|
||||||
exists: '已存在',
|
exists: '已存在',
|
||||||
imported: '已导入',
|
imported: '已导入',
|
||||||
orphaned: '远端缺失',
|
|
||||||
remote: '远端存在',
|
remote: '远端存在',
|
||||||
replaced: '已替换',
|
replaced: '已替换',
|
||||||
created_pending_key: '待回填',
|
created_pending_key: '待回填',
|
||||||
failed: '失败',
|
failed: '失败',
|
||||||
import_failed: '导入失败',
|
import_failed: '导入失败',
|
||||||
}[s] || '未知状态')
|
}[row.status] || '未知状态')
|
||||||
|
}
|
||||||
|
|
||||||
const keyStatusTagType = (s: string) => {
|
const keyStatusTagType = (s: string) => {
|
||||||
if (s === 'created' || s === 'imported') return 'success'
|
if (s === 'created' || s === 'imported') return 'success'
|
||||||
|
|||||||
@@ -1170,7 +1170,7 @@ const syncingImportStatus = ref(false)
|
|||||||
const reorderingPriorities = ref(false)
|
const reorderingPriorities = ref(false)
|
||||||
|
|
||||||
const statusLabel = (s: string) => ({ healthy: '健康', unhealthy: '异常', unknown: '未知' }[s] || s)
|
const statusLabel = (s: string) => ({ healthy: '健康', unhealthy: '异常', unknown: '未知' }[s] || s)
|
||||||
const keyStatusLabel = (s: string) => ({ created: '已创建', exists: '已存在', imported: '已导入', orphaned: '远端缺失', failed: '失败', import_failed: '导入失败', recreated: '清理后重建', missing_key: '缺少 Key' }[s] || '未知状态')
|
const keyStatusLabel = (s: string) => ({ created: '已创建', exists: '已存在', imported: '已导入', orphaned: '已归档', failed: '失败', import_failed: '导入失败', recreated: '清理后重建', missing_key: '缺少 Key' }[s] || '未知状态')
|
||||||
const algorithmLabel = (s: string) => ({ max_plus_percent: '最高倍率', average_plus_percent: '平均倍率', min_plus_percent: '最低倍率', priority_weighted_plus_percent: '自动保底盈利' }[s] || s)
|
const algorithmLabel = (s: string) => ({ max_plus_percent: '最高倍率', average_plus_percent: '平均倍率', min_plus_percent: '最低倍率', priority_weighted_plus_percent: '自动保底盈利' }[s] || s)
|
||||||
const toUTC = (t: string) => /[Z+\-]\d*$/.test(t.trim()) ? t : t + 'Z'
|
const toUTC = (t: string) => /[Z+\-]\d*$/.test(t.trim()) ? t : t + 'Z'
|
||||||
const fmtTime = (t: string) => dayjs(toUTC(t)).format('MM-DD HH:mm:ss')
|
const fmtTime = (t: string) => dayjs(toUTC(t)).format('MM-DD HH:mm:ss')
|
||||||
|
|||||||
Reference in New Issue
Block a user