feat(frontend): handle UnitRuntimeChanged WebSocket message
This commit is contained in:
parent
21f6008cba
commit
0c2ce48d23
|
|
@ -3,6 +3,7 @@ import { dom } from "./dom.js";
|
||||||
import { prependEvent } from "./events.js";
|
import { prependEvent } from "./events.js";
|
||||||
import { formatValue } from "./points.js";
|
import { formatValue } from "./points.js";
|
||||||
import { state } from "./state.js";
|
import { state } from "./state.js";
|
||||||
|
import { renderUnits } from "./units.js";
|
||||||
|
|
||||||
function escapeHtml(text) {
|
function escapeHtml(text) {
|
||||||
return text
|
return text
|
||||||
|
|
@ -94,6 +95,13 @@ export function startPointSocket() {
|
||||||
if (payload.type === "EventCreated" || payload.type === "event_created") {
|
if (payload.type === "EventCreated" || payload.type === "event_created") {
|
||||||
prependEvent(payload.data);
|
prependEvent(payload.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (payload.type === "UnitRuntimeChanged") {
|
||||||
|
const runtime = payload.data;
|
||||||
|
state.runtimes.set(runtime.unit_id, runtime);
|
||||||
|
renderUnits();
|
||||||
|
return;
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// ignore malformed messages
|
// ignore malformed messages
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue