From d1b0e2c431c13bd5eba32db9f25dfefa69014ae0 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Tue, 9 Dec 2025 19:51:03 +0100 Subject: [PATCH] Add kB unit support for backup repository sizes Extended size formatting to handle repositories smaller than 1MB by displaying in kB units. Size display logic now cascades: kB for < 1MB, MB for 1MB-1GB, GB for >= 1GB. --- agent/Cargo.toml | 2 +- dashboard/Cargo.toml | 2 +- dashboard/src/ui/widgets/system.rs | 6 ++++-- shared/Cargo.toml | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/agent/Cargo.toml b/agent/Cargo.toml index cf0728f..9afc766 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.268" +version = "0.1.269" edition = "2021" [dependencies] diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index 8bbcdcc..1a24351 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.268" +version = "0.1.269" edition = "2021" [dependencies] diff --git a/dashboard/src/ui/widgets/system.rs b/dashboard/src/ui/widgets/system.rs index 4b7d642..595487c 100644 --- a/dashboard/src/ui/widgets/system.rs +++ b/dashboard/src/ui/widgets/system.rs @@ -554,8 +554,10 @@ impl SystemWidget { for (idx, repo) in self.backup_repositories.iter().enumerate() { let tree_char = if idx == repo_count - 1 { "└─" } else { "├─" }; - // Format size: use MB for < 1GB, otherwise GB - let size_display = if repo.repo_size_gb < 1.0 { + // Format size: use kB for < 1MB, MB for < 1GB, otherwise GB + let size_display = if repo.repo_size_gb < 0.001 { + format!("{:.0}kB", repo.repo_size_gb * 1024.0 * 1024.0) + } else if repo.repo_size_gb < 1.0 { format!("{:.0}MB", repo.repo_size_gb * 1024.0) } else { format!("{:.1}GB", repo.repo_size_gb) diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 668ed24..9e9b0fb 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.268" +version = "0.1.269" edition = "2021" [dependencies]