fix(frontend): show credential expiry status

This commit is contained in:
2026-05-05 19:35:04 +08:00
parent 745ffb1353
commit 06d2e6d2f9
6 changed files with 22 additions and 2 deletions
+9
View File
@@ -0,0 +1,9 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { statusLabel, statusTone } from './format.ts'
test('formats token_expired status for check-in records', () => {
assert.equal(statusLabel('token_expired'), '凭证过期')
assert.equal(statusTone('token_expired'), 'danger')
assert.equal(statusLabel('token-expired'), 'token-expired')
})
+9 -1
View File
@@ -35,6 +35,7 @@ export function statusLabel(status?: string | null) {
running: '进行中',
already_submitted: '已提交',
out_of_time: '超出时间',
token_expired: '凭证过期',
unknown: '未知',
manual: '手动',
scheduler: '定时',
@@ -47,7 +48,14 @@ export function statusLabel(status?: string | null) {
export function statusTone(status?: string | null) {
if (status === 'success' || status === 'already_submitted') return 'success'
if (status === 'pending' || status === 'running') return 'warning'
if (status === 'failure' || status === 'failed' || status === 'out_of_time') return 'danger'
if (
status === 'failure' ||
status === 'failed' ||
status === 'out_of_time' ||
status === 'token_expired'
) {
return 'danger'
}
return 'neutral'
}