fix: 修复更新下载请求缺少确认参数导致报错、增加弹窗内嵌显式错误条、统一全站通知弹窗右上角对齐
TallyNote release / linux-x64 (push) Successful in 7m23s
TallyNote release / linux-x64 (push) Successful in 7m23s
This commit is contained in:
@@ -245,6 +245,7 @@ export default function UpdatePage({
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [checking, setChecking] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const [modalError, setModalError] = useState("");
|
||||
const [pollError, setPollError] = useState("");
|
||||
const [actionBusy, setActionBusy] = useState(false);
|
||||
const [reloadReady, setReloadReady] = useState(false);
|
||||
@@ -457,16 +458,20 @@ export default function UpdatePage({
|
||||
if (!latest) return;
|
||||
setActionBusy(true);
|
||||
setError("");
|
||||
setModalError("");
|
||||
try {
|
||||
const response = await api<{ job: UpdateJob }>("/api/update/download", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ version: latest.version }),
|
||||
body: JSON.stringify({ version: latest.version, confirm: true }),
|
||||
});
|
||||
setLiveInfo((current) => (current ? { ...current, job: response.job } : current));
|
||||
setConfirmReadyToDownload(false);
|
||||
notify?.("已提交下载更新包请求,后台下载中", "info");
|
||||
} catch (e) {
|
||||
setError((e as Error).message);
|
||||
const msg = (e as Error).message;
|
||||
setError(msg);
|
||||
setModalError(msg);
|
||||
notify?.(msg, "error");
|
||||
} finally {
|
||||
setActionBusy(false);
|
||||
}
|
||||
@@ -477,15 +482,19 @@ export default function UpdatePage({
|
||||
if (!latest) return;
|
||||
setActionBusy(true);
|
||||
setError("");
|
||||
setModalError("");
|
||||
try {
|
||||
const response = await api<{ job: UpdateJob }>("/api/update/apply", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ version: latest.version, confirm: true }),
|
||||
body: JSON.stringify({ version: latest.version, confirm: true, ...(job?.id ? { jobId: job.id } : {}) }),
|
||||
});
|
||||
setLiveInfo((current) => (current ? { ...current, job: response.job } : current));
|
||||
notify?.("已提交升级请求,正在备份并平滑重启…", "info");
|
||||
} catch (e) {
|
||||
setError((e as Error).message);
|
||||
const msg = (e as Error).message;
|
||||
setError(msg);
|
||||
setModalError(msg);
|
||||
notify?.(msg, "error");
|
||||
} finally {
|
||||
setActionBusy(false);
|
||||
}
|
||||
@@ -751,7 +760,7 @@ export default function UpdatePage({
|
||||
size="large"
|
||||
onClick={() => {
|
||||
setConfirmReadyToDownload(true);
|
||||
setShowUpgradeModal(true);
|
||||
setModalError(""); setShowUpgradeModal(true);
|
||||
}}
|
||||
disabled={actionBusy}
|
||||
icon={<Download size={16} />}
|
||||
@@ -834,6 +843,13 @@ export default function UpdatePage({
|
||||
onClose={() => setShowUpgradeModal(false)}
|
||||
>
|
||||
<div className="tn-stepper-surface">
|
||||
{modalError && (
|
||||
<div className="tn-modal-error-banner" role="alert">
|
||||
<AlertCircle size={16} />
|
||||
<span>{modalError}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 4 Steps Horizontal (Exact ASCII: (1) 版本确认 (2) 下载更新包 (3) 校验与准备 (4) 重启恢复) */}
|
||||
<div className="tn-stepper-wrap">
|
||||
<Steps current={currentStep} theme="default">
|
||||
|
||||
Reference in New Issue
Block a user