Skip to content

dashboard: modularize dashboard.py and dashboard.html with zero bundler - #414

Merged
FujitsuPolycom merged 2 commits into
mainfrom
refactor/dashboard-modularization
Nov 30, 2026
Merged

FujitsuPolycom merged 2 commits into
mainfrom
refactor/dashboard-modularization

Conversation

@FujitsuPolycom

Copy link
Copy Markdown
Owner

Why

runtime/host/dashboard.py (2,487 LOC) and runtime/host/dashboard.html (1,700 LOC) had grown into single-file monoliths mixing HTTP server logic, data collection, parsers, quiet-mode management, inline CSS, and 1,200+ lines of inline JS, while retaining a leftover sparkring_sircl.cpus import. Modularizing them makes the built-in Web + TUI dashboard maintainable without dropping any feature or introducing a JS bundler.

What Changed

  • Python modularization (runtime/host/dashboard.py: 2,487 → 199 LOC facade):
    • Split into 6 focused modules: dashboard_client.py (131 LOC), dashboard_parsers.py (353 LOC), dashboard_sources.py (501 LOC), dashboard_collector.py (1,029 LOC), dashboard_quiet.py (156 LOC), and dashboard_server.py (313 LOC), while preserving all public entrypoints and symbols on dashboard.py.
    • Moved parse_cpu_list / format_cpu_list into runtime/host/host_load.py, severing the dashboard's last sparkring_sircl import.
  • Zero-bundler frontend split (runtime/host/dashboard.html: 1,700 → 78 LOC shell):
    • Extracted CSS and JS into runtime/host/dashboard_assets/ (dashboard.css, charts.js, ring.js, cards.js, app.js), assembled server-side via dashboard.page_bytes() with identical SHA-256 CSP hashes and zero external build tooling.
  • Tests:
    • Updated 1 assertion line in runtime/host/test_dashboard_actions.py to inspect dashboard.page_bytes()[0] instead of the raw HTML shell.
    • Added runtime/host/test_dashboard_modular.py covering facade exports, zero sparkring_sircl coupling, and assembled page/CSP invariants.

Verification

  • pytest across dashboard, Playwright UI, host_load, and build_deb suites: 510 passed, 5 skipped.
  • ruff check, check_repository_layout.py, and check_release_safety.py (0 findings) all passed cleanly.
  • Rebased cleanly onto origin/main (c41caea3).

Risks / Follow-Ups

  • None expected; all Web UI features, TUI behavior, CSP hashes, and .deb packaging paths are preserved.

@FujitsuPolycom
FujitsuPolycom merged commit 7e523b3 into main Nov 30, 2026
10 checks passed
@FujitsuPolycom
FujitsuPolycom deleted the refactor/dashboard-modularization branch November 30, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant