Fix system panel layout and switch to version-based agent reporting
All checks were successful
Build and Release / build-and-release (push) Successful in 2m6s

- 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
This commit is contained in:
Christoffer Martinsson 2025-10-26 13:34:56 +01:00
parent bc94f75328
commit af52d49194
4 changed files with 7 additions and 35 deletions

View File

@ -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 { fn get_agent_version(&self) -> String {
match std::env::current_exe() { // Use the version from Cargo.toml (e.g., "0.1.11")
Ok(exe_path) => { format!("v{}", env!("CARGO_PKG_VERSION"))
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()
}
} }
async fn handle_commands(&mut self) -> Result<()> { async fn handle_commands(&mut self) -> Result<()> {

View File

@ -281,10 +281,7 @@ impl Dashboard {
if let Some(ref mut tui_app) = self.tui_app { if let Some(ref mut tui_app) = self.tui_app {
tui_app.add_terminal_output(&cmd_output.hostname, cmd_output.output_line); tui_app.add_terminal_output(&cmd_output.hostname, cmd_output.output_line);
// Close popup when command completes // Note: Popup stays open for manual review - close with ESC/Q
if cmd_output.is_complete {
tui_app.close_terminal_popup(&cmd_output.hostname);
}
} }
} }

View File

@ -226,7 +226,7 @@ impl TuiApp {
// Add NixOS metrics - using exact matching for build display fix // Add NixOS metrics - using exact matching for build display fix
let nixos_metrics: Vec<&Metric> = all_metrics let nixos_metrics: Vec<&Metric> = all_metrics
.iter() .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() .copied()
.collect(); .collect();
system_metrics.extend(nixos_metrics); system_metrics.extend(nixos_metrics);

View File

@ -427,25 +427,15 @@ impl SystemWidget {
Span::styled(format!("Build: {}", build_text), Typography::secondary()) 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![ 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"); let users_text = self.active_users.as_deref().unwrap_or("unknown");
lines.push(Line::from(vec![ lines.push(Line::from(vec![
Span::styled(format!("Active users: {}", users_text), Typography::secondary()) 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 // CPU section
lines.push(Line::from(vec![ lines.push(Line::from(vec![