Require confirm before control single/batch code update.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-30 11:14:14 +08:00
parent 75e89ca442
commit 7c87c42061
+16
View File
@@ -67,6 +67,14 @@ export default function MonitorPage() {
}, [refresh, pollSec]);
async function act(id: number, action: "start" | "pause" | "update" | "login") {
if (action === "update") {
const node = nodes.find((x) => x.id === id);
const name = node?.name || `#${id}`;
const ok = window.confirm(
`确认更新「${name}」代码?\n\n将 git pull 并 reload 策略进程,短暂中断 API;不会自动启动策略。\n请勿误点。`,
);
if (!ok) return;
}
setBusy((b) => ({ ...b, [id]: action }));
setErr("");
try {
@@ -95,6 +103,14 @@ export default function MonitorPage() {
async function batchUpdate() {
const ids = [...selected];
if (!ids.length) return;
const names = nodes
.filter((n) => ids.includes(n.id))
.map((n) => n.name)
.join("、");
const ok = window.confirm(
`确认批量更新 ${ids.length} 台策略机?\n\n${names}\n\n将分别 git pull 并 reload,短暂中断;不会自动启动策略。`,
);
if (!ok) return;
setErr("");
try {
await apiFetch("/api/nodes/update-batch", {