Optimise supervisor entrypoint (#16379)

This commit is contained in:
Bram Kragten 2023-05-02 20:45:35 +02:00 committed by GitHub
parent d6382e59c6
commit a6e71f4c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -9,7 +9,6 @@ import { haStyle } from "../../../src/resources/styles";
import { HomeAssistant, Route } from "../../../src/types"; import { HomeAssistant, Route } from "../../../src/types";
import { supervisorTabs } from "../hassio-tabs"; import { supervisorTabs } from "../hassio-tabs";
import "./hassio-addons"; import "./hassio-addons";
import "./hassio-update";
import "../../../src/layouts/hass-subpage"; import "../../../src/layouts/hass-subpage";
@customElement("hassio-dashboard") @customElement("hassio-dashboard")
@ -22,6 +21,12 @@ class HassioDashboard extends LitElement {
@property({ attribute: false }) public route!: Route; @property({ attribute: false }) public route!: Route;
firstUpdated() {
if (!atLeastVersion(this.hass.config.version, 2022, 5)) {
import("./hassio-update");
}
}
protected render(): TemplateResult { protected render(): TemplateResult {
if (atLeastVersion(this.hass.config.version, 2022, 5)) { if (atLeastVersion(this.hass.config.version, 2022, 5)) {
return html`<hass-subpage return html`<hass-subpage
@ -44,7 +49,7 @@ class HassioDashboard extends LitElement {
<ha-svg-icon <ha-svg-icon
slot="icon" slot="icon"
.path=${mdiStorePlus} .path=${mdiStorePlus}
></ha-svg-icon> </ha-fab ></ha-svg-icon></ha-fab
></a> ></a>
</hass-subpage>`; </hass-subpage>`;
} }

View File

@ -5,12 +5,8 @@ import {
RouterOptions, RouterOptions,
} from "../../src/layouts/hass-router-page"; } from "../../src/layouts/hass-router-page";
import { HomeAssistant, Route } from "../../src/types"; import { HomeAssistant, Route } from "../../src/types";
import "./addon-store/hassio-addon-store";
// Don't codesplit it, that way the dashboard always loads fast. // Don't codesplit it, that way the dashboard always loads fast.
import "./dashboard/hassio-dashboard"; import "./dashboard/hassio-dashboard";
// Don't codesplit the others, because it breaks the UI when pushed to a Pi
import "./backups/hassio-backups";
import "./system/hassio-system";
@customElement("hassio-panel-router") @customElement("hassio-panel-router")
class HassioPanelRouter extends HassRouterPage { class HassioPanelRouter extends HassRouterPage {
@ -31,12 +27,15 @@ class HassioPanelRouter extends HassRouterPage {
}, },
store: { store: {
tag: "hassio-addon-store", tag: "hassio-addon-store",
load: () => import("./addon-store/hassio-addon-store"),
}, },
backups: { backups: {
tag: "hassio-backups", tag: "hassio-backups",
load: () => import("./backups/hassio-backups"),
}, },
system: { system: {
tag: "hassio-system", tag: "hassio-system",
load: () => import("./system/hassio-system"),
}, },
}, },
}; };