forked from geomind_code/zinit_archive2
_ui needs left side in admin panel #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
puts statistics there
also graphs
memory usage over all managed processes
network usage
cpu usage
be more in line to our standards
Implementation Spec for Issue #5 — Admin Panel Left Sidebar with Stats & Graphs
Objective
Refactor the Admin tab (
#tab-admin) in the HeroProc dashboard to use a two-column layout — a persistent left sidebar showing live system statistics (memory, CPU, network) with sparkline graphs, and a right main area containing the existing administrative action cards. This mirrors the established left-sidebar pattern already used in the Docs tab, and reuses the existing Chart.js, Bootstrap 5 dark-mode CSS variables, and JSON-RPC polling infrastructure already present in the codebase.Requirements
chart.umd.min.js(Chart.js) with the same dark-mode color tokens as the Stats tab.loadSystemStats()polling loop (runs every 2s) without adding a new polling timer.dashboard.cssfile using the established CSS variable system.system.statsRPC andsysmon.rs.Files to Modify
crates/hero_proc_ui/templates/index.html#tab-adminHTML with.admin-layoutwrapper,.admin-sidebarwith stat widgets,.admin-mainfor existing action gridcrates/hero_proc_ui/static/css/dashboard.css.admin-layout,.admin-sidebar,.admin-stat-widget,.admin-spark-wrap, responsive breakpointcrates/hero_proc_ui/static/js/dashboard.jsupdateAdminSidebar(),formatBytes(), admin Chart.js instances, lifecycle hooks inswitchTab()andloadSystemStats()crates/hero_proc_server/src/sysmon.rsnetwork_rx_bytes/network_tx_bytestoSystemStats, addsys.refresh_networks()crates/hero_proc_server/src/rpc/system.rshandle_statsJSON responsecrates/hero_proc_server/openrpc.jsonSystemStatsschemaImplementation Plan
Step 1 — Extend
sysmon.rswith network I/O statsFiles:
crates/hero_proc_server/src/sysmon.rsnetwork_rx_bytes: u64andnetwork_tx_bytes: u64toSystemStatssys.refresh_networks()call insystem_stats()sys.networks().iter()Dependencies: none
Step 2 — Update
handle_statsinsystem.rsandopenrpc.jsonFiles:
crates/hero_proc_server/src/rpc/system.rs,crates/hero_proc_server/openrpc.jsonnetwork_rx_bytesandnetwork_tx_bytesto JSON responseDependencies: Step 1
Step 3 — Add CSS for the admin sidebar layout
Files:
crates/hero_proc_ui/static/css/dashboard.css.admin-layout,.admin-sidebar,.admin-stat-widget,.admin-spark-wrapclassesDependencies: none (can run in parallel with Step 1)
Step 4 — Refactor Admin tab HTML in
index.htmlFiles:
crates/hero_proc_ui/templates/index.html#tab-admincontent in.admin-layout.admin-sidebarwith Memory, CPU, Network, Processes, Jobs stat widgets with canvas elements.admin-mainDependencies: Step 3
Step 5 — Add admin sidebar JS
Files:
crates/hero_proc_ui/static/js/dashboard.jsformatBytes()helperupdateAdminSidebar()functionloadSystemStats()andswitchTab()Dependencies: Steps 1, 2, 4
Acceptance Criteria
system.statsRPC (no mock data)cargo build -p hero_proc_serverandcargo build -p hero_proc_uipasscargo test -p hero_proc_serverpassesNotes
sysinfo 0.37providesSystem::networks()with cumulative bytes since boot; JS computes deltas for bandwidth displayrpc()helperTest Results
Build: ✅ hero_proc_server + hero_proc_ui compile successfully
Tests:
cargo test -p hero_proc_serverAll 55 tests passed across the following modules:
process::tests(4 tests)scheduler::tests(14 tests)types::protocol::tests(6 tests)types::responses::tests(4 tests)types::signal::tests(7 tests)types::socket::tests(2 tests)types::state::tests(10 tests)types::version::tests(3 tests)main.rsunit tests (0 tests)Branch:
development_kristof_ttyd| Date: 2026-03-18Implementation Complete ✅
Changes Made
Backend (
hero_proc_server):crates/hero_proc_server/src/sysmon.rs— Addednetwork_rx_bytes: u64andnetwork_tx_bytes: u64toSystemStats; addedNetworksrefresh and summing across all interfaces; refactored global state to bundleSystem+Networksin a singleSysmonStatemutexcrates/hero_proc_server/src/rpc/system.rs— Exposednetwork_rx_bytesandnetwork_tx_bytesin thehandle_statsJSON responsecrates/hero_proc_server/openrpc.json— Added network fields toSystemStatsschemaFrontend (
hero_proc_ui):crates/hero_proc_ui/templates/index.html— Refactored#tab-adminto a two-column layout: left sidebar with 5 live stat widgets (Memory+sparkline, CPU+sparkline, Network+sparkline, Processes, Jobs), right main area with existing admin action sections unchangedcrates/hero_proc_ui/static/css/dashboard.css— Added.admin-layout,.admin-sidebar,.admin-stat-widget,.admin-spark-wrap,.admin-job-rowclasses with responsive breakpoint at 768pxcrates/hero_proc_ui/static/js/dashboard.js— AddedupdateAdminSidebar(),updateAdminSparkline(),updateAdminNetChart(),formatBytes()functions; admin Chart.js instances with lifecycle hooks inswitchTab()andloadSystemStats()Test Results
cargo test -p hero_proc_server)Acceptance Criteria
system.statsRPCImplementation committed:
307925eBrowse:
lhumina_code/hero_proc@307925e