mirror of
https://github.com/home-assistant/frontend.git
synced 2026-02-14 23:18:21 +00:00
Fix storage space calculations to account for reserved system space (#29540)
This commit is contained in:
@@ -87,7 +87,9 @@ class HaConfigSystemNavigation extends LitElement {
|
||||
description = this._storageInfo
|
||||
? this.hass.localize("ui.panel.config.storage.description", {
|
||||
percent_used: `${Math.round(
|
||||
(this._storageInfo.used / this._storageInfo.total) * 100
|
||||
((this._storageInfo.total - this._storageInfo.free) /
|
||||
this._storageInfo.total) *
|
||||
100
|
||||
)}${blankBeforePercent(this.hass.locale)}%`,
|
||||
free_space: `${this._storageInfo.free} GB`,
|
||||
})
|
||||
|
||||
@@ -105,9 +105,11 @@ export class StorageBreakdownChart extends LitElement {
|
||||
storageInfo: HostDisksUsage | null | undefined
|
||||
) => {
|
||||
let totalSpaceGB = hostInfo.disk_total;
|
||||
let usedSpaceGB = hostInfo.disk_used;
|
||||
let freeSpaceGB =
|
||||
hostInfo.disk_free || hostInfo.disk_total - hostInfo.disk_used;
|
||||
// hostInfo.disk_used doesn't include system reserved space,
|
||||
// so we calculate used space based on total and free space
|
||||
let usedSpaceGB = totalSpaceGB - freeSpaceGB;
|
||||
|
||||
if (storageInfo) {
|
||||
const totalSpace =
|
||||
|
||||
Reference in New Issue
Block a user