mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-21 19:28:46 +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 = (
|
export const getAreaEntityLookup = (
|
||||||
entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[],
|
entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[]
|
||||||
filterHidden = false
|
|
||||||
): AreaEntityLookup => {
|
): AreaEntityLookup => {
|
||||||
const areaEntityLookup: AreaEntityLookup = {};
|
const areaEntityLookup: AreaEntityLookup = {};
|
||||||
for (const entity of entities) {
|
for (const entity of entities) {
|
||||||
if (
|
if (!entity.area_id) {
|
||||||
!entity.area_id ||
|
|
||||||
(filterHidden &&
|
|
||||||
((entity as EntityRegistryDisplayEntry).hidden ||
|
|
||||||
(entity as EntityRegistryEntry).hidden_by))
|
|
||||||
) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!(entity.area_id in areaEntityLookup)) {
|
if (!(entity.area_id in areaEntityLookup)) {
|
||||||
|
|||||||
@@ -111,17 +111,11 @@ export const sortDeviceRegistryByName = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
export const getDeviceEntityLookup = (
|
export const getDeviceEntityLookup = (
|
||||||
entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[],
|
entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[]
|
||||||
filterHidden = false
|
|
||||||
): DeviceEntityLookup => {
|
): DeviceEntityLookup => {
|
||||||
const deviceEntityLookup: DeviceEntityLookup = {};
|
const deviceEntityLookup: DeviceEntityLookup = {};
|
||||||
for (const entity of entities) {
|
for (const entity of entities) {
|
||||||
if (
|
if (!entity.device_id) {
|
||||||
!entity.device_id ||
|
|
||||||
(filterHidden &&
|
|
||||||
((entity as EntityRegistryDisplayEntry).hidden ||
|
|
||||||
(entity as EntityRegistryEntry).hidden_by))
|
|
||||||
) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!(entity.device_id in deviceEntityLookup)) {
|
if (!(entity.device_id in deviceEntityLookup)) {
|
||||||
|
|||||||
@@ -1365,12 +1365,12 @@ class DialogAddAutomationElement
|
|||||||
|
|
||||||
private _getAreaEntityLookupMemoized = memoizeOne(
|
private _getAreaEntityLookupMemoized = memoizeOne(
|
||||||
(entities: HomeAssistant["entities"]) =>
|
(entities: HomeAssistant["entities"]) =>
|
||||||
getAreaEntityLookup(Object.values(entities), true)
|
getAreaEntityLookup(Object.values(entities))
|
||||||
);
|
);
|
||||||
|
|
||||||
private _getDeviceEntityLookupMemoized = memoizeOne(
|
private _getDeviceEntityLookupMemoized = memoizeOne(
|
||||||
(entities: HomeAssistant["entities"]) =>
|
(entities: HomeAssistant["entities"]) =>
|
||||||
getDeviceEntityLookup(Object.values(entities), true)
|
getDeviceEntityLookup(Object.values(entities))
|
||||||
);
|
);
|
||||||
|
|
||||||
private _extractTypeAndIdFromTarget = memoizeOne(
|
private _extractTypeAndIdFromTarget = memoizeOne(
|
||||||
|
|||||||
@@ -708,7 +708,11 @@ export default class HaAutomationAddFromTarget extends LitElement {
|
|||||||
this.floors
|
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];
|
return [entityId, label, stateObj] as [string, string, HassEntity];
|
||||||
})
|
})
|
||||||
@@ -837,12 +841,12 @@ export default class HaAutomationAddFromTarget extends LitElement {
|
|||||||
|
|
||||||
private _getAreaEntityLookupMemoized = memoizeOne(
|
private _getAreaEntityLookupMemoized = memoizeOne(
|
||||||
(entities: HomeAssistant["entities"]) =>
|
(entities: HomeAssistant["entities"]) =>
|
||||||
getAreaEntityLookup(Object.values(entities), true)
|
getAreaEntityLookup(Object.values(entities))
|
||||||
);
|
);
|
||||||
|
|
||||||
private _getDeviceEntityLookupMemoized = memoizeOne(
|
private _getDeviceEntityLookupMemoized = memoizeOne(
|
||||||
(entities: HomeAssistant["entities"]) =>
|
(entities: HomeAssistant["entities"]) =>
|
||||||
getDeviceEntityLookup(Object.values(entities), true)
|
getDeviceEntityLookup(Object.values(entities))
|
||||||
);
|
);
|
||||||
|
|
||||||
private _getSelectedTargetId = memoizeOne(
|
private _getSelectedTargetId = memoizeOne(
|
||||||
|
|||||||
@@ -4045,6 +4045,7 @@
|
|||||||
"other_areas": "Other areas",
|
"other_areas": "Other areas",
|
||||||
"services": "Services",
|
"services": "Services",
|
||||||
"helpers": "Helpers",
|
"helpers": "Helpers",
|
||||||
|
"entity_hidden": "[%key:ui::panel::config::devices::entities::hidden%]",
|
||||||
"triggers": {
|
"triggers": {
|
||||||
"name": "Triggers",
|
"name": "Triggers",
|
||||||
"header": "When",
|
"header": "When",
|
||||||
|
|||||||
Reference in New Issue
Block a user