Compare commits
2 Commits
7cf063431d
...
b0a66ed982
| Author | SHA1 | Date | |
|---|---|---|---|
| b0a66ed982 | |||
| 7171e5ea09 |
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user