Fix storage display parsing and improve title bar UI
All checks were successful
Build and Release / build-and-release (push) Successful in 1m14s

- Fix disk drive name extraction for mount points with underscores (e.g., /mnt/steampool)
- Replace confusing "1" and "2" drive names with proper device names like "sda1", "sda2"
- Update title bar with blue background and dark text styling
- Right-align host list in title bar while keeping "cm-dashboard" on left
- Bump version to v0.1.35
This commit is contained in:
2025-10-28 18:32:12 +01:00
parent 97aa1708c2
commit 1b964545be
6 changed files with 83 additions and 31 deletions

View File

@@ -536,48 +536,71 @@ impl TuiApp {
if self.available_hosts.is_empty() {
let title_text = "cm-dashboard • no hosts discovered";
let title = Paragraph::new(title_text).style(Typography::title());
let title = Paragraph::new(title_text)
.style(Style::default().fg(Theme::background()).bg(Theme::highlight()));
frame.render_widget(title, area);
return;
}
// Create spans for each host with status indicators
let mut spans = vec![Span::styled("cm-dashboard • ", Typography::title())];
// Split the title bar into left and right sections
let chunks = Layout::default()
.direction(Direction::Horizontal)
.constraints([Constraint::Min(0), Constraint::Min(0)])
.split(area);
// Left side: "cm-dashboard" text
let left_span = Span::styled(
"cm-dashboard",
Style::default().fg(Theme::background()).bg(Theme::highlight())
);
let left_title = Paragraph::new(Line::from(vec![left_span]))
.style(Style::default().bg(Theme::highlight()));
frame.render_widget(left_title, chunks[0]);
// Right side: hosts with status indicators
let mut host_spans = Vec::new();
for (i, host) in self.available_hosts.iter().enumerate() {
if i > 0 {
spans.push(Span::styled(" ", Typography::title()));
host_spans.push(Span::styled(
" ",
Style::default().fg(Theme::background()).bg(Theme::highlight())
));
}
// Always show normal status icon based on metrics (no command status at host level)
let host_status = self.calculate_host_status(host, metric_store);
let (status_icon, status_color) = (StatusIcons::get_icon(host_status), Theme::status_color(host_status));
let status_icon = StatusIcons::get_icon(host_status);
// Add status icon
spans.push(Span::styled(
// Add status icon with background color as foreground against blue background
host_spans.push(Span::styled(
format!("{} ", status_icon),
Style::default().fg(status_color),
Style::default().fg(Theme::background()).bg(Theme::highlight()),
));
if Some(host) == self.current_host.as_ref() {
// Selected host in bold bright white
spans.push(Span::styled(
// Selected host in bold background color against blue background
host_spans.push(Span::styled(
host.clone(),
Typography::title().add_modifier(Modifier::BOLD),
Style::default()
.fg(Theme::background())
.bg(Theme::highlight())
.add_modifier(Modifier::BOLD),
));
} else {
// Other hosts in normal style with status color
spans.push(Span::styled(
// Other hosts in normal background color against blue background
host_spans.push(Span::styled(
host.clone(),
Style::default().fg(status_color),
Style::default().fg(Theme::background()).bg(Theme::highlight()),
));
}
}
let title_line = Line::from(spans);
let title = Paragraph::new(vec![title_line]);
frame.render_widget(title, area);
let host_line = Line::from(host_spans);
let host_title = Paragraph::new(vec![host_line])
.style(Style::default().bg(Theme::highlight()))
.alignment(ratatui::layout::Alignment::Right);
frame.render_widget(host_title, chunks[1]);
}
/// Calculate overall status for a host based on its metrics