Show archive count range to detect inconsistencies
- Display single number if all services have same count - Display min-max range if counts differ (indicates problem)
This commit is contained in:
parent
1c1beddb55
commit
40f3ff66d8
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.216"
|
version = "0.1.217"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
@ -301,7 +301,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.216"
|
version = "0.1.217"
|
||||||
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.216"
|
version = "0.1.217"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
@ -142,12 +142,17 @@ impl BackupCollector {
|
|||||||
// Build service list for this disk
|
// Build service list for this disk
|
||||||
let services: Vec<String> = backup_status.services.keys().cloned().collect();
|
let services: Vec<String> = backup_status.services.keys().cloned().collect();
|
||||||
|
|
||||||
// Get archive count per service (use minimum to show if any service has fewer backups)
|
// Get min and max archive counts to detect inconsistencies
|
||||||
let total_archives: i64 = backup_status.services.values()
|
let archives_min: i64 = backup_status.services.values()
|
||||||
.map(|service| service.archive_count)
|
.map(|service| service.archive_count)
|
||||||
.min()
|
.min()
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
|
|
||||||
|
let archives_max: i64 = backup_status.services.values()
|
||||||
|
.map(|service| service.archive_count)
|
||||||
|
.max()
|
||||||
|
.unwrap_or(0);
|
||||||
|
|
||||||
// Create disk data
|
// Create disk data
|
||||||
let disk_data = BackupDiskData {
|
let disk_data = BackupDiskData {
|
||||||
serial: backup_status.disk_serial_number.unwrap_or_else(|| "Unknown".to_string()),
|
serial: backup_status.disk_serial_number.unwrap_or_else(|| "Unknown".to_string()),
|
||||||
@ -161,7 +166,8 @@ impl BackupCollector {
|
|||||||
disk_total_gb: total_gb,
|
disk_total_gb: total_gb,
|
||||||
usage_status,
|
usage_status,
|
||||||
services,
|
services,
|
||||||
total_archives,
|
archives_min,
|
||||||
|
archives_max,
|
||||||
};
|
};
|
||||||
|
|
||||||
disks.push(disk_data);
|
disks.push(disk_data);
|
||||||
|
|||||||
@ -566,9 +566,15 @@ impl SystemWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show usage with status and archive count
|
// Show usage with status and archive count
|
||||||
|
let archive_display = if disk.archives_min == disk.archives_max {
|
||||||
|
format!("{}", disk.archives_min)
|
||||||
|
} else {
|
||||||
|
format!("{}-{}", disk.archives_min, disk.archives_max)
|
||||||
|
};
|
||||||
|
|
||||||
let usage_text = format!(
|
let usage_text = format!(
|
||||||
"Usage: ({}) {:.0}% {:.0}GB/{:.0}GB",
|
"Usage: ({}) {:.0}% {:.0}GB/{:.0}GB",
|
||||||
disk.total_archives,
|
archive_display,
|
||||||
disk.disk_usage_percent,
|
disk.disk_usage_percent,
|
||||||
disk.disk_used_gb,
|
disk.disk_used_gb,
|
||||||
disk.disk_total_gb
|
disk.disk_total_gb
|
||||||
|
|||||||
@ -195,7 +195,8 @@ pub struct BackupDiskData {
|
|||||||
pub disk_total_gb: f32,
|
pub disk_total_gb: f32,
|
||||||
pub usage_status: Status,
|
pub usage_status: Status,
|
||||||
pub services: Vec<String>,
|
pub services: Vec<String>,
|
||||||
pub total_archives: i64,
|
pub archives_min: i64,
|
||||||
|
pub archives_max: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AgentData {
|
impl AgentData {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user