diff --git a/src/web/pages/settings/UpdateCenterSection.test.tsx b/src/web/pages/settings/UpdateCenterSection.test.tsx index 4d27725e..dd759d5f 100644 --- a/src/web/pages/settings/UpdateCenterSection.test.tsx +++ b/src/web/pages/settings/UpdateCenterSection.test.tsx @@ -88,6 +88,12 @@ describe('UpdateCenterSection', () => { displayVersion: 'dev-20260417-f67ade2 @ sha256:bbbbbbbbbbbb', publishedAt: '2026-03-30T10:54:35.591877Z', }, + { + normalizedVersion: 'feature-without-raw-tag', + digest: 'sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + displayVersion: 'feature-without-raw-tag @ sha256:cccccccccccc', + publishedAt: '2026-03-30T09:54:35.591877Z', + }, ], helper: { ok: true, @@ -470,6 +476,8 @@ describe('UpdateCenterSection', () => { }); await flushMicrotasks(); + expect(collectText(root.root)).toContain('Digest:sha256:bbbbbbbbbbbb'); + expect(collectText(root.root)).not.toContain('feature-without-raw-tag'); expect(collectText(root.root)).toContain('dev-20260417-f67ade2 @ sha256:bbbbbbbbbbbb'); const deployRecentButton = root.root.find((node) => ( diff --git a/src/web/pages/settings/UpdateCenterSection.tsx b/src/web/pages/settings/UpdateCenterSection.tsx index 6daec708..3d896e3b 100644 --- a/src/web/pages/settings/UpdateCenterSection.tsx +++ b/src/web/pages/settings/UpdateCenterSection.tsx @@ -221,9 +221,15 @@ function formatImageTarget(tag?: string | null, digest?: string | null) { return ''; } -function normalizeRecentDockerCandidates(input?: UpdateCenterStatus['dockerHubRecentTags'] | null) { +type RecentDockerCandidate = NonNullable[number]>; + +function normalizeRecentDockerCandidates( + input?: UpdateCenterStatus['dockerHubRecentTags'] | null, +): Array { if (!Array.isArray(input)) return []; - return input.filter((entry) => String(entry?.tagName || entry?.normalizedVersion || '').trim()); + return input.filter( + (entry): entry is RecentDockerCandidate & { tagName: string } => !!String(entry?.tagName || '').trim(), + ); } export default function UpdateCenterSection() { @@ -796,7 +802,7 @@ export default function UpdateCenterSection() { {recentDockerCandidates.length ? (
{recentDockerCandidates.map((candidate) => { - const candidateTag = String(candidate.tagName || candidate.normalizedVersion || '').trim(); + const candidateTag = String(candidate.tagName || '').trim(); const candidateDigest = String(candidate.digest || '').trim(); const candidateLabel = candidate.displayVersion || candidate.normalizedVersion || candidateTag; const candidateDeployState = describeDockerDeployState({ @@ -825,6 +831,11 @@ export default function UpdateCenterSection() {
最近推送:{formatTaskTime(candidate.publishedAt)}
+ {candidateDigest ? ( +
+ Digest:{formatShortDigest(candidateDigest)} +
+ ) : null}