mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Reapply filters if entity registry change (#20265)
This commit is contained in:
parent
d1119a3b61
commit
520581c165
@ -10,7 +10,7 @@ import { computeDomain } from "../common/entity/compute_domain";
|
|||||||
|
|
||||||
export { subscribeEntityRegistryDisplay } from "./ws-entity_registry_display";
|
export { subscribeEntityRegistryDisplay } from "./ws-entity_registry_display";
|
||||||
|
|
||||||
type entityCategory = "config" | "diagnostic";
|
type EntityCategory = "config" | "diagnostic";
|
||||||
|
|
||||||
export interface EntityRegistryDisplayEntry {
|
export interface EntityRegistryDisplayEntry {
|
||||||
entity_id: string;
|
entity_id: string;
|
||||||
@ -20,7 +20,7 @@ export interface EntityRegistryDisplayEntry {
|
|||||||
area_id?: string;
|
area_id?: string;
|
||||||
labels: string[];
|
labels: string[];
|
||||||
hidden?: boolean;
|
hidden?: boolean;
|
||||||
entity_category?: entityCategory;
|
entity_category?: EntityCategory;
|
||||||
translation_key?: string;
|
translation_key?: string;
|
||||||
platform?: string;
|
platform?: string;
|
||||||
display_precision?: number;
|
display_precision?: number;
|
||||||
@ -40,7 +40,7 @@ export interface EntityRegistryDisplayEntryResponse {
|
|||||||
hb?: boolean;
|
hb?: boolean;
|
||||||
dp?: number;
|
dp?: number;
|
||||||
}[];
|
}[];
|
||||||
entity_categories: Record<number, entityCategory>;
|
entity_categories: Record<number, EntityCategory>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EntityRegistryEntry {
|
export interface EntityRegistryEntry {
|
||||||
@ -55,7 +55,7 @@ export interface EntityRegistryEntry {
|
|||||||
labels: string[];
|
labels: string[];
|
||||||
disabled_by: "user" | "device" | "integration" | "config_entry" | null;
|
disabled_by: "user" | "device" | "integration" | "config_entry" | null;
|
||||||
hidden_by: Exclude<EntityRegistryEntry["disabled_by"], "config_entry">;
|
hidden_by: Exclude<EntityRegistryEntry["disabled_by"], "config_entry">;
|
||||||
entity_category: entityCategory | null;
|
entity_category: EntityCategory | null;
|
||||||
has_entity_name: boolean;
|
has_entity_name: boolean;
|
||||||
original_name?: string;
|
original_name?: string;
|
||||||
unique_id: string;
|
unique_id: string;
|
||||||
|
@ -18,6 +18,7 @@ import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
|||||||
import {
|
import {
|
||||||
CSSResultGroup,
|
CSSResultGroup,
|
||||||
LitElement,
|
LitElement,
|
||||||
|
PropertyValues,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
css,
|
css,
|
||||||
html,
|
html,
|
||||||
@ -38,13 +39,15 @@ import type {
|
|||||||
DataTableColumnContainer,
|
DataTableColumnContainer,
|
||||||
RowClickedEvent,
|
RowClickedEvent,
|
||||||
} from "../../../components/data-table/ha-data-table";
|
} from "../../../components/data-table/ha-data-table";
|
||||||
|
import "../../../components/data-table/ha-data-table-labels";
|
||||||
import "../../../components/entity/ha-entity-toggle";
|
import "../../../components/entity/ha-entity-toggle";
|
||||||
import "../../../components/ha-fab";
|
import "../../../components/ha-fab";
|
||||||
import "../../../components/ha-filter-floor-areas";
|
|
||||||
import "../../../components/ha-filter-blueprints";
|
import "../../../components/ha-filter-blueprints";
|
||||||
import "../../../components/ha-filter-categories";
|
import "../../../components/ha-filter-categories";
|
||||||
import "../../../components/ha-filter-devices";
|
import "../../../components/ha-filter-devices";
|
||||||
import "../../../components/ha-filter-entities";
|
import "../../../components/ha-filter-entities";
|
||||||
|
import "../../../components/ha-filter-floor-areas";
|
||||||
|
import "../../../components/ha-filter-labels";
|
||||||
import "../../../components/ha-icon-button";
|
import "../../../components/ha-icon-button";
|
||||||
import "../../../components/ha-icon-overflow-menu";
|
import "../../../components/ha-icon-overflow-menu";
|
||||||
import "../../../components/ha-svg-icon";
|
import "../../../components/ha-svg-icon";
|
||||||
@ -64,6 +67,10 @@ import {
|
|||||||
import { fullEntitiesContext } from "../../../data/context";
|
import { fullEntitiesContext } from "../../../data/context";
|
||||||
import { UNAVAILABLE } from "../../../data/entity";
|
import { UNAVAILABLE } from "../../../data/entity";
|
||||||
import { EntityRegistryEntry } from "../../../data/entity_registry";
|
import { EntityRegistryEntry } from "../../../data/entity_registry";
|
||||||
|
import {
|
||||||
|
LabelRegistryEntry,
|
||||||
|
subscribeLabelRegistry,
|
||||||
|
} from "../../../data/label_registry";
|
||||||
import { findRelated } from "../../../data/search";
|
import { findRelated } from "../../../data/search";
|
||||||
import {
|
import {
|
||||||
showAlertDialog,
|
showAlertDialog,
|
||||||
@ -77,12 +84,6 @@ import { documentationUrl } from "../../../util/documentation-url";
|
|||||||
import { showAssignCategoryDialog } from "../category/show-dialog-assign-category";
|
import { showAssignCategoryDialog } from "../category/show-dialog-assign-category";
|
||||||
import { configSections } from "../ha-panel-config";
|
import { configSections } from "../ha-panel-config";
|
||||||
import { showNewAutomationDialog } from "./show-dialog-new-automation";
|
import { showNewAutomationDialog } from "./show-dialog-new-automation";
|
||||||
import "../../../components/data-table/ha-data-table-labels";
|
|
||||||
import {
|
|
||||||
LabelRegistryEntry,
|
|
||||||
subscribeLabelRegistry,
|
|
||||||
} from "../../../data/label_registry";
|
|
||||||
import "../../../components/ha-filter-labels";
|
|
||||||
|
|
||||||
type AutomationItem = AutomationEntity & {
|
type AutomationItem = AutomationEntity & {
|
||||||
name: string;
|
name: string;
|
||||||
@ -509,6 +510,13 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected updated(changedProps: PropertyValues) {
|
||||||
|
super.updated(changedProps);
|
||||||
|
if (changedProps.has("_entityReg")) {
|
||||||
|
this._applyFilters();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
firstUpdated() {
|
firstUpdated() {
|
||||||
if (this._searchParms.has("blueprint")) {
|
if (this._searchParms.has("blueprint")) {
|
||||||
this._filterBlueprint();
|
this._filterBlueprint();
|
||||||
|
@ -16,6 +16,7 @@ import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
|||||||
import {
|
import {
|
||||||
CSSResultGroup,
|
CSSResultGroup,
|
||||||
LitElement,
|
LitElement,
|
||||||
|
PropertyValues,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
css,
|
css,
|
||||||
html,
|
html,
|
||||||
@ -297,6 +298,13 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
protected updated(changedProps: PropertyValues) {
|
||||||
|
super.updated(changedProps);
|
||||||
|
if (changedProps.has("_entityReg")) {
|
||||||
|
this._applyFilters();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected hassSubscribe(): (UnsubscribeFunc | Promise<UnsubscribeFunc>)[] {
|
protected hassSubscribe(): (UnsubscribeFunc | Promise<UnsubscribeFunc>)[] {
|
||||||
return [
|
return [
|
||||||
subscribeCategoryRegistry(this.hass.connection, "scene", (categories) => {
|
subscribeCategoryRegistry(this.hass.connection, "scene", (categories) => {
|
||||||
|
@ -15,6 +15,7 @@ import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
|||||||
import {
|
import {
|
||||||
CSSResultGroup,
|
CSSResultGroup,
|
||||||
LitElement,
|
LitElement,
|
||||||
|
PropertyValues,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
css,
|
css,
|
||||||
html,
|
html,
|
||||||
@ -560,6 +561,13 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
|
|||||||
this._filteredScripts = items ? [...items] : undefined;
|
this._filteredScripts = items ? [...items] : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected updated(changedProps: PropertyValues) {
|
||||||
|
super.updated(changedProps);
|
||||||
|
if (changedProps.has("_entityReg")) {
|
||||||
|
this._applyFilters();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
firstUpdated() {
|
firstUpdated() {
|
||||||
if (this._searchParms.has("blueprint")) {
|
if (this._searchParms.has("blueprint")) {
|
||||||
this._filterBlueprint();
|
this._filterBlueprint();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user