mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-16 22:40:55 +00:00
Use entity registry display api (#15549)
This commit is contained in:
@@ -39,6 +39,7 @@ import { HomeAssistant, Route } from "../../../types";
|
||||
import "../../../layouts/hass-subpage";
|
||||
import "../../../components/ha-button-menu";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import { EntityRegistryEntry } from "../../../data/entity_registry";
|
||||
|
||||
@customElement("ha-script-trace")
|
||||
export class HaScriptTrace extends LitElement {
|
||||
@@ -54,6 +55,8 @@ export class HaScriptTrace extends LitElement {
|
||||
|
||||
@property({ attribute: false }) public route!: Route;
|
||||
|
||||
@property({ attribute: false }) public entityRegistry!: EntityRegistryEntry[];
|
||||
|
||||
@state() private _entityId?: string;
|
||||
|
||||
@state() private _traces?: ScriptTrace[];
|
||||
@@ -318,7 +321,7 @@ export class HaScriptTrace extends LitElement {
|
||||
const params = new URLSearchParams(location.search);
|
||||
this._loadTraces(params.get("run_id") || undefined);
|
||||
|
||||
this._entityId = Object.values(this.hass.entities).find(
|
||||
this._entityId = this.entityRegistry.find(
|
||||
(entry) => entry.unique_id === this.scriptId
|
||||
)?.entity_id;
|
||||
}
|
||||
@@ -335,7 +338,7 @@ export class HaScriptTrace extends LitElement {
|
||||
if (this.scriptId) {
|
||||
this._loadTraces();
|
||||
|
||||
this._entityId = Object.values(this.hass.entities).find(
|
||||
this._entityId = this.entityRegistry.find(
|
||||
(entry) => entry.unique_id === this.scriptId
|
||||
)?.entity_id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user