mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
Add zwave-js node alerts to device configuration page (#12173)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
11696c566a
commit
e6c580aadc
@ -167,12 +167,18 @@ export interface ZwaveJSNodeMetadata {
|
|||||||
wakeup: string;
|
wakeup: string;
|
||||||
reset: string;
|
reset: string;
|
||||||
device_database_url: string;
|
device_database_url: string;
|
||||||
|
comments: ZWaveJSNodeComment[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ZWaveJSNodeConfigParams {
|
export interface ZWaveJSNodeConfigParams {
|
||||||
[key: string]: ZWaveJSNodeConfigParam;
|
[key: string]: ZWaveJSNodeConfigParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ZWaveJSNodeComment {
|
||||||
|
level: "info" | "warning" | "error";
|
||||||
|
text: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ZWaveJSNodeConfigParam {
|
export interface ZWaveJSNodeConfigParam {
|
||||||
property: number;
|
property: number;
|
||||||
value: any;
|
value: any;
|
||||||
|
@ -19,6 +19,7 @@ import { customElement, property, state } from "lit/decorators";
|
|||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { debounce } from "../../../../../common/util/debounce";
|
import { debounce } from "../../../../../common/util/debounce";
|
||||||
|
import "../../../../../components/ha-alert";
|
||||||
import "../../../../../components/ha-card";
|
import "../../../../../components/ha-card";
|
||||||
import "../../../../../components/ha-icon-next";
|
import "../../../../../components/ha-icon-next";
|
||||||
import "../../../../../components/ha-select";
|
import "../../../../../components/ha-select";
|
||||||
@ -130,7 +131,7 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
></hass-error-screen>`;
|
></hass-error-screen>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._config) {
|
if (!this._config || !this._nodeMetadata) {
|
||||||
return html`<hass-loading-screen></hass-loading-screen>`;
|
return html`<hass-loading-screen></hass-loading-screen>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,9 +179,18 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
</em>
|
</em>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<ha-card>
|
${this._nodeMetadata.comments.length > 0
|
||||||
${this._config
|
|
||||||
? html`
|
? html`
|
||||||
|
<div>
|
||||||
|
${this._nodeMetadata.comments.map(
|
||||||
|
(comment) => html`<ha-alert .alertType=${comment.level}>
|
||||||
|
${comment.text}
|
||||||
|
</ha-alert>`
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
: ``}
|
||||||
|
<ha-card>
|
||||||
${Object.entries(this._config).map(
|
${Object.entries(this._config).map(
|
||||||
([id, item]) => html` <ha-settings-row
|
([id, item]) => html` <ha-settings-row
|
||||||
class="config-item"
|
class="config-item"
|
||||||
@ -190,8 +200,6 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
${this._generateConfigBox(id, item)}
|
${this._generateConfigBox(id, item)}
|
||||||
</ha-settings-row>`
|
</ha-settings-row>`
|
||||||
)}
|
)}
|
||||||
`
|
|
||||||
: ``}
|
|
||||||
</ha-card>
|
</ha-card>
|
||||||
</ha-config-section>
|
</ha-config-section>
|
||||||
</hass-tabs-subpage>
|
</hass-tabs-subpage>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user