David F. Mulcahey f4f08ab0d1 Config panel for ZHA (#2389)
* zha config panel

* implement issue cluster command

* update layout

* read zigbee attribute service

* set attribute and manufacturer code override

* cleanup

* adjust style and documentation wording

* html cleanup

* ha-call-ws-api-button

* use call-ws-api-button

* fix deprecated syntax - travis error

* emulate new z-wave node info functionality

* start converting to lit

* fix style includes

* fix help toggle

* remove old panel

* cleanup

* cleanup

* convert to lit / ts

* import styles

* types - review comment
2019-01-04 19:11:08 -06:00

81 lines
2.0 KiB
TypeScript
Executable File

import { html, LitElement, PropertyDeclarations } from "@polymer/lit-element";
import { TemplateResult } from "lit-html";
import "@polymer/app-layout/app-header/app-header";
import "@polymer/app-layout/app-toolbar/app-toolbar";
import "@polymer/paper-icon-button/paper-icon-button";
import "@polymer/iron-flex-layout/iron-flex-layout-classes";
import { HomeAssistant } from "../../../types";
import "../../../layouts/ha-app-layout";
import "../../../resources/ha-style";
import "./zha-network";
export class HaConfigZha extends LitElement {
public hass?: HomeAssistant;
public isWide?: boolean;
private _haStyle?: DocumentFragment;
private _ironFlex?: DocumentFragment;
static get properties(): PropertyDeclarations {
return {
hass: {},
isWide: {},
};
}
protected render(): TemplateResult {
return html`
${this.renderStyle()}
<ha-app-layout has-scrolling-region="">
<app-header slot="header" fixed="">
<app-toolbar>
<paper-icon-button
icon="hass:arrow-left"
@click="${this._onBackTapped}"
></paper-icon-button>
</app-toolbar>
</app-header>
<zha-network
id="zha-network"
.is-wide="${this.isWide}"
.hass="${this.hass}"
></zha-network>
</ha-app-layout>
`;
}
private renderStyle(): TemplateResult {
if (!this._haStyle) {
this._haStyle = document.importNode(
(document.getElementById("ha-style")!
.children[0] as HTMLTemplateElement).content,
true
);
}
if (!this._ironFlex) {
this._ironFlex = document.importNode(
(document.getElementById("iron-flex")!
.children[0] as HTMLTemplateElement).content,
true
);
}
return html`
${this._ironFlex} ${this._haStyle}
`;
}
private _onBackTapped(): void {
history.back();
}
}
declare global {
interface HTMLElementTagNameMap {
"ha-config-zha": HaConfigZha;
}
}
customElements.define("ha-config-zha", HaConfigZha);