Allow to group entities by domain (#20580)

Allow group entities by domain
This commit is contained in:
Bram Kragten 2024-04-22 18:27:13 +02:00 committed by GitHub
parent 62f46baacf
commit 4d21f9e80c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -94,6 +94,7 @@ import {
hasRejectedItems, hasRejectedItems,
rejectedItems, rejectedItems,
} from "../../../common/util/promise-all-settled-results"; } from "../../../common/util/promise-all-settled-results";
import { domainToName } from "../../../data/integration";
export interface StateEntity export interface StateEntity
extends Omit<EntityRegistryEntry, "id" | "unique_id"> { extends Omit<EntityRegistryEntry, "id" | "unique_id"> {
@ -110,6 +111,7 @@ export interface EntityRow extends StateEntity {
status: string | undefined; status: string | undefined;
area?: string; area?: string;
localized_platform: string; localized_platform: string;
domain: string;
label_entries: LabelRegistryEntry[]; label_entries: LabelRegistryEntry[];
} }
@ -261,6 +263,13 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
filterable: true, filterable: true,
width: "20%", width: "20%",
}, },
domain: {
title: localize("ui.panel.config.entities.picker.headers.domain"),
sortable: true,
hidden: true,
filterable: true,
groupable: true,
},
area: { area: {
title: localize("ui.panel.config.entities.picker.headers.area"), title: localize("ui.panel.config.entities.picker.headers.area"),
sortable: true, sortable: true,
@ -467,9 +476,9 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
), ),
unavailable, unavailable,
restored, restored,
localized_platform: localized_platform: domainToName(localize, entry.platform),
localize(`component.${entry.platform}.title`) || entry.platform,
area: area ? area.name : "—", area: area ? area.name : "—",
domain: domainToName(localize, computeDomain(entry.entity_id)),
status: restored status: restored
? localize("ui.panel.config.entities.picker.status.restored") ? localize("ui.panel.config.entities.picker.status.restored")
: unavailable : unavailable

View File

@ -4052,7 +4052,8 @@
"integration": "Integration", "integration": "Integration",
"area": "Area", "area": "Area",
"disabled_by": "Disabled by", "disabled_by": "Disabled by",
"status": "Status" "status": "Status",
"domain": "Domain"
}, },
"selected": "{number} selected", "selected": "{number} selected",
"enable_selected": { "enable_selected": {