@@ -496,14 +499,14 @@ class HaConfigEntityRegistry extends LitElement {
}
h2 {
margin-top: 0;
- font-family: var(--paper-font-display1_-_font-family);
+ font-family: var(--paper-font-headline_-_font-family);
-webkit-font-smoothing: var(
- --paper-font-display1_-_-webkit-font-smoothing
+ --paper-font-headline_-_-webkit-font-smoothing
);
- font-size: var(--paper-font-display1_-_font-size);
- font-weight: var(--paper-font-display1_-_font-weight);
- letter-spacing: var(--paper-font-display1_-_letter-spacing);
- line-height: var(--paper-font-display1_-_line-height);
+ font-size: var(--paper-font-headline_-_font-size);
+ font-weight: var(--paper-font-headline_-_font-weight);
+ letter-spacing: var(--paper-font-headline_-_letter-spacing);
+ line-height: var(--paper-font-headline_-_line-height);
opacity: var(--dark-primary-opacity);
}
p {
@@ -511,10 +514,8 @@ class HaConfigEntityRegistry extends LitElement {
-webkit-font-smoothing: var(
--paper-font-subhead_-_-webkit-font-smoothing
);
- font-size: var(--paper-font-subhead_-_font-size);
font-weight: var(--paper-font-subhead_-_font-weight);
line-height: var(--paper-font-subhead_-_line-height);
- opacity: var(--dark-primary-opacity);
}
.intro {
padding: 24px 16px;
@@ -549,5 +550,3 @@ class HaConfigEntityRegistry extends LitElement {
`;
}
}
-
-customElements.define("ha-config-entity-registry", HaConfigEntityRegistry);
diff --git a/src/panels/config/entity_registry/show-dialog-entity-registry-detail.ts b/src/panels/config/entities/show-dialog-entity-registry-detail.ts
similarity index 100%
rename from src/panels/config/entity_registry/show-dialog-entity-registry-detail.ts
rename to src/panels/config/entities/show-dialog-entity-registry-detail.ts
diff --git a/src/panels/config/ha-config-router.ts b/src/panels/config/ha-config-router.ts
new file mode 100644
index 0000000000..81f5ab3f53
--- /dev/null
+++ b/src/panels/config/ha-config-router.ts
@@ -0,0 +1,170 @@
+import { property, customElement } from "lit-element";
+import "../../layouts/hass-loading-screen";
+import { HomeAssistant } from "../../types";
+import { CloudStatus } from "../../data/cloud";
+import { HassRouterPage, RouterOptions } from "../../layouts/hass-router-page";
+import { PolymerElement } from "@polymer/polymer";
+
+declare global {
+ // for fire event
+ interface HASSDomEvents {
+ "ha-refresh-cloud-status": undefined;
+ }
+}
+
+@customElement("ha-config-router")
+class HaConfigRouter extends HassRouterPage {
+ @property() public hass!: HomeAssistant;
+ @property() public narrow!: boolean;
+ @property() public wideSidebar: boolean = false;
+ @property() public wide: boolean = false;
+ @property() public isWide: boolean = false;
+ @property() public showAdvanced: boolean = false;
+ @property() public cloudStatus?: CloudStatus;
+
+ protected routerOptions: RouterOptions = {
+ defaultPage: "dashboard",
+ cacheAll: true,
+ preloadAll: true,
+ routes: {
+ areas: {
+ tag: "ha-config-areas",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-areas" */ "./areas/ha-config-areas"
+ ),
+ },
+ automation: {
+ tag: "ha-config-automation",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-automation" */ "./automation/ha-config-automation"
+ ),
+ },
+ cloud: {
+ tag: "ha-config-cloud",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-cloud" */ "./cloud/ha-config-cloud"
+ ),
+ },
+ core: {
+ tag: "ha-config-core",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-core" */ "./core/ha-config-core"
+ ),
+ },
+ devices: {
+ tag: "ha-config-devices",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-devices" */ "./devices/ha-config-devices"
+ ),
+ },
+ server_control: {
+ tag: "ha-config-server-control",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-server-control" */ "./server_control/ha-config-server-control"
+ ),
+ },
+ customize: {
+ tag: "ha-config-customize",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-customize" */ "./customize/ha-config-customize"
+ ),
+ },
+ dashboard: {
+ tag: "ha-config-dashboard",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-dashboard" */ "./dashboard/ha-config-dashboard"
+ ),
+ },
+ entities: {
+ tag: "ha-config-entities",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-entities" */ "./entities/ha-config-entities"
+ ),
+ },
+ integrations: {
+ tag: "ha-config-integrations",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-integrations" */ "./integrations/ha-config-integrations"
+ ),
+ },
+ person: {
+ tag: "ha-config-person",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-person" */ "./person/ha-config-person"
+ ),
+ },
+ script: {
+ tag: "ha-config-script",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-script" */ "./script/ha-config-script"
+ ),
+ },
+ scene: {
+ tag: "ha-config-scene",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-scene" */ "./scene/ha-config-scene"
+ ),
+ },
+ users: {
+ tag: "ha-config-users",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-users" */ "./users/ha-config-users"
+ ),
+ },
+ zha: {
+ tag: "zha-config-dashboard-router",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-zha" */ "./zha/zha-config-dashboard-router"
+ ),
+ },
+ zwave: {
+ tag: "ha-config-zwave",
+ load: () =>
+ import(
+ /* webpackChunkName: "panel-config-zwave" */ "./zwave/ha-config-zwave"
+ ),
+ },
+ },
+ };
+ protected updatePageEl(el) {
+ if ("setProperties" in el) {
+ // As long as we have Polymer panels
+ (el as PolymerElement).setProperties({
+ route: this.routeTail,
+ hass: this.hass,
+ showAdvanced: this.showAdvanced,
+ isWide: this.isWide,
+ narrow: this.narrow,
+ cloudStatus: this.cloudStatus,
+ });
+ } else {
+ el.route = this.routeTail;
+ el.hass = this.hass;
+ el.showAdvanced = this.showAdvanced;
+ el.isWide = this.isWide;
+ el.narrow = this.narrow;
+ el.cloudStatus = this.cloudStatus;
+ }
+ }
+}
+
+declare global {
+ interface HTMLElementTagNameMap {
+ "ha-config-router": HaConfigRouter;
+ }
+}
diff --git a/src/panels/config/ha-config-section.js b/src/panels/config/ha-config-section.js
deleted file mode 100644
index 800eda13c8..0000000000
--- a/src/panels/config/ha-config-section.js
+++ /dev/null
@@ -1,98 +0,0 @@
-import { html } from "@polymer/polymer/lib/utils/html-tag";
-import { PolymerElement } from "@polymer/polymer/polymer-element";
-
-import "../../resources/ha-style";
-
-class HaConfigSection extends PolymerElement {
- static get template() {
- return html`
-
-
- `;
- }
-
- static get properties() {
- return {
- hass: {
- type: Object,
- },
-
- narrow: {
- type: Boolean,
- },
-
- isWide: {
- type: Boolean,
- value: false,
- },
- };
- }
-
- computeContentClasses(isWide) {
- var classes = "content ";
-
- return isWide ? classes : classes + "narrow";
- }
-
- computeClasses(isWide) {
- var classes = "together layout ";
-
- return classes + (isWide ? "horizontal" : "vertical narrow");
- }
-}
-
-customElements.define("ha-config-section", HaConfigSection);
diff --git a/src/panels/config/ha-config-section.ts b/src/panels/config/ha-config-section.ts
new file mode 100644
index 0000000000..802bd65128
--- /dev/null
+++ b/src/panels/config/ha-config-section.ts
@@ -0,0 +1,65 @@
+import { customElement } from "lit-element";
+
+@customElement("ha-config-section")
+export class HaConfigSection extends HTMLElement {
+ constructor() {
+ super();
+ this.attachShadow({ mode: "open" });
+ this.shadowRoot!.innerHTML = `
+
+
+ `;
+ }
+}
diff --git a/src/panels/config/ha-panel-config.ts b/src/panels/config/ha-panel-config.ts
index 213977a577..377b5f406f 100644
--- a/src/panels/config/ha-panel-config.ts
+++ b/src/panels/config/ha-panel-config.ts
@@ -1,15 +1,26 @@
-import { property, PropertyValues, customElement } from "lit-element";
+import {
+ property,
+ PropertyValues,
+ customElement,
+ LitElement,
+ html,
+ CSSResult,
+ css,
+} from "lit-element";
+import "@polymer/paper-item/paper-item-body";
+import "@polymer/paper-item/paper-item";
import "../../layouts/hass-loading-screen";
import { isComponentLoaded } from "../../common/config/is_component_loaded";
-import { HomeAssistant } from "../../types";
+import { HomeAssistant, Route } from "../../types";
import { CloudStatus, fetchCloudStatus } from "../../data/cloud";
import { listenMediaQuery } from "../../common/dom/media_query";
-import { HassRouterPage, RouterOptions } from "../../layouts/hass-router-page";
import {
- CoreFrontendUserData,
getOptimisticFrontendUserDataCollection,
+ CoreFrontendUserData,
} from "../../data/frontend";
-import { PolymerElement } from "@polymer/polymer";
+import "./ha-config-router";
+import "./dashboard/ha-config-navigation";
+import { classMap } from "lit-html/directives/class-map";
declare global {
// for fire event
@@ -19,133 +30,15 @@ declare global {
}
@customElement("ha-panel-config")
-class HaPanelConfig extends HassRouterPage {
+class HaPanelConfig extends LitElement {
@property() public hass!: HomeAssistant;
@property() public narrow!: boolean;
-
- protected routerOptions: RouterOptions = {
- defaultPage: "dashboard",
- cacheAll: true,
- preloadAll: true,
- routes: {
- area_registry: {
- tag: "ha-config-area-registry",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-area-registry" */ "./area_registry/ha-config-area-registry"
- ),
- },
- automation: {
- tag: "ha-config-automation",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-automation" */ "./automation/ha-config-automation"
- ),
- },
- cloud: {
- tag: "ha-config-cloud",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-cloud" */ "./cloud/ha-config-cloud"
- ),
- },
- core: {
- tag: "ha-config-core",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-core" */ "./core/ha-config-core"
- ),
- },
- devices: {
- tag: "ha-config-devices",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-devices" */ "./devices/ha-config-devices"
- ),
- },
- server_control: {
- tag: "ha-config-server-control",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-server-control" */ "./server_control/ha-config-server-control"
- ),
- },
- customize: {
- tag: "ha-config-customize",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-customize" */ "./customize/ha-config-customize"
- ),
- },
- dashboard: {
- tag: "ha-config-dashboard",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-dashboard" */ "./dashboard/ha-config-dashboard"
- ),
- },
- entity_registry: {
- tag: "ha-config-entity-registry",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-entity-registry" */ "./entity_registry/ha-config-entity-registry"
- ),
- },
- integrations: {
- tag: "ha-config-integrations",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-integrations" */ "./integrations/ha-config-integrations"
- ),
- },
- person: {
- tag: "ha-config-person",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-person" */ "./person/ha-config-person"
- ),
- },
- script: {
- tag: "ha-config-script",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-script" */ "./script/ha-config-script"
- ),
- },
- scene: {
- tag: "ha-config-scene",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-scene" */ "./scene/ha-config-scene"
- ),
- },
- users: {
- tag: "ha-config-users",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-users" */ "./users/ha-config-users"
- ),
- },
- zha: {
- tag: "zha-config-dashboard-router",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-zha" */ "./zha/zha-config-dashboard-router"
- ),
- },
- zwave: {
- tag: "ha-config-zwave",
- load: () =>
- import(
- /* webpackChunkName: "panel-config-zwave" */ "./zwave/ha-config-zwave"
- ),
- },
- },
- };
+ @property() public route!: Route;
@property() private _wideSidebar: boolean = false;
@property() private _wide: boolean = false;
@property() private _coreUserData?: CoreFrontendUserData;
+ @property() private _showAdvanced = false;
@property() private _cloudStatus?: CloudStatus;
private _listeners: Array<() => void> = [];
@@ -168,6 +61,9 @@ class HaPanelConfig extends HassRouterPage {
"core"
).subscribe((coreUserData) => {
this._coreUserData = coreUserData || {};
+ this._showAdvanced = !!(
+ this._coreUserData && this._coreUserData.showAdvanced
+ );
})
);
}
@@ -189,31 +85,60 @@ class HaPanelConfig extends HassRouterPage {
);
}
- protected updatePageEl(el) {
- const showAdvanced = !!(
- this._coreUserData && this._coreUserData.showAdvanced
- );
+ protected render() {
+ const dividerPos = this.route.path.indexOf("/", 1);
+ const curPage =
+ dividerPos === -1
+ ? this.route.path.substr(1)
+ : this.route.path.substr(1, dividerPos - 1);
+
const isWide =
this.hass.dockedSidebar === "docked" ? this._wideSidebar : this._wide;
- if ("setProperties" in el) {
- // As long as we have Polymer panels
- (el as PolymerElement).setProperties({
- route: this.routeTail,
- hass: this.hass,
- showAdvanced,
- isWide,
- narrow: this.narrow,
- cloudStatus: this._cloudStatus,
- });
- } else {
- el.route = this.routeTail;
- el.hass = this.hass;
- el.showAdvanced = showAdvanced;
- el.isWide = isWide;
- el.narrow = this.narrow;
- el.cloudStatus = this._cloudStatus;
- }
+ return html`
+ ${isWide
+ ? html`
+
+ `
+ : ""}
+
+ `;
}
private async _updateCloudStatus() {
@@ -223,6 +148,54 @@ class HaPanelConfig extends HassRouterPage {
setTimeout(() => this._updateCloudStatus(), 5000);
}
}
+
+ static get styles(): CSSResult {
+ return css`
+ :host {
+ display: block;
+ height: 100%;
+ background-color: var(--primary-background-color);
+ }
+
+ a {
+ text-decoration: none;
+ color: var(--primary-text-color);
+ }
+
+ .side-bar {
+ border-right: 1px solid #e0e0e0;
+ background: white;
+ width: 320px;
+ float: left;
+ box-sizing: border-box;
+ position: fixed;
+ }
+
+ .toolbar {
+ display: flex;
+ align-items: center;
+ font-size: 20px;
+ height: 64px;
+ padding: 0 16px 0 16px;
+ pointer-events: none;
+ background-color: var(--primary-background-color);
+ font-weight: 400;
+ color: var(--primary-text-color);
+ border-bottom: 1px solid var(--divider-color);
+ }
+
+ .wide-config {
+ float: right;
+ width: calc(100% - 320px);
+ height: 100%;
+ }
+
+ .navigation {
+ height: calc(100vh - 64px);
+ overflow: auto;
+ }
+ `;
+ }
}
declare global {
diff --git a/src/panels/config/integrations/ha-config-entries-dashboard.ts b/src/panels/config/integrations/ha-config-entries-dashboard.ts
index 3c7f4c3370..d4d4091c5a 100644
--- a/src/panels/config/integrations/ha-config-entries-dashboard.ts
+++ b/src/panels/config/integrations/ha-config-entries-dashboard.ts
@@ -49,6 +49,7 @@ import { showConfirmationDialog } from "../../../dialogs/confirmation/show-dialo
export class HaConfigManagerDashboard extends LitElement {
@property() public hass!: HomeAssistant;
@property() public showAdvanced!: boolean;
+ @property() public isWide!: boolean;
@property() private configEntries!: ConfigEntry[];
@@ -72,7 +73,8 @@ export class HaConfigManagerDashboard extends LitElement {
protected render(): TemplateResult {
return html`
+
${hass.localize("ui.panel.config.person.caption")}
-
+
${this.hass.localize("ui.panel.config.scene.picker.header")}
diff --git a/src/panels/config/scene/ha-scene-editor.ts b/src/panels/config/scene/ha-scene-editor.ts
index a1407ee4f6..9e1e232a72 100644
--- a/src/panels/config/scene/ha-scene-editor.ts
+++ b/src/panels/config/scene/ha-scene-editor.ts
@@ -69,7 +69,7 @@ interface DeviceEntitiesLookup {
@customElement("ha-scene-editor")
export class HaSceneEditor extends SubscribeMixin(LitElement) {
@property() public hass!: HomeAssistant;
- @property() public narrow?: boolean;
+ @property() public isWide?: boolean;
@property() public scene?: SceneEntity;
@property() public creatingNew?: boolean;
@property() public showAdvanced!: boolean;
@@ -196,7 +196,7 @@ export class HaSceneEditor extends SubscribeMixin(LitElement) {
rtl: computeRTL(this.hass),
})}"
>
-
+
${this.scene
? computeStateName(this.scene)
@@ -222,7 +222,7 @@ export class HaSceneEditor extends SubscribeMixin(LitElement) {
-
+
${this.hass.localize(
"ui.panel.config.scene.editor.devices.header"
@@ -293,7 +293,7 @@ export class HaSceneEditor extends SubscribeMixin(LitElement) {
${this.showAdvanced
? html`
-
+
${this.hass.localize(
"ui.panel.config.scene.editor.entities.header"
@@ -371,7 +371,7 @@ export class HaSceneEditor extends SubscribeMixin(LitElement) {
@@ -77,7 +78,7 @@ class HaScriptPicker extends LitElement {
)}"
@click=${this._runScript}
>
-
+
${computeStateName(script)}
diff --git a/src/panels/config/server_control/ha-config-server-control.js b/src/panels/config/server_control/ha-config-server-control.js
index cebf5243bd..27325ce499 100644
--- a/src/panels/config/server_control/ha-config-server-control.js
+++ b/src/panels/config/server_control/ha-config-server-control.js
@@ -35,6 +35,7 @@ class HaConfigServerControl extends LocalizeMixin(PolymerElement) {
-
+
@@ -94,7 +97,7 @@ class HaUserPicker extends EventsMixin(
return {
hass: Object,
users: Array,
-
+ isWide: Boolean,
rtl: {
type: Boolean,
reflectToAttribute: true,
diff --git a/src/panels/config/users/ha-config-users.js b/src/panels/config/users/ha-config-users.js
index 53e38bc746..62596b4817 100644
--- a/src/panels/config/users/ha-config-users.js
+++ b/src/panels/config/users/ha-config-users.js
@@ -27,6 +27,7 @@ class HaConfigUsers extends NavigateMixin(PolymerElement) {
+
${this.hass.localize("ui.panel.config.zha.header")}
diff --git a/src/panels/config/zha/zha-device-page.ts b/src/panels/config/zha/zha-device-page.ts
index d8605b8a84..8813f6526b 100755
--- a/src/panels/config/zha/zha-device-page.ts
+++ b/src/panels/config/zha/zha-device-page.ts
@@ -50,6 +50,7 @@ export class ZHADevicePage extends LitElement {
return html`
diff --git a/src/translations/en.json b/src/translations/en.json
index 8f1f32f908..cddc087885 100755
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -673,7 +673,7 @@
"confirm_unsaved": "You have unsaved changes. Are you sure you want to leave?"
}
},
- "area_registry": {
+ "areas": {
"caption": "Areas",
"description": "Overview of all areas in your home.",
"picker": {
@@ -1253,7 +1253,7 @@
"battery": "Battery"
}
},
- "entity_registry": {
+ "entities": {
"caption": "Entities",
"description": "Overview of all known entities.",
"picker": {