Add archive count to backup disk display

This commit is contained in:
Christoffer Martinsson 2025-11-29 17:41:11 +01:00
parent faa30a7839
commit f5913dbd43
4 changed files with 13 additions and 3 deletions

6
Cargo.lock generated
View File

@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
[[package]]
name = "cm-dashboard"
version = "0.1.213"
version = "0.1.214"
dependencies = [
"anyhow",
"chrono",
@ -301,7 +301,7 @@ dependencies = [
[[package]]
name = "cm-dashboard-agent"
version = "0.1.213"
version = "0.1.214"
dependencies = [
"anyhow",
"async-trait",
@ -324,7 +324,7 @@ dependencies = [
[[package]]
name = "cm-dashboard-shared"
version = "0.1.213"
version = "0.1.214"
dependencies = [
"chrono",
"serde",

View File

@ -142,6 +142,11 @@ impl BackupCollector {
// Build service list for this disk
let services: Vec<String> = backup_status.services.keys().cloned().collect();
// Calculate total archives across all services on this disk
let total_archives: i64 = backup_status.services.values()
.map(|service| service.archive_count)
.sum();
// Create disk data
let disk_data = BackupDiskData {
serial: backup_status.disk_serial_number.unwrap_or_else(|| "Unknown".to_string()),
@ -155,6 +160,7 @@ impl BackupCollector {
disk_total_gb: total_gb,
usage_status,
services,
total_archives,
};
disks.push(disk_data);

View File

@ -544,6 +544,9 @@ impl SystemWidget {
details.push(format!("W: {}%", wear as i32));
}
// Add archive count
details.push(format!("Archives: {}", disk.total_archives));
let disk_text = if !details.is_empty() {
format!("{} {}", truncated_serial, details.join(" "))
} else {

View File

@ -195,6 +195,7 @@ pub struct BackupDiskData {
pub disk_total_gb: f32,
pub usage_status: Status,
pub services: Vec<String>,
pub total_archives: i64,
}
impl AgentData {