mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 12:26: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) =>
|
||||
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 (
|
||||
hass: HomeAssistant,
|
||||
provider: string,
|
||||
|
@ -49,6 +49,7 @@ import {
|
||||
fetchHassioBoots,
|
||||
fetchHassioLogs,
|
||||
fetchHassioLogsFollow,
|
||||
fetchHassioLogsLegacy,
|
||||
getHassioLogDownloadLinesUrl,
|
||||
getHassioLogDownloadUrl,
|
||||
} from "../../../data/hassio/supervisor";
|
||||
@ -545,8 +546,7 @@ class ErrorLogCard extends LitElement {
|
||||
this._streamSupported = false;
|
||||
let logs = "";
|
||||
if (isComponentLoaded(this.hass, "hassio") && this.provider) {
|
||||
const repsonse = await fetchHassioLogs(this.hass, this.provider);
|
||||
logs = await repsonse.text();
|
||||
logs = await fetchHassioLogsLegacy(this.hass, this.provider);
|
||||
} else {
|
||||
logs = await fetchErrorLog(this.hass);
|
||||
}
|
||||
|
@ -158,6 +158,7 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
|
||||
},
|
||||
callApi: async (method, path, parameters, headers) =>
|
||||
hassCallApi(auth, method, path, parameters, headers),
|
||||
// callApiRaw introduced in 2024.11
|
||||
callApiRaw: async (method, path, parameters, headers, signal) =>
|
||||
hassCallApiRaw(auth, method, path, parameters, headers, signal),
|
||||
fetchWithAuth: (
|
||||
|
@ -259,7 +259,7 @@ export interface HomeAssistant {
|
||||
parameters?: Record<string, any>,
|
||||
headers?: Record<string, string>
|
||||
): Promise<T>;
|
||||
callApiRaw(
|
||||
callApiRaw( // introduced in 2024.11
|
||||
method: "GET" | "POST" | "PUT" | "DELETE",
|
||||
path: string,
|
||||
parameters?: Record<string, any>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user