Skip to content

Commit

Permalink
Show info when no suitable group object found in project data (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
farmio authored Sep 3, 2024
1 parent 5b5658b commit 1510761
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/knx-project-device-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { customElement, property, state } from "lit/decorators";
import { repeat } from "lit/directives/repeat";
import { consume } from "@lit-labs/context";

import "@ha/components/ha-alert";
import "@ha/components/ha-svg-icon";

import { KNXProject, CommunicationObject, COFlags, DPT, GroupAddress } from "../types/websocket";
Expand Down Expand Up @@ -116,6 +117,9 @@ export class KNXProjectDeviceTree extends LitElement {
}

private _renderDevices(): TemplateResult {
if (!this.deviceTree.length) {
return html`<ha-alert alert-type="info">No suitable device found in project data.</ha-alert>`;
}
return html`<ul class="devices">
${repeat(
this.deviceTree,
Expand Down Expand Up @@ -250,6 +254,12 @@ export class KNXProjectDeviceTree extends LitElement {
padding-left: 8px;
}
ha-alert {
display: block;
margin-right: 8px;
margin-top: 8px;
}
ul {
list-style-type: none;
padding: 0;
Expand Down

0 comments on commit 1510761

Please sign in to comment.