Add version display and fix status aggregation priorities
All checks were successful
Build and Release / build-and-release (push) Successful in 2m37s
All checks were successful
Build and Release / build-and-release (push) Successful in 2m37s
- Add dynamic version display in top bar using CARGO_PKG_VERSION - Rewrite status aggregation to only show Critical/Warning/OK in top bar - Fix Status enum ordering to prioritize OK over transitional states - Remove blue/gray colors from top bar background
This commit is contained in:
parent
dc1a2e3a0f
commit
156d707377
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.96"
|
version = "0.1.97"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
@ -301,7 +301,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.96"
|
version = "0.1.97"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -324,7 +324,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.96"
|
version = "0.1.97"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.97"
|
version = "0.1.98"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.97"
|
version = "0.1.98"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -589,12 +589,13 @@ impl TuiApp {
|
|||||||
// Split the title bar into left and right sections
|
// Split the title bar into left and right sections
|
||||||
let chunks = Layout::default()
|
let chunks = Layout::default()
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.constraints([Constraint::Length(15), Constraint::Min(0)])
|
.constraints([Constraint::Length(22), Constraint::Min(0)])
|
||||||
.split(area);
|
.split(area);
|
||||||
|
|
||||||
// Left side: "cm-dashboard" text
|
// Left side: "cm-dashboard" text with version
|
||||||
|
let title_text = format!(" cm-dashboard v{}", env!("CARGO_PKG_VERSION"));
|
||||||
let left_span = Span::styled(
|
let left_span = Span::styled(
|
||||||
" cm-dashboard",
|
&title_text,
|
||||||
Style::default().fg(Theme::background()).bg(background_color).add_modifier(Modifier::BOLD)
|
Style::default().fg(Theme::background()).bg(background_color).add_modifier(Modifier::BOLD)
|
||||||
);
|
);
|
||||||
let left_title = Paragraph::new(Line::from(vec![left_span]))
|
let left_title = Paragraph::new(Line::from(vec![left_span]))
|
||||||
@ -666,32 +667,27 @@ impl TuiApp {
|
|||||||
return host_summary_metric.status;
|
return host_summary_metric.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback to old aggregation logic with proper Pending handling
|
// Rewritten status aggregation - only Critical, Warning, or OK for top bar
|
||||||
let mut has_critical = false;
|
let mut has_critical = false;
|
||||||
let mut has_warning = false;
|
let mut has_warning = false;
|
||||||
let mut ok_count = 0;
|
|
||||||
|
|
||||||
for metric in &metrics {
|
for metric in &metrics {
|
||||||
match metric.status {
|
match metric.status {
|
||||||
Status::Critical => has_critical = true,
|
Status::Critical => has_critical = true,
|
||||||
Status::Warning => has_warning = true,
|
Status::Warning => has_warning = true,
|
||||||
Status::Pending => ok_count += 1, // Treat pending as OK for aggregation
|
// Treat all other statuses as OK for top bar aggregation
|
||||||
Status::Ok => ok_count += 1,
|
Status::Ok | Status::Pending | Status::Inactive | Status::Unknown => {},
|
||||||
Status::Inactive => ok_count += 1, // Treat inactive as OK for aggregation
|
Status::Offline => {}, // Ignore offline
|
||||||
Status::Unknown => ok_count += 1, // Treat unknown as OK for aggregation
|
|
||||||
Status::Offline => {}, // Ignore offline for aggregation
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Priority order: Critical > Warning > Ok > Unknown (no Pending)
|
// Only return Critical, Warning, or OK - no other statuses
|
||||||
if has_critical {
|
if has_critical {
|
||||||
Status::Critical
|
Status::Critical
|
||||||
} else if has_warning {
|
} else if has_warning {
|
||||||
Status::Warning
|
Status::Warning
|
||||||
} else if ok_count > 0 {
|
|
||||||
Status::Ok
|
|
||||||
} else {
|
} else {
|
||||||
Status::Unknown
|
Status::Ok
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.97"
|
version = "0.1.98"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -82,13 +82,13 @@ impl MetricValue {
|
|||||||
/// Health status for metrics
|
/// Health status for metrics
|
||||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub enum Status {
|
pub enum Status {
|
||||||
Inactive, // Lowest priority - treated as good
|
Inactive, // Lowest priority
|
||||||
Ok, // Second lowest - also good
|
Unknown, //
|
||||||
Unknown,
|
Offline, //
|
||||||
Offline,
|
Pending, //
|
||||||
Pending,
|
Ok, // 5th place - good status has higher priority than unknown states
|
||||||
Warning,
|
Warning, //
|
||||||
Critical,
|
Critical, // Highest priority
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Status {
|
impl Status {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user