feat(frontend): add start/stop control buttons to equipment cards
This commit is contained in:
parent
89023e867b
commit
21f6008cba
|
|
@ -210,6 +210,29 @@ export function renderEquipments() {
|
||||||
});
|
});
|
||||||
|
|
||||||
actionRow.append(editBtn, deleteBtn);
|
actionRow.append(editBtn, deleteBtn);
|
||||||
|
|
||||||
|
if (equipment.kind === "coal_feeder" || equipment.kind === "distributor") {
|
||||||
|
const startBtn = document.createElement("button");
|
||||||
|
startBtn.className = "secondary";
|
||||||
|
startBtn.textContent = "Start";
|
||||||
|
startBtn.addEventListener("click", (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
apiFetch(`/api/control/equipment/${equipment.id}/start`, { method: "POST" })
|
||||||
|
.catch(() => {});
|
||||||
|
});
|
||||||
|
|
||||||
|
const stopBtn = document.createElement("button");
|
||||||
|
stopBtn.className = "danger";
|
||||||
|
stopBtn.textContent = "Stop";
|
||||||
|
stopBtn.addEventListener("click", (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
apiFetch(`/api/control/equipment/${equipment.id}/stop`, { method: "POST" })
|
||||||
|
.catch(() => {});
|
||||||
|
});
|
||||||
|
|
||||||
|
actionRow.append(startBtn, stopBtn);
|
||||||
|
}
|
||||||
|
|
||||||
dom.equipmentList.appendChild(box);
|
dom.equipmentList.appendChild(box);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue