Fix icons in entity settings (#20405)

This commit is contained in:
Bram Kragten 2024-04-04 13:00:14 +02:00 committed by GitHub
parent 08b25f9c2a
commit 61c9072a08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,7 +27,6 @@ import {
import { customElement, property, query, state } from "lit/decorators"; import { customElement, property, query, state } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined"; import { ifDefined } from "lit/directives/if-defined";
import { styleMap } from "lit/directives/style-map"; import { styleMap } from "lit/directives/style-map";
import { until } from "lit/directives/until";
import memoize from "memoize-one"; import memoize from "memoize-one";
import { computeCssColor } from "../../../common/color/compute-color"; import { computeCssColor } from "../../../common/color/compute-color";
import type { HASSDomEvent } from "../../../common/dom/fire_event"; import type { HASSDomEvent } from "../../../common/dom/fire_event";
@ -67,7 +66,6 @@ import {
removeEntityRegistryEntry, removeEntityRegistryEntry,
updateEntityRegistryEntry, updateEntityRegistryEntry,
} from "../../../data/entity_registry"; } from "../../../data/entity_registry";
import { entryIcon } from "../../../data/icons";
import { import {
LabelRegistryEntry, LabelRegistryEntry,
createLabelRegistryEntry, createLabelRegistryEntry,
@ -207,21 +205,19 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
type: "icon", type: "icon",
template: (entry) => template: (entry) =>
entry.icon entry.icon
? html` ? html`<ha-icon .icon=${entry.icon}></ha-icon>`
<ha-state-icon : entry.entity
title=${ifDefined(entry.entity?.state)} ? html`
slot="item-icon" <ha-state-icon
.hass=${this.hass} title=${ifDefined(entry.entity?.state)}
.stateObj=${entry.entity} slot="item-icon"
></ha-state-icon> .hass=${this.hass}
` .stateObj=${entry.entity}
: html` ></ha-state-icon>
<ha-icon `
icon=${until( : html`<ha-domain-icon
entryIcon(this.hass, entry as EntityRegistryEntry) .domain=${computeDomain(entry.entity_id)}
)} ></ha-domain-icon>`,
></ha-icon>
`,
}, },
name: { name: {
main: true, main: true,