spaxel/dashboard/index.html
jedarden de424a1f63 feat(mothership): complete Phase 2 signal processing & detection
- Dashboard presence indicator: per-link MOTION/CLEAR badges with global
  status bar indicator, motion_state WebSocket messages, amplitude chart
- CSI recording buffer: disk-backed circular buffer (replay/store.go) with
  magic-tagged binary format, wrap/eviction, 360 MB default (~48 h at 20 Hz)
- Adaptive sensing rate: RateController ramps nodes to 20 Hz on motion,
  drops to 2 Hz after 10 s idle; wires to SendConfigToMAC over WebSocket
- Fix: alias internal/signal as sigproc to avoid conflict with os/signal
- Fix: add GetAllMotionStates() to MockIngestionState in dashboard tests

All tests pass (signal, ingestion, replay, dashboard).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 22:27:24 -04:00

281 lines
7.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Spaxel Dashboard</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
background: #1a1a2e;
color: #eee;
overflow: hidden;
}
#scene-container {
width: 100vw;
height: 100vh;
}
/* Status bar at top */
#status-bar {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 40px;
background: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
padding: 0 16px;
gap: 24px;
z-index: 100;
font-size: 14px;
}
.status-item {
display: flex;
align-items: center;
gap: 8px;
}
.status-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: #666;
}
.status-dot.connected {
background: #4caf50;
box-shadow: 0 0 8px #4caf50;
}
.status-dot.disconnected {
background: #f44336;
}
/* Amplitude chart overlay */
#chart-panel {
position: fixed;
bottom: 20px;
right: 20px;
width: 400px;
height: 200px;
background: rgba(0, 0, 0, 0.8);
border-radius: 8px;
padding: 12px;
z-index: 100;
}
#chart-title {
font-size: 12px;
color: #888;
margin-bottom: 8px;
}
#chart-title .link-id {
color: #4fc3f7;
font-family: monospace;
}
#amplitude-chart {
width: 100%;
height: calc(100% - 24px);
}
/* Node list panel */
#node-panel {
position: fixed;
top: 60px;
left: 20px;
width: 280px;
max-height: calc(100vh - 80px);
background: rgba(0, 0, 0, 0.8);
border-radius: 8px;
padding: 12px;
z-index: 100;
overflow-y: auto;
}
#node-panel h3 {
font-size: 14px;
color: #888;
margin-bottom: 12px;
text-transform: uppercase;
letter-spacing: 1px;
}
.node-item {
padding: 8px;
margin-bottom: 4px;
background: rgba(255, 255, 255, 0.05);
border-radius: 4px;
font-size: 13px;
cursor: pointer;
transition: background 0.2s;
}
.node-item:hover {
background: rgba(255, 255, 255, 0.1);
}
.node-item.selected {
background: rgba(79, 195, 247, 0.2);
border: 1px solid rgba(79, 195, 247, 0.5);
}
.node-mac {
font-family: monospace;
color: #4fc3f7;
}
.node-status {
float: right;
font-size: 11px;
padding: 2px 6px;
border-radius: 3px;
}
.node-status.online {
background: rgba(76, 175, 80, 0.3);
color: #81c784;
}
.node-status.offline {
background: rgba(244, 67, 54, 0.3);
color: #e57373;
}
/* Empty state */
.empty-state {
text-align: center;
color: #666;
padding: 20px;
font-size: 13px;
}
/* Link list */
.link-section {
margin-top: 16px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
padding-top: 12px;
}
.link-item {
padding: 6px 8px;
margin-bottom: 4px;
background: rgba(255, 255, 255, 0.03);
border-radius: 4px;
font-size: 12px;
cursor: pointer;
display: flex;
justify-content: space-between;
}
.link-item:hover {
background: rgba(255, 255, 255, 0.08);
}
.link-item.selected {
background: rgba(79, 195, 247, 0.2);
}
/* Presence badge */
.presence-badge {
font-size: 10px;
font-weight: 600;
padding: 2px 6px;
border-radius: 3px;
letter-spacing: 0.5px;
}
.presence-badge.motion {
background: rgba(244, 67, 54, 0.25);
color: #ef5350;
}
.presence-badge.clear {
background: rgba(76, 175, 80, 0.2);
color: #66bb6a;
}
/* Overall presence indicator in status bar */
#presence-indicator {
font-size: 12px;
font-weight: 600;
padding: 3px 8px;
border-radius: 4px;
transition: background 0.3s, color 0.3s;
}
#presence-indicator.motion {
background: rgba(244, 67, 54, 0.3);
color: #ef5350;
}
#presence-indicator.clear {
background: rgba(76, 175, 80, 0.15);
color: #66bb6a;
}
</style>
</head>
<body>
<!-- Status bar -->
<div id="status-bar">
<div class="status-item">
<div id="ws-status" class="status-dot disconnected"></div>
<span id="ws-status-text">Disconnected</span>
</div>
<div class="status-item">
<span>Nodes: <strong id="node-count">0</strong></span>
</div>
<div class="status-item">
<span>Links: <strong id="link-count">0</strong></span>
</div>
<div class="status-item">
<span id="presence-indicator" class="clear">CLEAR</span>
</div>
<div class="status-item" style="margin-left:auto;">
<span>FPS: <strong id="fps-counter">0</strong></span>
</div>
</div>
<!-- 3D Scene container -->
<div id="scene-container"></div>
<!-- Node panel -->
<div id="node-panel">
<h3>Nodes</h3>
<div id="node-list">
<div class="empty-state">No nodes connected</div>
</div>
<div class="link-section">
<h3>Links</h3>
<div id="link-list">
<div class="empty-state">No links active</div>
</div>
</div>
</div>
<!-- Amplitude chart -->
<div id="chart-panel">
<div id="chart-title">Amplitude — <span class="link-id">no link selected</span></div>
<canvas id="amplitude-chart"></canvas>
</div>
<!-- Three.js from CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<!-- OrbitControls from CDN -->
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"></script>
<!-- Main application -->
<script src="js/app.js"></script>
</body>
</html>