fix: keep unknown workflow phases visible
This commit is contained in:
@@ -48,8 +48,6 @@ const TRUST_LABELS = {
|
||||
unknown: '未知',
|
||||
}
|
||||
|
||||
const PHASE_STATUSES = new Set(['blocked', 'complete', 'done', 'failed', 'pending', 'running', 'unknown'])
|
||||
|
||||
export function formatSourceKind(kind) {
|
||||
if (!kind) {
|
||||
return '来源未知'
|
||||
@@ -308,7 +306,18 @@ function quote(value) {
|
||||
}
|
||||
|
||||
function isDisplayPhase(phase) {
|
||||
return PHASE_STATUSES.has(phase?.status || 'unknown')
|
||||
const name = String(phase?.name ?? '').trim().toLowerCase()
|
||||
const status = String(phase?.status ?? '').trim().toLowerCase()
|
||||
if (!name) {
|
||||
return false
|
||||
}
|
||||
if (name === 'phase' || status === 'status') {
|
||||
return false
|
||||
}
|
||||
if (name === 'time' && status === 'phase') {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function normalizePhaseName(name) {
|
||||
|
||||
@@ -149,3 +149,18 @@ test('filters non-phase rows from workflow phase display', () => {
|
||||
assert.equal(workflow.phases[0].name, '阶段 5')
|
||||
assert.equal(workflow.phases[0].label, '待处理')
|
||||
})
|
||||
|
||||
test('keeps workflow phases with unknown backend status visible', () => {
|
||||
const workflow = normalizeWorkflow({
|
||||
items: [],
|
||||
handoffEdges: [],
|
||||
phases: [
|
||||
{ name: '5', status: 'in_progress', source: { kind: 'plan_file', confidence: 'medium' } },
|
||||
],
|
||||
source: { kind: 'plan_file', confidence: 'medium' },
|
||||
})
|
||||
|
||||
assert.equal(workflow.phases.length, 1)
|
||||
assert.equal(workflow.phases[0].name, '阶段 5')
|
||||
assert.equal(workflow.phases[0].label, '未知')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user