mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
Revert "Use entity name for activity/logbook renderer" (#28098)
This commit is contained in:
@@ -11,7 +11,6 @@ import { formatTimeWithSeconds } from "../../common/datetime/format_time";
|
|||||||
import { restoreScroll } from "../../common/decorators/restore-scroll";
|
import { restoreScroll } from "../../common/decorators/restore-scroll";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import { computeDomain } from "../../common/entity/compute_domain";
|
import { computeDomain } from "../../common/entity/compute_domain";
|
||||||
import { DEFAULT_ENTITY_NAME } from "../../common/entity/compute_entity_name_display";
|
|
||||||
import { navigate } from "../../common/navigate";
|
import { navigate } from "../../common/navigate";
|
||||||
import { computeTimelineColor } from "../../components/chart/timeline-color";
|
import { computeTimelineColor } from "../../components/chart/timeline-color";
|
||||||
import "../../components/entity/state-badge";
|
import "../../components/entity/state-badge";
|
||||||
@@ -464,24 +463,15 @@ class HaLogbookRenderer extends LitElement {
|
|||||||
entityName: string | undefined,
|
entityName: string | undefined,
|
||||||
noLink?: boolean
|
noLink?: boolean
|
||||||
) {
|
) {
|
||||||
if (!entityId) {
|
const hasState = entityId && entityId in this.hass.states;
|
||||||
return entityName || "";
|
const displayName =
|
||||||
}
|
entityName ||
|
||||||
|
(hasState
|
||||||
const stateObj = this.hass.states[entityId];
|
? this.hass.states[entityId].attributes.friendly_name || entityId
|
||||||
const hasState = Boolean(stateObj);
|
: entityId);
|
||||||
|
|
||||||
const displayName = hasState
|
|
||||||
? this.hass.formatEntityName(stateObj, DEFAULT_ENTITY_NAME) ||
|
|
||||||
entityName ||
|
|
||||||
stateObj.attributes.friendly_name ||
|
|
||||||
entityId
|
|
||||||
: entityName || entityId;
|
|
||||||
|
|
||||||
if (!hasState) {
|
if (!hasState) {
|
||||||
return displayName;
|
return displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return noLink
|
return noLink
|
||||||
? displayName
|
? displayName
|
||||||
: html`<button
|
: html`<button
|
||||||
|
|||||||
Reference in New Issue
Block a user