1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00

Add area to helpers table (#28460)

This commit is contained in:
Aidan Timson
2025-12-09 14:05:54 +00:00
committed by GitHub
parent 9cd38c7128
commit 071161e82d
2 changed files with 16 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ import { computeCssColor } from "../../../common/color/compute-color";
import { storage } from "../../../common/decorators/storage"; import { storage } from "../../../common/decorators/storage";
import type { HASSDomEvent } from "../../../common/dom/fire_event"; import type { HASSDomEvent } from "../../../common/dom/fire_event";
import { computeStateDomain } from "../../../common/entity/compute_state_domain"; import { computeStateDomain } from "../../../common/entity/compute_state_domain";
import { computeAreaName } from "../../../common/entity/compute_area_name";
import { navigate } from "../../../common/navigate"; import { navigate } from "../../../common/navigate";
import type { import type {
LocalizeFunc, LocalizeFunc,
@@ -132,6 +133,7 @@ interface HelperItem {
configEntry?: ConfigEntry; configEntry?: ConfigEntry;
entity?: HassEntity; entity?: HassEntity;
category: string | undefined; category: string | undefined;
area?: string;
label_entries: LabelRegistryEntry[]; label_entries: LabelRegistryEntry[];
disabled?: boolean; disabled?: boolean;
} }
@@ -347,6 +349,12 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
filterable: true, filterable: true,
sortable: true, sortable: true,
}, },
area: {
title: localize("ui.panel.config.helpers.picker.headers.area"),
sortable: true,
filterable: true,
groupable: true,
},
labels: { labels: {
title: "", title: "",
hidden: true, hidden: true,
@@ -565,6 +573,11 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
entityRegistryByEntityId(entityReg)[item.entity_id]; entityRegistryByEntityId(entityReg)[item.entity_id];
const labels = labelReg && entityRegEntry?.labels; const labels = labelReg && entityRegEntry?.labels;
const category = entityRegEntry?.categories.helpers; const category = entityRegEntry?.categories.helpers;
const areaId = entityRegEntry?.area_id;
const area =
areaId && this.hass.areas?.[areaId]
? computeAreaName(this.hass.areas[areaId])
: undefined;
return { return {
...item, ...item,
localized_type: localized_type:
@@ -579,6 +592,7 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
category: category category: category
? categoryReg?.find((cat) => cat.category_id === category)?.name ? categoryReg?.find((cat) => cat.category_id === category)?.name
: undefined, : undefined,
area,
}; };
}); });
} }

View File

@@ -3304,7 +3304,8 @@
"entity_id": "Entity ID", "entity_id": "Entity ID",
"type": "Type", "type": "Type",
"editable": "Editable", "editable": "Editable",
"category": "Category" "category": "Category",
"area": "Area"
}, },
"create_helper": "Create helper", "create_helper": "Create helper",
"no_helpers": "Looks like you don't have any helpers yet!", "no_helpers": "Looks like you don't have any helpers yet!",