mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-02 14:07:55 +00:00
Don't initialize supervisor object for ingress
This commit is contained in:
parent
38640c99e3
commit
ed6b54e5c6
@ -61,10 +61,11 @@ class HassioRouter extends HassRouterPage {
|
|||||||
el.hass = this.hass;
|
el.hass = this.hass;
|
||||||
el.narrow = this.narrow;
|
el.narrow = this.narrow;
|
||||||
el.route = route;
|
el.route = route;
|
||||||
el.supervisor = this.supervisor;
|
|
||||||
|
|
||||||
if (el.localName === "hassio-ingress-view") {
|
if (el.localName === "hassio-ingress-view") {
|
||||||
el.ingressPanel = this.panel.config && this.panel.config.ingress;
|
el.ingressPanel = this.panel.config && this.panel.config.ingress;
|
||||||
|
} else {
|
||||||
|
el.supervisor = this.supervisor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ import {
|
|||||||
createHassioSession,
|
createHassioSession,
|
||||||
validateHassioSession,
|
validateHassioSession,
|
||||||
} from "../../../src/data/hassio/ingress";
|
} from "../../../src/data/hassio/ingress";
|
||||||
import { Supervisor } from "../../../src/data/supervisor/supervisor";
|
|
||||||
import { showAlertDialog } from "../../../src/dialogs/generic/show-dialog-box";
|
import { showAlertDialog } from "../../../src/dialogs/generic/show-dialog-box";
|
||||||
import "../../../src/layouts/hass-loading-screen";
|
import "../../../src/layouts/hass-loading-screen";
|
||||||
import "../../../src/layouts/hass-subpage";
|
import "../../../src/layouts/hass-subpage";
|
||||||
@ -31,11 +30,9 @@ import { HomeAssistant, Route } from "../../../src/types";
|
|||||||
class HassioIngressView extends LitElement {
|
class HassioIngressView extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property({ attribute: false }) public supervisor!: Supervisor;
|
@property({ attribute: false }) public route!: Route;
|
||||||
|
|
||||||
@property() public route!: Route;
|
@property({ type: Boolean }) public ingressPanel = false;
|
||||||
|
|
||||||
@property() public ingressPanel = false;
|
|
||||||
|
|
||||||
@state() private _addon?: HassioAddonDetails;
|
@state() private _addon?: HassioAddonDetails;
|
||||||
|
|
||||||
@ -102,14 +99,14 @@ class HassioIngressView extends LitElement {
|
|||||||
}
|
}
|
||||||
if (!addonInfo.version) {
|
if (!addonInfo.version) {
|
||||||
await showAlertDialog(this, {
|
await showAlertDialog(this, {
|
||||||
text: this.supervisor.localize("my.error_addon_not_installed"),
|
text: this.hass.localize("supervisor.my.error_addon_not_installed"),
|
||||||
title: addonInfo.name,
|
title: addonInfo.name,
|
||||||
});
|
});
|
||||||
await nextRender();
|
await nextRender();
|
||||||
navigate(`/hassio/addon/${addonInfo.slug}/info`, { replace: true });
|
navigate(`/hassio/addon/${addonInfo.slug}/info`, { replace: true });
|
||||||
} else if (!addonInfo.ingress) {
|
} else if (!addonInfo.ingress) {
|
||||||
await showAlertDialog(this, {
|
await showAlertDialog(this, {
|
||||||
text: this.supervisor.localize("my.error_addon_no_ingress"),
|
text: this.hass.localize("supervisor.my.error_addon_no_ingress"),
|
||||||
title: addonInfo.name,
|
title: addonInfo.name,
|
||||||
});
|
});
|
||||||
await nextRender();
|
await nextRender();
|
||||||
|
@ -15,6 +15,7 @@ import {
|
|||||||
fetchHassioHomeAssistantInfo,
|
fetchHassioHomeAssistantInfo,
|
||||||
fetchHassioInfo,
|
fetchHassioInfo,
|
||||||
fetchHassioSupervisorInfo,
|
fetchHassioSupervisorInfo,
|
||||||
|
HassioPanelInfo,
|
||||||
} from "../../src/data/hassio/supervisor";
|
} from "../../src/data/hassio/supervisor";
|
||||||
import { fetchSupervisorStore } from "../../src/data/supervisor/store";
|
import { fetchSupervisorStore } from "../../src/data/supervisor/store";
|
||||||
import {
|
import {
|
||||||
@ -25,7 +26,7 @@ import {
|
|||||||
} from "../../src/data/supervisor/supervisor";
|
} from "../../src/data/supervisor/supervisor";
|
||||||
import { ProvideHassLitMixin } from "../../src/mixins/provide-hass-lit-mixin";
|
import { ProvideHassLitMixin } from "../../src/mixins/provide-hass-lit-mixin";
|
||||||
import { urlSyncMixin } from "../../src/state/url-sync-mixin";
|
import { urlSyncMixin } from "../../src/state/url-sync-mixin";
|
||||||
import { HomeAssistant } from "../../src/types";
|
import { HomeAssistant, Route } from "../../src/types";
|
||||||
import { getTranslation } from "../../src/util/common-translation";
|
import { getTranslation } from "../../src/util/common-translation";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
@ -42,6 +43,10 @@ export class SupervisorBaseElement extends urlSyncMixin(
|
|||||||
localize: () => "",
|
localize: () => "",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@property({ attribute: false }) public panel!: HassioPanelInfo;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public route?: Route;
|
||||||
|
|
||||||
@state() private _unsubs: Record<string, UnsubscribeFunc> = {};
|
@state() private _unsubs: Record<string, UnsubscribeFunc> = {};
|
||||||
|
|
||||||
@state() private _collections: Record<string, Collection<unknown>> = {};
|
@state() private _collections: Record<string, Collection<unknown>> = {};
|
||||||
@ -110,7 +115,12 @@ export class SupervisorBaseElement extends urlSyncMixin(
|
|||||||
this._language = this.hass.language;
|
this._language = this.hass.language;
|
||||||
}
|
}
|
||||||
this._initializeLocalize();
|
this._initializeLocalize();
|
||||||
this._initSupervisor();
|
if (
|
||||||
|
!(this.panel.config && "ingress" in this.panel.config) &&
|
||||||
|
this.route?.path !== "/ingress"
|
||||||
|
) {
|
||||||
|
this._initSupervisor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _initializeLocalize() {
|
private async _initializeLocalize() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user