Distinguish retired and stale trace relations

Why: Retired edges and compliance edges awaiting review both fell back to a generic lifecycle label.

Evidence: Presentation tests, production build, knip, and diff checks pass.

Impact: The trace network now shows 已停用 and 待复核 as distinct human-readable states.

Refs: readable trace network
This commit is contained in:
2026-10-15 06:52:42 +00:00
parent 987be7442f
commit 95e1948a5f
3 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -520,7 +520,7 @@ function RelationRow({ r, selected }: { r: RelationEntry; selected: { kind: stri
<Chip tone={r.layer === 'compliance' ? 'info' : 'plain'}>{readable.layer}</Chip> <Chip tone={r.layer === 'compliance' ? 'info' : 'plain'}>{readable.layer}</Chip>
<span className="rdm-audit-rel-type">{readable.type}</span> <span className="rdm-audit-rel-type">{readable.type}</span>
<span className="rdm-audit-rel-endpoint">{humanizeKind(other?.kind)}“{other?.title || other?.id || '未知对象'}”{other?.ver ? `(版本 ${other.ver})` : ''}</span> <span className="rdm-audit-rel-endpoint">{humanizeKind(other?.kind)}“{other?.title || other?.id || '未知对象'}”{other?.ver ? `(版本 ${other.ver})` : ''}</span>
<Chip tone={r.state === 'active' ? 'ok' : r.state === 'candidate' ? 'warn' : 'plain'}>{readable.state}</Chip> <Chip tone={r.state === 'active' ? 'ok' : r.state === 'candidate' || r.state === 'stale' ? 'warn' : 'plain'}>{readable.state}</Chip>
</div> </div>
) )
} }
+2
View File
@@ -80,6 +80,8 @@ describe('RDM audit presentation', () => {
it('humanizes tree, relationship, and lifecycle vocabulary', () => { it('humanizes tree, relationship, and lifecycle vocabulary', () => {
expect(humanizeKind('section')).toBe('章节') expect(humanizeKind('section')).toBe('章节')
expect(humanizeState('candidate')).toBe('待确认') expect(humanizeState('candidate')).toBe('待确认')
expect(humanizeState('retired')).toBe('已停用')
expect(humanizeState('stale')).toBe('待复核')
expect(humanizeRelation({ layer: 'compliance', type: 'verifies', state: 'active' })).toEqual({ expect(humanizeRelation({ layer: 'compliance', type: 'verifies', state: 'active' })).toEqual({
layer: '合规关系', layer: '合规关系',
type: '验证', type: '验证',
+1
View File
@@ -34,6 +34,7 @@ const KIND_LABELS: Record<string, string> = {
const STATE_LABELS: Record<string, string> = { const STATE_LABELS: Record<string, string> = {
active: '已生效', candidate: '待确认', pending: '待处理', baselined: '已建立基线', active: '已生效', candidate: '待确认', pending: '待处理', baselined: '已建立基线',
retired: '已停用', stale: '待复核',
approved: '已批准', rejected: '已拒绝', revoked: '已撤销', superseded: '已被取代', approved: '已批准', rejected: '已拒绝', revoked: '已撤销', superseded: '已被取代',
failed: '失败', committed: '已生效', accepted: '已接受', cancelled: '已取消', failed: '失败', committed: '已生效', accepted: '已接受', cancelled: '已取消',
delivered: '已记录', delivered: '已记录',