mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 20:36:35 +00:00
Fix hassio logs for core < 2024.11 (#22708)
This commit is contained in:
parent
9b9adf3c7a
commit
1e73cebda6
@ -185,6 +185,15 @@ export const fetchHassioInfo = async (
|
|||||||
export const fetchHassioBoots = async (hass: HomeAssistant) =>
|
export const fetchHassioBoots = async (hass: HomeAssistant) =>
|
||||||
hass.callApi<HassioResponse<HassioBoots>>("GET", `hassio/host/logs/boots`);
|
hass.callApi<HassioResponse<HassioBoots>>("GET", `hassio/host/logs/boots`);
|
||||||
|
|
||||||
|
export const fetchHassioLogsLegacy = async (
|
||||||
|
hass: HomeAssistant,
|
||||||
|
provider: string
|
||||||
|
) =>
|
||||||
|
hass.callApi<string>(
|
||||||
|
"GET",
|
||||||
|
`hassio/${provider.includes("_") ? `addons/${provider}` : provider}/logs`
|
||||||
|
);
|
||||||
|
|
||||||
export const fetchHassioLogs = async (
|
export const fetchHassioLogs = async (
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
provider: string,
|
provider: string,
|
||||||
|
@ -49,6 +49,7 @@ import {
|
|||||||
fetchHassioBoots,
|
fetchHassioBoots,
|
||||||
fetchHassioLogs,
|
fetchHassioLogs,
|
||||||
fetchHassioLogsFollow,
|
fetchHassioLogsFollow,
|
||||||
|
fetchHassioLogsLegacy,
|
||||||
getHassioLogDownloadLinesUrl,
|
getHassioLogDownloadLinesUrl,
|
||||||
getHassioLogDownloadUrl,
|
getHassioLogDownloadUrl,
|
||||||
} from "../../../data/hassio/supervisor";
|
} from "../../../data/hassio/supervisor";
|
||||||
@ -545,8 +546,7 @@ class ErrorLogCard extends LitElement {
|
|||||||
this._streamSupported = false;
|
this._streamSupported = false;
|
||||||
let logs = "";
|
let logs = "";
|
||||||
if (isComponentLoaded(this.hass, "hassio") && this.provider) {
|
if (isComponentLoaded(this.hass, "hassio") && this.provider) {
|
||||||
const repsonse = await fetchHassioLogs(this.hass, this.provider);
|
logs = await fetchHassioLogsLegacy(this.hass, this.provider);
|
||||||
logs = await repsonse.text();
|
|
||||||
} else {
|
} else {
|
||||||
logs = await fetchErrorLog(this.hass);
|
logs = await fetchErrorLog(this.hass);
|
||||||
}
|
}
|
||||||
|
@ -158,6 +158,7 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
|
|||||||
},
|
},
|
||||||
callApi: async (method, path, parameters, headers) =>
|
callApi: async (method, path, parameters, headers) =>
|
||||||
hassCallApi(auth, method, path, parameters, headers),
|
hassCallApi(auth, method, path, parameters, headers),
|
||||||
|
// callApiRaw introduced in 2024.11
|
||||||
callApiRaw: async (method, path, parameters, headers, signal) =>
|
callApiRaw: async (method, path, parameters, headers, signal) =>
|
||||||
hassCallApiRaw(auth, method, path, parameters, headers, signal),
|
hassCallApiRaw(auth, method, path, parameters, headers, signal),
|
||||||
fetchWithAuth: (
|
fetchWithAuth: (
|
||||||
|
@ -259,7 +259,7 @@ export interface HomeAssistant {
|
|||||||
parameters?: Record<string, any>,
|
parameters?: Record<string, any>,
|
||||||
headers?: Record<string, string>
|
headers?: Record<string, string>
|
||||||
): Promise<T>;
|
): Promise<T>;
|
||||||
callApiRaw(
|
callApiRaw( // introduced in 2024.11
|
||||||
method: "GET" | "POST" | "PUT" | "DELETE",
|
method: "GET" | "POST" | "PUT" | "DELETE",
|
||||||
path: string,
|
path: string,
|
||||||
parameters?: Record<string, any>,
|
parameters?: Record<string, any>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user