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

View File

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

View File

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

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