mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-19 18:28:42 +00:00
Show hidden entities in target tree (#28181)
* Show hidden entities in target tree * Fix types
This commit is contained in:
@@ -75,17 +75,11 @@ export const reorderAreaRegistryEntries = (
|
||||
});
|
||||
|
||||
export const getAreaEntityLookup = (
|
||||
entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[],
|
||||
filterHidden = false
|
||||
entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[]
|
||||
): AreaEntityLookup => {
|
||||
const areaEntityLookup: AreaEntityLookup = {};
|
||||
for (const entity of entities) {
|
||||
if (
|
||||
!entity.area_id ||
|
||||
(filterHidden &&
|
||||
((entity as EntityRegistryDisplayEntry).hidden ||
|
||||
(entity as EntityRegistryEntry).hidden_by))
|
||||
) {
|
||||
if (!entity.area_id) {
|
||||
continue;
|
||||
}
|
||||
if (!(entity.area_id in areaEntityLookup)) {
|
||||
|
||||
@@ -111,17 +111,11 @@ export const sortDeviceRegistryByName = (
|
||||
);
|
||||
|
||||
export const getDeviceEntityLookup = (
|
||||
entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[],
|
||||
filterHidden = false
|
||||
entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[]
|
||||
): DeviceEntityLookup => {
|
||||
const deviceEntityLookup: DeviceEntityLookup = {};
|
||||
for (const entity of entities) {
|
||||
if (
|
||||
!entity.device_id ||
|
||||
(filterHidden &&
|
||||
((entity as EntityRegistryDisplayEntry).hidden ||
|
||||
(entity as EntityRegistryEntry).hidden_by))
|
||||
) {
|
||||
if (!entity.device_id) {
|
||||
continue;
|
||||
}
|
||||
if (!(entity.device_id in deviceEntityLookup)) {
|
||||
|
||||
@@ -1365,12 +1365,12 @@ class DialogAddAutomationElement
|
||||
|
||||
private _getAreaEntityLookupMemoized = memoizeOne(
|
||||
(entities: HomeAssistant["entities"]) =>
|
||||
getAreaEntityLookup(Object.values(entities), true)
|
||||
getAreaEntityLookup(Object.values(entities))
|
||||
);
|
||||
|
||||
private _getDeviceEntityLookupMemoized = memoizeOne(
|
||||
(entities: HomeAssistant["entities"]) =>
|
||||
getDeviceEntityLookup(Object.values(entities), true)
|
||||
getDeviceEntityLookup(Object.values(entities))
|
||||
);
|
||||
|
||||
private _extractTypeAndIdFromTarget = memoizeOne(
|
||||
|
||||
@@ -708,7 +708,11 @@ export default class HaAutomationAddFromTarget extends LitElement {
|
||||
this.floors
|
||||
);
|
||||
|
||||
const label = entityName || deviceName || entityId;
|
||||
let label = entityName || deviceName || entityId;
|
||||
|
||||
if (this.entities[entityId]?.hidden) {
|
||||
label += ` (${this.localize("ui.panel.config.automation.editor.entity_hidden")})`;
|
||||
}
|
||||
|
||||
return [entityId, label, stateObj] as [string, string, HassEntity];
|
||||
})
|
||||
@@ -837,12 +841,12 @@ export default class HaAutomationAddFromTarget extends LitElement {
|
||||
|
||||
private _getAreaEntityLookupMemoized = memoizeOne(
|
||||
(entities: HomeAssistant["entities"]) =>
|
||||
getAreaEntityLookup(Object.values(entities), true)
|
||||
getAreaEntityLookup(Object.values(entities))
|
||||
);
|
||||
|
||||
private _getDeviceEntityLookupMemoized = memoizeOne(
|
||||
(entities: HomeAssistant["entities"]) =>
|
||||
getDeviceEntityLookup(Object.values(entities), true)
|
||||
getDeviceEntityLookup(Object.values(entities))
|
||||
);
|
||||
|
||||
private _getSelectedTargetId = memoizeOne(
|
||||
|
||||
@@ -4045,6 +4045,7 @@
|
||||
"other_areas": "Other areas",
|
||||
"services": "Services",
|
||||
"helpers": "Helpers",
|
||||
"entity_hidden": "[%key:ui::panel::config::devices::entities::hidden%]",
|
||||
"triggers": {
|
||||
"name": "Triggers",
|
||||
"header": "When",
|
||||
|
||||
Reference in New Issue
Block a user