fix: show completed download progress
TallyNote release / linux-x64 (push) Successful in 7m0s

This commit is contained in:
Qiufeng
2026-09-03 15:02:44 +08:00
parent 755b82d2e5
commit 36c2ed1361
+3 -1
View File
@@ -116,7 +116,9 @@ export default function UpdatePage({ timezone = "Asia/Shanghai", notify }: { tim
const sameCompleted = Boolean(job?.status === "completed" && latest && job.version === latest.version); const sameCompleted = Boolean(job?.status === "completed" && latest && job.version === latest.version);
const canDownload = Boolean(info?.strategy === "systemd" && latest?.isNewer && latest.compatible && latest.integrityReady && !hasActiveJob && !sameCompleted && (!job || job.version !== latest.version || job.status === "failed" || job.status === "cancelled")); const canDownload = Boolean(info?.strategy === "systemd" && latest?.isNewer && latest.compatible && latest.integrityReady && !hasActiveJob && !sameCompleted && (!job || job.version !== latest.version || job.status === "failed" || job.status === "cancelled"));
const canApply = Boolean(info?.strategy === "systemd" && latest?.isNewer && latest.compatible && latest.integrityReady && job?.operation === "download" && job.status === "staged" && job.version === latest.version); const canApply = Boolean(info?.strategy === "systemd" && latest?.isNewer && latest.compatible && latest.integrityReady && job?.operation === "download" && job.status === "staged" && job.version === latest.version);
const progress = job?.status === "downloading" && job.sizeBytes && job.downloadedBytes !== null && job.downloadedBytes !== undefined const progress = job?.status === "staged" && job.operation === "download"
? 100
: job?.status === "downloading" && job.sizeBytes && job.downloadedBytes !== null && job.downloadedBytes !== undefined
? Math.min(99, Math.max(8, Math.round(job.downloadedBytes / job.sizeBytes * 100))) ? Math.min(99, Math.max(8, Math.round(job.downloadedBytes / job.sizeBytes * 100)))
: job ? ({ queued: 8, downloading: 28, verifying: 48, staged: 65, backing_up: 80, applying: 92 } as Partial<Record<JobStatus, number>>)[job.status] ?? 100 : 0; : job ? ({ queued: 8, downloading: 28, verifying: 48, staged: 65, backing_up: 80, applying: 92 } as Partial<Record<JobStatus, number>>)[job.status] ?? 100 : 0;
const notes = latest ? notesFor(latest) : null; const notes = latest ? notesFor(latest) : null;