Merge pull request 'Systemkacheln zeigen Haken bzw. X statt zweier gleicher LEDs' (#82) from fds2610-bot/monitor:main into main
Reviewed-on: https://codeberg.org/fds2610/monitor/pulls/82
This commit is contained in:
commit
8873b610ad
2 changed files with 32 additions and 18 deletions
|
|
@ -264,20 +264,19 @@ header.office-header h1 {
|
|||
fill: #1e293b;
|
||||
}
|
||||
|
||||
.system-tile-bar {
|
||||
fill: #334155;
|
||||
.system-tile-mark {
|
||||
fill: none;
|
||||
stroke: #64748b;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.system-tile-led {
|
||||
fill: #64748b;
|
||||
.status-ok .system-tile-mark {
|
||||
stroke: #4ade80;
|
||||
}
|
||||
|
||||
.status-ok .system-tile-led {
|
||||
fill: #4ade80;
|
||||
}
|
||||
|
||||
.status-error .system-tile-led {
|
||||
fill: #f87171;
|
||||
.status-error .system-tile-mark {
|
||||
stroke: #f87171;
|
||||
}
|
||||
|
||||
.monitor-placeholder-text {
|
||||
|
|
|
|||
|
|
@ -384,6 +384,28 @@ function renderEventMonitor(frame, events) {
|
|||
return g;
|
||||
}
|
||||
|
||||
// Statussymbol einer System-Kachel: gruener Haken bei "ok", rotes X bei "error" (die einzigen
|
||||
// beiden Werte, die SystemRepository::STATUSES kennt). Gezeichnet als Pfad und nicht als
|
||||
// Textglyphe - auf dem Wandmonitor faellt eine fehlende Schriftart sonst als leere Kachel auf.
|
||||
// Das Symbol fuellt die Kachel bis auf einen schmalen Rand aus; alle Masse haengen an der
|
||||
// Kantenlaenge, damit es jede Kachelgroesse mitgeht.
|
||||
function renderSystemStatusMark(status, tileX, tileY, tileSize) {
|
||||
const pad = 4;
|
||||
const size = tileSize - pad * 2;
|
||||
const strokeWidth = Math.max(3, size * 0.16);
|
||||
const bx = tileX + pad;
|
||||
const by = tileY + pad;
|
||||
// Die Endpunkte liegen um eine halbe Strichbreite innen, sonst ragen die runden Enden ueber
|
||||
// die Flaeche hinaus.
|
||||
const lo = strokeWidth / 2;
|
||||
const hi = size - strokeWidth / 2;
|
||||
const d =
|
||||
status === "error"
|
||||
? `M ${bx + lo} ${by + lo} L ${bx + hi} ${by + hi} M ${bx + hi} ${by + lo} L ${bx + lo} ${by + hi}`
|
||||
: `M ${bx + lo} ${by + size * 0.55} L ${bx + size * 0.38} ${by + hi} L ${bx + hi} ${by + lo}`;
|
||||
return el("path", { d, class: "system-tile-mark", "stroke-width": strokeWidth });
|
||||
}
|
||||
|
||||
function renderSystemMonitor(frame, systems, onConfigClick) {
|
||||
const tiles = buildSystemTiles(systems);
|
||||
const g = el("g", { class: "monitor monitor-systems" });
|
||||
|
|
@ -422,14 +444,7 @@ function renderSystemMonitor(frame, systems, onConfigClick) {
|
|||
tileGroup.appendChild(
|
||||
el("rect", { x: tileX, y: tileY, width: tileSize, height: tileSize, rx: 6, class: "system-tile-bg" })
|
||||
);
|
||||
tileGroup.appendChild(
|
||||
el("rect", { x: tileX + 10, y: tileY + 10, width: tileSize - 20, height: 14, rx: 2, class: "system-tile-bar" })
|
||||
);
|
||||
tileGroup.appendChild(
|
||||
el("rect", { x: tileX + 10, y: tileY + 30, width: tileSize - 20, height: 14, rx: 2, class: "system-tile-bar" })
|
||||
);
|
||||
tileGroup.appendChild(el("circle", { cx: tileX + 18, cy: tileY + 17, r: 3, class: "system-tile-led" }));
|
||||
tileGroup.appendChild(el("circle", { cx: tileX + 18, cy: tileY + 37, r: 3, class: "system-tile-led" }));
|
||||
tileGroup.appendChild(renderSystemStatusMark(system.status, tileX, tileY, tileSize));
|
||||
g.appendChild(tileGroup);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue