Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hassio/src/addon-view/hassio-addon-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class HassioAddonDashboard extends LitElement {
addonTabs.push({
name: "Documentation",
path: `/hassio/addon/${this.addon.slug}/documentation`,
icon: "mdi:text-box",
icon: "mdi:file-document",
});
}

Expand Down
7 changes: 3 additions & 4 deletions hassio/src/hassio-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { ProvideHassLitMixin } from "../../src/mixins/provide-hass-lit-mixin";
import "../../src/resources/ha-style";
import { HomeAssistant } from "../../src/types";
// Don't codesplit it, that way the dashboard always loads fast.
import "./hassio-pages-with-tabs";
import "./hassio-panel";

// The register callback of the IronA11yKeysBehavior inside paper-icon-button
// is not called, causing _keyBindings to be uninitiliazed for paper-icon-button,
Expand All @@ -55,7 +55,7 @@ class HassioMain extends ProvideHassLitMixin(HassRouterPage) {
showLoading: true,
routes: {
dashboard: {
tag: "hassio-pages-with-tabs",
tag: "hassio-panel",
cache: true,
},
snapshots: "dashboard",
Expand Down Expand Up @@ -132,8 +132,7 @@ class HassioMain extends ProvideHassLitMixin(HassRouterPage) {

protected updatePageEl(el) {
// the tabs page does its own routing so needs full route.
const route =
el.nodeName === "HASSIO-PAGES-WITH-TABS" ? this.route : this.routeTail;
const route = el.nodeName === "HASSIO-PANEL" ? this.route : this.routeTail;

if ("setProperties" in el) {
// As long as we have Polymer pages
Expand Down
141 changes: 0 additions & 141 deletions hassio/src/hassio-pages-with-tabs.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { PolymerElement } from "@polymer/polymer";
import { customElement, property } from "lit-element";
import { HassioHassOSInfo, HassioHostInfo } from "../../src/data/hassio/host";
import {
Expand All @@ -17,57 +16,46 @@ import "./dashboard/hassio-dashboard";
import "./snapshots/hassio-snapshots";
import "./system/hassio-system";

@customElement("hassio-tabs-router")
class HassioTabsRouter extends HassRouterPage {
@property() public hass!: HomeAssistant;
@customElement("hassio-panel-router")
class HassioPanelRouter extends HassRouterPage {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public supervisorInfo: HassioSupervisorInfo;
@property({ attribute: false }) public supervisorInfo: HassioSupervisorInfo;

@property() public hostInfo: HassioHostInfo;
@property({ attribute: false }) public hostInfo: HassioHostInfo;

@property() public hassInfo: HassioHomeAssistantInfo;
@property({ attribute: false }) public hassInfo: HassioHomeAssistantInfo;

@property() public hassOsInfo!: HassioHassOSInfo;
@property({ attribute: false }) public hassOsInfo!: HassioHassOSInfo;

protected routerOptions: RouterOptions = {
routes: {
dashboard: {
tag: "hassio-dashboard",
},
snapshots: {
tag: "hassio-snapshots",
},
store: {
tag: "hassio-addon-store",
},
snapshots: {
tag: "hassio-snapshots",
},
system: {
tag: "hassio-system",
},
},
};

protected updatePageEl(el) {
if ("setProperties" in el) {
// As long as we have Polymer pages
(el as PolymerElement).setProperties({
hass: this.hass,
supervisorInfo: this.supervisorInfo,
hostInfo: this.hostInfo,
hassInfo: this.hassInfo,
hassOsInfo: this.hassOsInfo,
});
} else {
el.hass = this.hass;
el.supervisorInfo = this.supervisorInfo;
el.hostInfo = this.hostInfo;
el.hassInfo = this.hassInfo;
el.hassOsInfo = this.hassOsInfo;
}
el.hass = this.hass;
el.supervisorInfo = this.supervisorInfo;
el.hostInfo = this.hostInfo;
el.hassInfo = this.hassInfo;
el.hassOsInfo = this.hassOsInfo;
}
}

declare global {
interface HTMLElementTagNameMap {
"hassio-tabs-router": HassioTabsRouter;
"hassio-panel-router": HassioPanelRouter;
}
}
85 changes: 85 additions & 0 deletions hassio/src/hassio-panel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import {
customElement,
html,
LitElement,
property,
TemplateResult,
} from "lit-element";

import { HassioHassOSInfo, HassioHostInfo } from "../../src/data/hassio/host";
import {
HassioHomeAssistantInfo,
HassioSupervisorInfo,
} from "../../src/data/hassio/supervisor";
import "../../src/resources/ha-style";
import { HomeAssistant, Route } from "../../src/types";
import "./hassio-panel-router";
import type { PageNavigation } from "../../src/layouts/hass-tabs-subpage";
import "../../src/layouts/hass-tabs-subpage";

@customElement("hassio-panel")
class HassioPanel extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property({ type: Boolean }) public narrow!: boolean;

@property({ attribute: false }) public route!: Route;

@property({ attribute: false }) public supervisorInfo!: HassioSupervisorInfo;

@property({ attribute: false }) public hostInfo!: HassioHostInfo;

@property({ attribute: false }) public hassInfo!: HassioHomeAssistantInfo;

@property({ attribute: false }) public hassOsInfo!: HassioHassOSInfo;

protected render(): TemplateResult {
const supervisorTabs: PageNavigation[] = [
{
name: "Dashboard",
path: `/hassio/dashboard`,
icon: "mdi:view-dashboard",
},
{
name: "Add-on store",
path: `/hassio/store`,
icon: "mdi:store",
},
{
name: "Snapshots",
path: `/hassio/snapshots`,
icon: "mdi:backup-restore",
},
{
name: "System",
path: `/hassio/system`,
icon: "mdi:cogs",
},
];

return html`
<hass-tabs-subpage
.hass=${this.hass}
.narrow=${this.narrow}
.route=${this.route}
.tabs=${supervisorTabs}
>
<span slot="header">Supervisor</span>
<hassio-panel-router
.route=${this.route}
.hass=${this.hass}
.supervisorInfo=${this.supervisorInfo}
.hostInfo=${this.hostInfo}
.hassInfo=${this.hassInfo}
.hassOsInfo=${this.hassOsInfo}
></hassio-panel-router>
</hass-tabs-subpage>
`;
}
}

declare global {
interface HTMLElementTagNameMap {
"hassio-panel": HassioPanel;
}
}