diff --git a/AppImage/components/storage-overview.tsx b/AppImage/components/storage-overview.tsx index ff91781..c4f92e3 100644 --- a/AppImage/components/storage-overview.tsx +++ b/AppImage/components/storage-overview.tsx @@ -397,12 +397,33 @@ export function StorageOverview() { const diskHealthBreakdown = getDiskHealthBreakdown() const diskTypesBreakdown = getDiskTypesBreakdown() - // Using storageData.used from the backend in place of summing proxmox storages (avoids duplication in clusters) - const totalNodeUsed = storageData ? storageData.used : 0 // Already comes in GB from the backend - const totalNodeCapacity = storageData ? storageData.total * 1024 : 0 // Convert TB to GB + const totalProxmoxUsed = + proxmoxStorage?.storage + .filter( + (storage) => + storage && + storage.name && + storage.status === "active" && + storage.total > 0 && + storage.used >= 0 && + storage.available >= 0, + ) + .reduce((sum, storage) => sum + storage.used, 0) || 0 - const usagePercent = - storageData && storageData.total > 0 ? ((totalNodeUsed / totalNodeCapacity) * 100).toFixed(2) : "0.00" + const totalProxmoxCapacity = + proxmoxStorage?.storage + .filter( + (storage) => + storage && + storage.name && + storage.status === "active" && + storage.total > 0 && + storage.used >= 0 && + storage.available >= 0, + ) + .reduce((sum, storage) => sum + storage.total, 0) || 0 + + const usagePercent = totalProxmoxCapacity > 0 ? ((totalProxmoxUsed / totalProxmoxCapacity) * 100).toFixed(2) : "0.00" if (loading) { return ( @@ -441,8 +462,7 @@ export function StorageOverview() { - {/* Using totalNodeUsed that comes from the backend filtered by node */} - {formatStorage(totalNodeUsed)} + {formatStorage(totalProxmoxUsed)} {usagePercent}% used
{usagePercent}% used