1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-04-17 23:54:28 +01:00

Show detailed storage space info (#26686)

* Storage space breakdown

* update mock data

* update format

* new format

* clean up

* fix

* remove useless if

* use ha-tooltip and styleMap

* fix hover
This commit is contained in:
Petar Petrov
2025-08-25 16:03:58 +03:00
committed by GitHub
parent 87fa05accc
commit 7110c0381f
5 changed files with 296 additions and 34 deletions

View File

@@ -44,6 +44,14 @@ export interface DatadiskList {
disks: Datadisk[];
}
export interface HostDisksUsage {
total_bytes?: number;
used_bytes: number;
id: string;
label: string;
children?: HostDisksUsage[];
}
export const fetchHassioHostInfo = async (
hass: HomeAssistant
): Promise<HassioHostInfo> => {
@@ -180,3 +188,20 @@ export const listDatadisks = async (
await hass.callApi<HassioResponse<DatadiskList>>("GET", "/os/datadisk/list")
);
};
export const fetchHostDisksUsage = async (hass: HomeAssistant) => {
if (atLeastVersion(hass.config.version, 2021, 2, 4)) {
return hass.callWS<HostDisksUsage>({
type: "supervisor/api",
endpoint: "/host/disks/default/usage",
method: "get",
});
}
return hassioApiResultExtractor(
await hass.callApi<HassioResponse<HostDisksUsage>>(
"GET",
"hassio/host/disks/default/usage"
)
);
};