fix(admin-web): map missing publish statuses and normalize lookup

Publish records with statuses like queued, pending, running, cancelled,
or unknown fell through the display map and rendered as raw enum values.

- Add queued/pending/running/cancelled/canceled/unknown entries to the
  publish status map with matching zh-CN and en-US translations
- Normalize status keys (trim + lowercase) before lookup so backend
  casing variants still resolve

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-08 19:30:39 +08:00
parent 4dece0f26a
commit fbc69c01b0
3 changed files with 17 additions and 1 deletions
@@ -798,7 +798,10 @@ const enUS = {
},
publish: {
unpublished: 'Unpublished',
queued: 'Waiting to publish',
pending: 'Waiting to publish',
publishing: 'Publishing',
running: 'Publishing',
success: 'Published',
failed: 'Failed',
partial_success: 'Partially Published',
@@ -806,7 +809,9 @@ const enUS = {
publish_success: 'Published',
publish_failed: 'Failed',
pending_review: 'Pending Review',
cancelled: 'Cancelled',
blocked_by_compliance: 'Blocked by compliance',
unknown: 'Unknown result',
},
sourceType: {
template: 'Template generation',
@@ -774,7 +774,10 @@ const zhCN = {
},
publish: {
unpublished: '未发布',
queued: '等待发布',
pending: '等待发布',
publishing: '发布中',
running: '发布中',
success: '发布成功',
failed: '发布失败',
partial_success: '部分发布',
@@ -782,7 +785,9 @@ const zhCN = {
publish_success: '发布成功',
publish_failed: '发布失败',
pending_review: '待审核',
cancelled: '已取消',
blocked_by_compliance: '合规阻断',
unknown: '结果异常',
},
sourceType: {
template: '模版单次生成',
+7 -1
View File
@@ -15,7 +15,10 @@ const generateStatusMap: Record<string, { label: string; color: string }> = {
const publishStatusMap: Record<string, { label: string; color: string }> = {
unpublished: { label: 'status.publish.unpublished', color: 'default' },
queued: { label: 'status.publish.queued', color: 'processing' },
pending: { label: 'status.publish.pending', color: 'processing' },
publishing: { label: 'status.publish.publishing', color: 'processing' },
running: { label: 'status.publish.running', color: 'processing' },
success: { label: 'status.publish.success', color: 'success' },
failed: { label: 'status.publish.failed', color: 'error' },
partial_success: { label: 'status.publish.partial_success', color: 'warning' },
@@ -23,7 +26,10 @@ const publishStatusMap: Record<string, { label: string; color: string }> = {
publish_success: { label: 'status.publish.publish_success', color: 'success' },
publish_failed: { label: 'status.publish.publish_failed', color: 'error' },
pending_review: { label: 'status.publish.pending_review', color: 'warning' },
cancelled: { label: 'status.publish.cancelled', color: 'default' },
canceled: { label: 'status.publish.cancelled', color: 'default' },
blocked_by_compliance: { label: 'status.publish.blocked_by_compliance', color: 'error' },
unknown: { label: 'status.publish.unknown', color: 'error' },
}
const goTimestampWithZonePattern =
@@ -87,7 +93,7 @@ export function getPublishStatusMeta(status?: string | null): { label: string; c
if (!status) {
return { label: '--', color: 'default' }
}
const meta = publishStatusMap[status]
const meta = publishStatusMap[status.trim().toLowerCase()]
return meta
? { label: i18n.global.t(meta.label), color: meta.color }
: { label: status, color: 'default' }