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:
@@ -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"
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user