From af52d49194c506dc4adbe7bc97e6e5ebbc45dde5 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sun, 26 Oct 2025 13:34:56 +0100 Subject: [PATCH] Fix system panel layout and switch to version-based agent reporting - Remove auto-close behavior from terminal popup for manual review - Fix system panel to show correct NixOS section layout - Add missing Active users line after Agent version - Switch agent version from nix store hash to actual version number (v0.1.11) - Display full version string without truncation for clear version tracking --- agent/src/agent.rs | 21 +++------------------ dashboard/src/app.rs | 5 +---- dashboard/src/ui/mod.rs | 2 +- dashboard/src/ui/widgets/system.rs | 14 ++------------ 4 files changed, 7 insertions(+), 35 deletions(-) diff --git a/agent/src/agent.rs b/agent/src/agent.rs index 8a6633c..afe521a 100644 --- a/agent/src/agent.rs +++ b/agent/src/agent.rs @@ -199,25 +199,10 @@ impl Agent { ) } - /// Get agent version from executable path + /// Get agent version from Cargo package version fn get_agent_version(&self) -> String { - match std::env::current_exe() { - Ok(exe_path) => { - let exe_str = exe_path.to_string_lossy(); - - // Extract Nix store hash from path - if let Some(hash_part) = exe_str.strip_prefix("/nix/store/") { - if let Some(hash) = hash_part.split('-').next() { - if hash.len() >= 8 { - return hash[..8].to_string(); - } - } - } - - "unknown".to_string() - }, - Err(_) => "unknown".to_string() - } + // Use the version from Cargo.toml (e.g., "0.1.11") + format!("v{}", env!("CARGO_PKG_VERSION")) } async fn handle_commands(&mut self) -> Result<()> { diff --git a/dashboard/src/app.rs b/dashboard/src/app.rs index 477a73b..1423496 100644 --- a/dashboard/src/app.rs +++ b/dashboard/src/app.rs @@ -281,10 +281,7 @@ impl Dashboard { if let Some(ref mut tui_app) = self.tui_app { tui_app.add_terminal_output(&cmd_output.hostname, cmd_output.output_line); - // Close popup when command completes - if cmd_output.is_complete { - tui_app.close_terminal_popup(&cmd_output.hostname); - } + // Note: Popup stays open for manual review - close with ESC/Q } } diff --git a/dashboard/src/ui/mod.rs b/dashboard/src/ui/mod.rs index ec03f15..875f7da 100644 --- a/dashboard/src/ui/mod.rs +++ b/dashboard/src/ui/mod.rs @@ -226,7 +226,7 @@ impl TuiApp { // Add NixOS metrics - using exact matching for build display fix let nixos_metrics: Vec<&Metric> = all_metrics .iter() - .filter(|m| m.name == "system_nixos_build" || m.name == "system_active_users" || m.name == "system_agent_hash") + .filter(|m| m.name == "system_nixos_build" || m.name == "system_active_users" || m.name == "agent_version") .copied() .collect(); system_metrics.extend(nixos_metrics); diff --git a/dashboard/src/ui/widgets/system.rs b/dashboard/src/ui/widgets/system.rs index e3876c2..21ad226 100644 --- a/dashboard/src/ui/widgets/system.rs +++ b/dashboard/src/ui/widgets/system.rs @@ -427,25 +427,15 @@ impl SystemWidget { Span::styled(format!("Build: {}", build_text), Typography::secondary()) ])); - let config_text = self.config_hash.as_deref().unwrap_or("unknown"); + let agent_version_text = self.agent_hash.as_deref().unwrap_or("unknown"); lines.push(Line::from(vec![ - Span::styled(format!("Config: {}", config_text), Typography::secondary()) + Span::styled(format!("Agent: {}", agent_version_text), Typography::secondary()) ])); let users_text = self.active_users.as_deref().unwrap_or("unknown"); lines.push(Line::from(vec![ Span::styled(format!("Active users: {}", users_text), Typography::secondary()) ])); - - 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: {}", short_hash), Typography::secondary()) - ])); // CPU section lines.push(Line::from(vec![