Skip to content

Commit

Permalink
Use state icon for helpers (home-assistant#17777)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Sep 1, 2023
1 parent dd8a50a commit cc5fffc
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/panels/config/helpers/ha-config-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { mdiPencilOff, mdiPlus } from "@mdi/js";
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
import { mdiPencilOff, mdiPlus } from "@mdi/js";
import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket";
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
import { LitElement, PropertyValues, TemplateResult, html } from "lit";
import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one";
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
import { domainIcon } from "../../../common/entity/domain_icon";
import { navigate } from "../../../common/navigate";
import { LocalizeFunc } from "../../../common/translations/localize";
import { extractSearchParam } from "../../../common/url/search-params";
Expand All @@ -15,6 +14,7 @@ import {
} from "../../../components/data-table/ha-data-table";
import "../../../components/ha-fab";
import "../../../components/ha-icon";
import "../../../components/ha-state-icon";
import "../../../components/ha-svg-icon";
import { ConfigEntry, getConfigEntries } from "../../../data/config_entries";
import { getConfigFlowHandlers } from "../../../data/config_flow";
Expand Down Expand Up @@ -82,12 +82,8 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
title: "",
label: localize("ui.panel.config.helpers.picker.headers.icon"),
type: "icon",
template: (icon, helper: any) =>
icon
? html` <ha-icon .icon=${icon}></ha-icon> `
: html`<ha-svg-icon
.path=${domainIcon(helper.type)}
></ha-svg-icon>`,
template: (_, helper: any) =>
html`<ha-state-icon .state=${helper.entity}></ha-state-icon>`,
},
name: {
title: localize("ui.panel.config.helpers.picker.headers.name"),
Expand Down Expand Up @@ -176,6 +172,7 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
? configEntry.domain
: computeStateDomain(entityState),
configEntry,
entity: entityState,
};
})
);
Expand Down

0 comments on commit cc5fffc

Please sign in to comment.