Standalone 3-file diagnostics dashboard (ui/diagnostics_panel.{html,js,css}).
No build step — serve the ui/ directory directly. roslib.js via CDN.
Panels:
- Battery: voltage (V), SOC (%), current (A) with large readouts + gauge bars
+ 2-minute sparkline history canvas, 4S LiPo thresholds
- Temperatures: CPU/GPU (Jetson tegrastats) + Board/STM32 + Motor L/R
color-coded temp boxes with mini progress bars (green<60 amber<75 red>75°C)
- Motor current: per-wheel current gauge bars + CMD value + balance_state label
Thresholds: warn 8A / crit 12A
- Resources: RAM / GPU memory / Disk — gauge bars with used/total display
Thresholds: warn 80% / crit 95%
- WiFi / Network: RSSI signal bars (5-level) + dBm readout + latency (ms)
MQTT broker status via mqtt_connected KeyValue
- ROS2 node health: full DiagnosticArray node list with OK/WARN/ERROR/STALE
badges, per-node message preview, MutationObserver count badge
Features:
- Auto 2 Hz refresh via rosbridge subscriptions (throttle_rate: 500ms)
- Pulsing refresh indicator dot on each update
- System status bar: HEALTHY/DEGRADED/FAULT/STALE badge + battery/thermal/net
- Alert thresholds: red/amber/green for every metric
- Responsive CSS grid: 3-col → 2-col → 1-col via media queries
- WS URL persisted in localStorage
ROS topics:
SUB /diagnostics diagnostic_msgs/DiagnosticArray
SUB /saltybot/balance_state std_msgs/String (JSON)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
231 lines
7.1 KiB
CSS
231 lines
7.1 KiB
CSS
/* diagnostics_panel.css — Saltybot System Diagnostics Dashboard (Issue #562) */
|
|
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
:root {
|
|
--bg0: #050510;
|
|
--bg1: #070712;
|
|
--bg2: #0a0a1a;
|
|
--border: #0c2a3a;
|
|
--border2: #1e3a5f;
|
|
--text-dim: #374151;
|
|
--text-mid: #6b7280;
|
|
--text-base: #9ca3af;
|
|
--text-hi: #d1d5db;
|
|
--cyan: #06b6d4;
|
|
--cyan-dim: #0e4f69;
|
|
--green: #22c55e;
|
|
--amber: #f59e0b;
|
|
--red: #ef4444;
|
|
--orange: #f97316;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Courier New', Courier, monospace;
|
|
font-size: 12px;
|
|
background: var(--bg0);
|
|
color: var(--text-base);
|
|
min-height: 100dvh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
/* ── Header ── */
|
|
#header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 6px 16px;
|
|
background: var(--bg1);
|
|
border-bottom: 1px solid var(--border);
|
|
flex-shrink: 0;
|
|
flex-wrap: wrap;
|
|
gap: 8px;
|
|
}
|
|
.logo { color: #f97316; font-weight: bold; letter-spacing: 0.15em; font-size: 13px; }
|
|
|
|
#conn-bar { display: flex; align-items: center; gap: 6px; }
|
|
#conn-dot {
|
|
width: 8px; height: 8px; border-radius: 50%;
|
|
background: var(--text-dim); flex-shrink: 0; transition: background 0.3s;
|
|
}
|
|
#conn-dot.connected { background: var(--green); }
|
|
#conn-dot.error { background: var(--red); animation: blink 1s infinite; }
|
|
|
|
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
|
|
|
|
#ws-input {
|
|
background: var(--bg2); border: 1px solid var(--border2); border-radius: 4px;
|
|
color: #67e8f9; padding: 2px 8px; font-family: monospace; font-size: 11px; width: 200px;
|
|
}
|
|
#ws-input:focus { outline: none; border-color: var(--cyan); }
|
|
|
|
.hdr-btn {
|
|
padding: 3px 10px; border-radius: 4px; border: 1px solid var(--border2);
|
|
background: var(--bg2); color: #67e8f9; font-family: monospace;
|
|
font-size: 10px; font-weight: bold; cursor: pointer; transition: background 0.15s;
|
|
}
|
|
.hdr-btn:hover { background: var(--cyan-dim); }
|
|
|
|
#refresh-info {
|
|
font-size: 10px; color: var(--text-mid);
|
|
display: flex; align-items: center; gap: 4px;
|
|
}
|
|
#refresh-dot {
|
|
width: 6px; height: 6px; border-radius: 50%;
|
|
background: var(--text-dim); transition: background 0.2s;
|
|
}
|
|
#refresh-dot.pulse { background: var(--cyan); animation: blink 0.4s; }
|
|
|
|
/* ── Status bar ── */
|
|
#status-bar {
|
|
display: flex; gap: 8px; align-items: center;
|
|
padding: 4px 16px; background: var(--bg1);
|
|
border-bottom: 1px solid var(--border); font-size: 10px; flex-wrap: wrap;
|
|
}
|
|
.sys-badge {
|
|
padding: 2px 8px; border-radius: 3px; font-weight: bold;
|
|
border: 1px solid; letter-spacing: 0.05em;
|
|
}
|
|
.badge-ok { background: #052e16; border-color: #166534; color: #4ade80; }
|
|
.badge-warn { background: #451a03; border-color: #92400e; color: #fcd34d; }
|
|
.badge-error { background: #450a0a; border-color: #991b1b; color: #f87171; animation: blink 1s infinite; }
|
|
.badge-stale { background: #111827; border-color: #374151; color: #6b7280; }
|
|
#last-update { color: var(--text-mid); margin-left: auto; }
|
|
|
|
/* ── Dashboard grid ── */
|
|
#dashboard {
|
|
flex: 1;
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
grid-template-rows: auto;
|
|
gap: 12px;
|
|
padding: 12px;
|
|
align-content: start;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
@media (max-width: 1024px) { #dashboard { grid-template-columns: repeat(2, 1fr); } }
|
|
@media (max-width: 640px) { #dashboard { grid-template-columns: 1fr; } }
|
|
|
|
/* Spanning cards */
|
|
.span2 { grid-column: span 2; }
|
|
.span3 { grid-column: 1 / -1; }
|
|
|
|
/* ── Card ── */
|
|
.card {
|
|
background: var(--bg1);
|
|
border: 1px solid var(--border);
|
|
border-radius: 8px;
|
|
padding: 10px 12px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
.card.alert-warn { border-color: #92400e; }
|
|
.card.alert-error { border-color: #991b1b; }
|
|
|
|
.card-title {
|
|
font-size: 9px; font-weight: bold; letter-spacing: 0.15em;
|
|
color: #0891b2; text-transform: uppercase;
|
|
display: flex; align-items: center; justify-content: space-between;
|
|
}
|
|
.card-title .badge { font-size: 9px; padding: 1px 6px; border-radius: 3px; }
|
|
|
|
/* ── Gauge bar ── */
|
|
.gauge-row {
|
|
display: flex; flex-direction: column; gap: 3px;
|
|
}
|
|
.gauge-label-row {
|
|
display: flex; justify-content: space-between; font-size: 10px;
|
|
}
|
|
.gauge-label { color: var(--text-mid); }
|
|
.gauge-value { font-family: monospace; }
|
|
.gauge-track {
|
|
width: 100%; height: 8px;
|
|
background: var(--bg2); border-radius: 4px;
|
|
overflow: hidden; border: 1px solid var(--border2);
|
|
}
|
|
.gauge-fill {
|
|
height: 100%; border-radius: 4px;
|
|
transition: width 0.5s ease, background 0.5s ease;
|
|
}
|
|
|
|
/* ── Big metric ── */
|
|
.big-metric {
|
|
display: flex; align-items: baseline; gap: 4px;
|
|
}
|
|
.big-num { font-size: 28px; font-weight: bold; font-family: monospace; }
|
|
.big-unit { font-size: 11px; color: var(--text-mid); }
|
|
|
|
/* ── Sparkline ── */
|
|
#batt-sparkline {
|
|
width: 100%; border-radius: 4px;
|
|
border: 1px solid var(--border2);
|
|
background: var(--bg2);
|
|
display: block;
|
|
}
|
|
|
|
/* ── Node list ── */
|
|
.node-row {
|
|
display: flex; align-items: center; justify-content: space-between;
|
|
padding: 3px 0; border-bottom: 1px solid var(--border);
|
|
font-size: 10px;
|
|
}
|
|
.node-row:last-child { border-bottom: none; }
|
|
.node-name { color: var(--text-base); font-family: monospace; }
|
|
.node-status {
|
|
padding: 1px 6px; border-radius: 3px; font-size: 9px; font-weight: bold;
|
|
}
|
|
.ns-ok { background: #052e16; color: #4ade80; }
|
|
.ns-warn { background: #451a03; color: #fcd34d; }
|
|
.ns-error { background: #450a0a; color: #f87171; }
|
|
.ns-stale { background: #111827; color: #6b7280; }
|
|
|
|
/* ── Temp arc display ── */
|
|
.temp-grid {
|
|
display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
|
|
}
|
|
.temp-box {
|
|
background: var(--bg2); border: 1px solid var(--border2);
|
|
border-radius: 6px; padding: 6px; text-align: center;
|
|
}
|
|
.temp-label { font-size: 9px; color: var(--text-mid); margin-bottom: 2px; }
|
|
.temp-value { font-size: 22px; font-weight: bold; font-family: monospace; }
|
|
.temp-bar-track {
|
|
margin-top: 4px; width: 100%; height: 4px;
|
|
background: var(--bg0); border-radius: 2px; overflow: hidden;
|
|
}
|
|
.temp-bar-fill { height: 100%; border-radius: 2px; transition: width 0.5s; }
|
|
|
|
/* ── Motor section ── */
|
|
.motor-grid {
|
|
display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
|
|
}
|
|
.motor-box {
|
|
background: var(--bg2); border: 1px solid var(--border2);
|
|
border-radius: 6px; padding: 8px;
|
|
}
|
|
.motor-label { font-size: 9px; color: var(--text-mid); margin-bottom: 4px; }
|
|
|
|
/* ── WiFi bars ── */
|
|
.rssi-bars { display: flex; align-items: flex-end; gap: 3px; }
|
|
.rssi-bar { width: 6px; border-radius: 2px 2px 0 0; }
|
|
|
|
/* ── MQTT indicator ── */
|
|
.mqtt-status { display: flex; align-items: center; gap: 6px; }
|
|
.mqtt-dot {
|
|
width: 10px; height: 10px; border-radius: 50%;
|
|
background: var(--text-dim); transition: background 0.3s;
|
|
}
|
|
.mqtt-dot.connected { background: var(--green); animation: none; }
|
|
.mqtt-dot.disconnected { background: var(--red); animation: blink 1s infinite; }
|
|
|
|
/* ── Footer ── */
|
|
#footer {
|
|
background: var(--bg1); border-top: 1px solid var(--border);
|
|
padding: 4px 16px;
|
|
display: flex; align-items: center; justify-content: space-between;
|
|
flex-shrink: 0; font-size: 10px; color: var(--text-dim);
|
|
}
|