This commit is contained in:
@@ -274,6 +274,22 @@ export default function UpdatePage({
|
||||
const [reloadReady, setReloadReady] = useState(false);
|
||||
const [showNotesDialog, setShowNotesDialog] = useState(false);
|
||||
const [showPipelineDialog, setShowPipelineDialog] = useState(false);
|
||||
const [cancelling, setCancelling] = useState(false);
|
||||
|
||||
const cancelJob = async () => {
|
||||
if (cancelling) return;
|
||||
setCancelling(true);
|
||||
try {
|
||||
await api("/api/update/cancel", { method: "POST", body: JSON.stringify({ jobId: job?.id }) });
|
||||
notify?.("已取消更新任务", "success");
|
||||
setShowPipelineDialog(false);
|
||||
await load();
|
||||
} catch (e) {
|
||||
notify?.((e as Error).message, "error");
|
||||
} finally {
|
||||
setCancelling(false);
|
||||
}
|
||||
};
|
||||
const [now, setNow] = useState(() => Date.now());
|
||||
|
||||
const announced = useRef<string | null>(null);
|
||||
@@ -588,6 +604,17 @@ export default function UpdatePage({
|
||||
subtitle="管理系统版本升级、更新包完整性校验与安全热重启"
|
||||
actions={
|
||||
<div className="tn-update-page-actions">
|
||||
{job?.status === "queued" && (
|
||||
<Button
|
||||
theme="default"
|
||||
variant="outline"
|
||||
onClick={() => void cancelJob()}
|
||||
loading={cancelling}
|
||||
disabled={cancelling}
|
||||
>
|
||||
取消等待
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
theme="default"
|
||||
variant="outline"
|
||||
@@ -732,6 +759,8 @@ export default function UpdatePage({
|
||||
<Dialog
|
||||
visible={showPipelineDialog}
|
||||
header="版本升级流水线"
|
||||
className="tn-dialog-large"
|
||||
width="820px"
|
||||
confirmBtn={{ content: "关闭", theme: "default" }}
|
||||
cancelBtn={null}
|
||||
onConfirm={() => setShowPipelineDialog(false)}
|
||||
@@ -805,6 +834,26 @@ export default function UpdatePage({
|
||||
|
||||
{/* Status-specific descriptions */}
|
||||
<div className="tn-job-runtime-desc">
|
||||
{job.status === "queued" && (
|
||||
<div className="tn-queued-runtime-notice">
|
||||
<div className="tn-queued-header">
|
||||
<span>正在等待后台系统更新守护进程认领任务…</span>
|
||||
<Button
|
||||
theme="default"
|
||||
variant="outline"
|
||||
size="small"
|
||||
onClick={() => void cancelJob()}
|
||||
loading={cancelling}
|
||||
disabled={cancelling}
|
||||
>
|
||||
取消排队
|
||||
</Button>
|
||||
</div>
|
||||
<small className="text-secondary">
|
||||
若系统超过 20 秒仍未响应,通常是后台守护服务尚未就绪,您可以点击取消排队。
|
||||
</small>
|
||||
</div>
|
||||
)}
|
||||
{job.status === "downloading" && (
|
||||
<span>正在从官方渠道下载更新安装包,后台安全传输中,不影响当前系统的正常使用。</span>
|
||||
)}
|
||||
@@ -1001,6 +1050,8 @@ export default function UpdatePage({
|
||||
{/* Confirmation Dialog */}
|
||||
<Dialog
|
||||
visible={Boolean(confirmVersion)}
|
||||
className="tn-dialog-medium"
|
||||
width="600px"
|
||||
header={confirmAction === "download" ? "确认下载更新包" : "确认立即应用更新并重启服务"}
|
||||
confirmBtn={{
|
||||
content: confirmAction === "download" ? "确认下载" : "立即更新",
|
||||
@@ -1045,6 +1096,8 @@ export default function UpdatePage({
|
||||
{/* Full Release Notes Dialog */}
|
||||
<Dialog
|
||||
visible={showNotesDialog}
|
||||
className="tn-dialog-large"
|
||||
width="820px"
|
||||
header={`${latest?.releaseName || latest?.tagName || `v${latest?.version}`} 更新日志`}
|
||||
cancelBtn={null}
|
||||
confirmBtn={{ content: "关闭", theme: "default" }}
|
||||
|
||||
Reference in New Issue
Block a user