Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/web/pages/settings/UpdateCenterSection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) => (
Expand Down
17 changes: 14 additions & 3 deletions src/web/pages/settings/UpdateCenterSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,15 @@ function formatImageTarget(tag?: string | null, digest?: string | null) {
return '';
}

function normalizeRecentDockerCandidates(input?: UpdateCenterStatus['dockerHubRecentTags'] | null) {
type RecentDockerCandidate = NonNullable<NonNullable<UpdateCenterStatus['dockerHubRecentTags']>[number]>;

function normalizeRecentDockerCandidates(
input?: UpdateCenterStatus['dockerHubRecentTags'] | null,
): Array<RecentDockerCandidate & { tagName: string }> {
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() {
Expand Down Expand Up @@ -796,7 +802,7 @@ export default function UpdateCenterSection() {
{recentDockerCandidates.length ? (
<div style={{ display: 'grid', gap: 8 }}>
{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({
Expand Down Expand Up @@ -825,6 +831,11 @@ export default function UpdateCenterSection() {
<div style={fieldHintStyle}>
最近推送:{formatTaskTime(candidate.publishedAt)}
</div>
{candidateDigest ? (
<div style={{ ...fieldHintStyle, fontFamily: 'var(--font-mono)' }} title={candidateDigest}>
Digest:{formatShortDigest(candidateDigest)}
</div>
) : null}
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
<button
type="button"
Expand Down
Loading