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
This commit is contained in:
2025-10-23 17:54:06 +02:00
parent c5ec529210
commit d0ce1726e8
3 changed files with 8 additions and 10 deletions

View File

@@ -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