- Add showCoverageDegradation() to display before/after GDOP comparison - Add dismissCoverageDegradation() to clear overlay on node recovery - Create ground plane cells colored by degradation severity (red/amber/yellow) - Add legend with before/after statistics and coverage delta - Export functions to public API for WebSocket integration Implements plan.md Component 12: before/after coverage overlay when fleet self-healing fires due to node loss. Co-Authored-By: Claude <noreply@anthropic.com>
2.7 KiB
2.7 KiB
Coverage Degradation Overlay Implementation
Summary
Implemented before/after coverage overlay in dashboard for self-healing fleet events, as required by plan.md Component 12.
Changes Made
viz3d.js
Added comprehensive coverage degradation overlay functionality:
-
showCoverageDegradation(data) - Main function that:
- Receives fleet change event data from WebSocket
- Compares GDOP values before/after node loss
- Creates ground plane cells colored by degradation level
- Displays legend with before/after statistics
- Highlights affected zones in red/amber/yellow
-
dismissCoverageDegradation() - Cleans up overlay when node recovers
-
Supporting functions:
calculateGDOPDegradation(before, after)- Categorizes degradation as severe/moderate/mild/nonegetDegradationColor(level, gdopAfter)- Maps degradation levels to colorscreateDegradationLegend(data)- Shows before/after stats with color-coded legendclearCoverageOverlay()- Removes all overlay meshes and sprites
-
State variables:
_coverageOverlayMeshes- Stores degraded cell meshes_coverageOverlayVisible- Toggle state_coverageOverlayData- Current event data_coverageOverlayGroup- THREE.Group for organization_degradationLegendSprites- Legend sprite storage
-
Public API exports:
- Added
showCoverageDegradationanddismissCoverageDegradationto module exports
- Added
Integration
The implementation integrates with existing infrastructure:
- WebSocket handler in app.js already calls
Viz3D.showCoverageDegradation()on fleet_change events - FleetChangeEvent in selfheal.go already includes all required GDOP before/after data
- Dashboard toast notifications and timeline events already working
Degradation Levels
- Severe (red): >2x GDOP increase OR GDOP > 8 (poor coverage)
- Moderate (amber): >1.5x increase OR GDOP > 4 (fair coverage)
- Mild (yellow): >20% GDOP increase
- None: No significant change (not displayed)
User Experience
When a node goes offline:
- Toast notification shows degradation warning
- Timeline event logged with before/after stats
- 3D view shows red/amber/yellow cells highlighting degraded zones
- Legend displays coverage percentage delta
- Links lost/remaining estimated
When node recovers:
- Toast notification shows recovery success
- Overlay automatically dismissed
- Full coverage restored visualization
Files Modified
/home/coding/spaxel/dashboard/js/viz3d.js- Added coverage degradation overlay (~250 lines)
Testing
- Dashboard tests run successfully (283 passed)
- No syntax errors in JavaScript
- Functions properly exported to public API