Require confirm before control single/batch code update.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -67,6 +67,14 @@ export default function MonitorPage() {
|
|||||||
}, [refresh, pollSec]);
|
}, [refresh, pollSec]);
|
||||||
|
|
||||||
async function act(id: number, action: "start" | "pause" | "update" | "login") {
|
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 }));
|
setBusy((b) => ({ ...b, [id]: action }));
|
||||||
setErr("");
|
setErr("");
|
||||||
try {
|
try {
|
||||||
@@ -95,6 +103,14 @@ export default function MonitorPage() {
|
|||||||
async function batchUpdate() {
|
async function batchUpdate() {
|
||||||
const ids = [...selected];
|
const ids = [...selected];
|
||||||
if (!ids.length) return;
|
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("");
|
setErr("");
|
||||||
try {
|
try {
|
||||||
await apiFetch("/api/nodes/update-batch", {
|
await apiFetch("/api/nodes/update-batch", {
|
||||||
|
|||||||
Reference in New Issue
Block a user