Implement comprehensive dashboard improvements and maintenance mode

- Storage widget: Restructure with Name/Temp/Wear/Usage columns, SMART details as descriptions
- Host navigation: Only cycle through connected hosts, no disconnected hosts
- Auto-discovery: Skip config files, use predefined CMTEC host list
- Maintenance mode: Suppress notifications during backup via /tmp/cm-maintenance file
- CPU thresholds: Update to warning ≥9.0, critical ≥10.0 for production use
- Agent-dashboard separation: Agent provides descriptions, dashboard displays only
This commit is contained in:
2025-10-13 11:18:23 +02:00
parent bb69f0f31b
commit cd4764596f
5 changed files with 103 additions and 41 deletions

View File

@@ -469,16 +469,46 @@ impl App {
usize::try_from(samples.max(1)).unwrap_or(DEFAULT_CAPACITY)
}
fn connected_hosts(&self) -> Vec<&HostTarget> {
self.hosts
.iter()
.filter(|host| {
self.host_states
.get(&host.name)
.map(|state| state.last_success.is_some())
.unwrap_or(false)
})
.collect()
}
fn select_previous_host(&mut self) {
if self.hosts.is_empty() {
let connected = self.connected_hosts();
if connected.is_empty() {
return;
}
self.active_host_index = if self.active_host_index == 0 {
self.hosts.len().saturating_sub(1)
} else {
self.active_host_index - 1
};
// Find current host in connected list
let current_host = self.hosts.get(self.active_host_index);
if let Some(current) = current_host {
if let Some(current_pos) = connected.iter().position(|h| h.name == current.name) {
let new_pos = if current_pos == 0 {
connected.len().saturating_sub(1)
} else {
current_pos - 1
};
let new_host = connected[new_pos];
// Find this host's index in the full hosts list
if let Some(new_index) = self.hosts.iter().position(|h| h.name == new_host.name) {
self.active_host_index = new_index;
}
} else {
// Current host not connected, switch to first connected host
if let Some(new_index) = self.hosts.iter().position(|h| h.name == connected[0].name) {
self.active_host_index = new_index;
}
}
}
self.status = format!(
"Active host switched to {} ({}/{})",
self.hosts[self.active_host_index].name,
@@ -488,11 +518,29 @@ impl App {
}
fn select_next_host(&mut self) {
if self.hosts.is_empty() {
let connected = self.connected_hosts();
if connected.is_empty() {
return;
}
self.active_host_index = (self.active_host_index + 1) % self.hosts.len();
// Find current host in connected list
let current_host = self.hosts.get(self.active_host_index);
if let Some(current) = current_host {
if let Some(current_pos) = connected.iter().position(|h| h.name == current.name) {
let new_pos = (current_pos + 1) % connected.len();
let new_host = connected[new_pos];
// Find this host's index in the full hosts list
if let Some(new_index) = self.hosts.iter().position(|h| h.name == new_host.name) {
self.active_host_index = new_index;
}
} else {
// Current host not connected, switch to first connected host
if let Some(new_index) = self.hosts.iter().position(|h| h.name == connected[0].name) {
self.active_host_index = new_index;
}
}
}
self.status = format!(
"Active host switched to {} ({}/{})",
self.hosts[self.active_host_index].name,