mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Handle disabled entities in multi select label (#20371)
This commit is contained in:
parent
1a6d96cf3a
commit
3b5b3f3bb6
@ -1029,14 +1029,18 @@ ${
|
|||||||
const action = ev.currentTarget.action;
|
const action = ev.currentTarget.action;
|
||||||
const promises: Promise<UpdateEntityRegistryEntryResult>[] = [];
|
const promises: Promise<UpdateEntityRegistryEntryResult>[] = [];
|
||||||
this._selected.forEach((entityId) => {
|
this._selected.forEach((entityId) => {
|
||||||
|
const entityReg =
|
||||||
|
this.hass.entities[entityId] ||
|
||||||
|
this._entities.find((entReg) => entReg.entity_id === entityId);
|
||||||
|
if (!entityReg) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
promises.push(
|
promises.push(
|
||||||
updateEntityRegistryEntry(this.hass, entityId, {
|
updateEntityRegistryEntry(this.hass, entityId, {
|
||||||
labels:
|
labels:
|
||||||
action === "add"
|
action === "add"
|
||||||
? this.hass.entities[entityId].labels.concat(label)
|
? entityReg.labels.concat(label)
|
||||||
: this.hass.entities[entityId].labels.filter(
|
: entityReg.labels.filter((lbl) => lbl !== label),
|
||||||
(lbl) => lbl !== label
|
|
||||||
),
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user