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
This commit is contained in:
Sergey Krashevich 2023-06-11 18:02:43 +03:00
parent 5116f92c21
commit 72b3712d64
No known key found for this signature in database
GPG Key ID: 625171324E7D3856
2 changed files with 3 additions and 3 deletions

View File

@ -56,7 +56,7 @@ class StorageMaintainer(threading.Thread):
bandwidth = 0 bandwidth = 0
self.camera_storage_stats[camera]["bandwidth"] = bandwidth 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]: def calculate_camera_usages(self) -> dict[str, dict]:
"""Calculate the storage usage of each camera.""" """Calculate the storage usage of each camera."""

View File

@ -26,9 +26,9 @@ export default function Storage() {
const getUnitSize = (MB) => { const getUnitSize = (MB) => {
if (isNaN(MB) || MB < 0) return 'Invalid number'; 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; let storage_usage;