From d0ce1726e8954367eab07da21b3c28c7c52ddfe8 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Thu, 23 Oct 2025 17:54:06 +0200 Subject: [PATCH] Clean up UI code and improve agent hash display - Remove unused imports and debug logging - Change agent display from 'Agent Hash: full' to 'Agent: short8' - Fix unused variable warnings --- dashboard/src/ui/mod.rs | 2 +- dashboard/src/ui/widgets/mod.rs | 2 -- dashboard/src/ui/widgets/system.rs | 14 +++++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dashboard/src/ui/mod.rs b/dashboard/src/ui/mod.rs index dcf9e8a..466b461 100644 --- a/dashboard/src/ui/mod.rs +++ b/dashboard/src/ui/mod.rs @@ -406,7 +406,7 @@ impl TuiApp { } } - fn render_system_panel(&mut self, frame: &mut Frame, area: Rect, metric_store: &MetricStore) { + fn render_system_panel(&mut self, frame: &mut Frame, area: Rect, _metric_store: &MetricStore) { let system_block = Components::widget_block("system"); let inner_area = system_block.inner(area); frame.render_widget(system_block, area); diff --git a/dashboard/src/ui/widgets/mod.rs b/dashboard/src/ui/widgets/mod.rs index d2a6bf1..026c6ec 100644 --- a/dashboard/src/ui/widgets/mod.rs +++ b/dashboard/src/ui/widgets/mod.rs @@ -8,8 +8,6 @@ pub mod services; pub mod system; pub use backup::BackupWidget; -pub use cpu::CpuWidget; -pub use memory::MemoryWidget; pub use services::ServicesWidget; pub use system::SystemWidget; diff --git a/dashboard/src/ui/widgets/system.rs b/dashboard/src/ui/widgets/system.rs index a45a0ba..b44b36f 100644 --- a/dashboard/src/ui/widgets/system.rs +++ b/dashboard/src/ui/widgets/system.rs @@ -1,9 +1,8 @@ use cm_dashboard_shared::{Metric, MetricValue, Status}; use ratatui::{ layout::Rect, - style::Style, text::{Line, Span, Text}, - widgets::{Block, Borders, Paragraph}, + widgets::Paragraph, Frame, }; @@ -299,10 +298,6 @@ impl Widget for SystemWidget { self.has_data = !metrics.is_empty(); for metric in metrics { - // Debug logging for NixOS metrics - if metric.name.starts_with("system_") { - tracing::debug!("SystemWidget received metric: {} = {:?}", metric.name, metric.value); - } match metric.name.as_str() { // NixOS metrics "system_nixos_build" => { @@ -405,8 +400,13 @@ impl Widget for SystemWidget { ])); let agent_hash_text = self.agent_hash.as_deref().unwrap_or("unknown"); + let short_hash = if agent_hash_text.len() > 8 && agent_hash_text != "unknown" { + &agent_hash_text[..8] + } else { + agent_hash_text + }; lines.push(Line::from(vec![ - Span::styled(format!("Agent Hash: {}", agent_hash_text), Typography::secondary()) + Span::styled(format!("Agent: {}", short_hash), Typography::secondary()) ])); // CPU section