From 268c5f76afbb5763118066796d4ce87648c6950f Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 20 Apr 2026 09:04:27 +0800 Subject: [PATCH] refactor(feeder): remove auto control buttons from unit cards Start Auto / Stop Auto / Ack Fault belong in the ops view only. Co-Authored-By: Claude Opus 4.6 --- web/feeder/js/units.js | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/web/feeder/js/units.js b/web/feeder/js/units.js index 103757e..0ffb5dd 100644 --- a/web/feeder/js/units.js +++ b/web/feeder/js/units.js @@ -172,37 +172,6 @@ function buildUnitCard(unit, mode) { actions.append(selectEquipBtn); } - const isAutoOn = runtime?.auto_enabled; - const startBlocked = !isAutoOn && (runtime?.fault_locked || runtime?.manual_ack_required || runtime?.rem_local); - const autoBtn = document.createElement("button"); - autoBtn.className = isAutoOn ? "danger" : "secondary"; - autoBtn.textContent = isAutoOn ? "Stop Auto" : "Start Auto"; - autoBtn.disabled = startBlocked; - autoBtn.title = startBlocked - ? (runtime?.fault_locked ? "设备故障中,无法启动自动控制" - : runtime?.rem_local ? "设备处于本地模式(REM关),无法启动自动控制" - : "需人工确认故障后才可启动自动控制") - : (isAutoOn ? "停止自动控制" : "启动自动控制"); - autoBtn.addEventListener("click", (e) => { - e.stopPropagation(); - const url = `/api/control/unit/${unit.id}/${isAutoOn ? "stop-auto" : "start-auto"}`; - apiFetch(url, { method: "POST" }).then(() => loadUnits()).catch(() => {}); - }); - actions.append(autoBtn); - - if (runtime?.manual_ack_required) { - const ackBtn = document.createElement("button"); - ackBtn.className = "danger"; - ackBtn.textContent = "Ack Fault"; - ackBtn.title = "人工确认解除故障锁定"; - ackBtn.addEventListener("click", (e) => { - e.stopPropagation(); - apiFetch(`/api/control/unit/${unit.id}/ack-fault`, { method: "POST" }) - .then(() => loadUnits()).catch(() => {}); - }); - actions.append(ackBtn); - } - return card; }