Compare commits

..

2 Commits

Author SHA1 Message Date
admin b0a66ed982 Merge branch 'main' of https://git.sases.pl/sases/als-alert-screen 2026-06-08 09:39:11 +02:00
admin 7171e5ea09 alarm clear on disconnect 2026-06-08 09:37:18 +02:00
+7 -2
View File
@@ -303,7 +303,7 @@
ws.onmessage = (ev) => {
try {
const msg = JSON.parse(ev.data);
if (msg.type === "machine_update" && msg.data) {
if (msg.data) {
machineData[id] = { ...msg.data, _ts: msg.timestamp };
updateDisplay();
}
@@ -319,6 +319,11 @@
ws.onclose = () => {
wsStatus[id] = "disconnected";
// Usuwamy dane maszyny przy rozłączeniu nie możemy potwierdzić
// aktualnego stanu, więc nie trzymamy przestarzałego alarmu w cache.
// Po ponownym połączeniu serwer wyśle aktualny stan.
delete machineData[id];
updateDisplay();
refreshStatus();
setTimeout(() => connect(id), RECONNECT_MS);
};
@@ -373,7 +378,7 @@
card.className = "machine-card";
card.innerHTML = `
<div class="card-machine-id">${d.machine ?? id}</div>
<!--- <div class="card-status">${d.status ?? "ALARM"}</div> -->
<!-- <div class="card-status">${d.status ?? "ALARM"}</div> -->
`;
grid.appendChild(card);
});