This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user