From 72b3712d644e9f2edd9d115b736d4d7653b70d54 Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Sun, 11 Jun 2023 18:02:43 +0300 Subject: [PATCH] Refactor storage unit size display to use binary prefixes This commit updates the display of storage unit sizes in both the camera storage stats and the Storage component in the web UI to use binary prefixes (MiB and GiB) instead of decimal prefixes (MB and GB). This provides more accurate and consistent representation of storage sizes --- frigate/storage.py | 2 +- web/src/routes/Storage.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frigate/storage.py b/frigate/storage.py index c153b97f2..2511c2aa8 100644 --- a/frigate/storage.py +++ b/frigate/storage.py @@ -56,7 +56,7 @@ class StorageMaintainer(threading.Thread): bandwidth = 0 self.camera_storage_stats[camera]["bandwidth"] = bandwidth - logger.debug(f"{camera} has a bandwidth of {bandwidth} MB/hr.") + logger.debug(f"{camera} has a bandwidth of {bandwidth} MiB/hr.") def calculate_camera_usages(self) -> dict[str, dict]: """Calculate the storage usage of each camera.""" diff --git a/web/src/routes/Storage.jsx b/web/src/routes/Storage.jsx index dd7f969c7..71fde1668 100644 --- a/web/src/routes/Storage.jsx +++ b/web/src/routes/Storage.jsx @@ -26,9 +26,9 @@ export default function Storage() { const getUnitSize = (MB) => { if (isNaN(MB) || MB < 0) return 'Invalid number'; - if (MB < 1024) return `${MB} MB`; + if (MB < 1024) return `${MB} MiB`; - return `${(MB / 1024).toFixed(2)} GB`; + return `${(MB / 1024).toFixed(2)} GiB`; }; let storage_usage;