mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +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 promises: Promise<UpdateEntityRegistryEntryResult>[] = [];
|
||||
this._selected.forEach((entityId) => {
|
||||
const entityReg =
|
||||
this.hass.entities[entityId] ||
|
||||
this._entities.find((entReg) => entReg.entity_id === entityId);
|
||||
if (!entityReg) {
|
||||
return;
|
||||
}
|
||||
promises.push(
|
||||
updateEntityRegistryEntry(this.hass, entityId, {
|
||||
labels:
|
||||
action === "add"
|
||||
? this.hass.entities[entityId].labels.concat(label)
|
||||
: this.hass.entities[entityId].labels.filter(
|
||||
(lbl) => lbl !== label
|
||||
),
|
||||
? entityReg.labels.concat(label)
|
||||
: entityReg.labels.filter((lbl) => lbl !== label),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user