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 { fireEvent } from "../../common/dom/fire_event";
|
||||
import { computeDomain } from "../../common/entity/compute_domain";
|
||||
import { DEFAULT_ENTITY_NAME } from "../../common/entity/compute_entity_name_display";
|
||||
import { navigate } from "../../common/navigate";
|
||||
import { computeTimelineColor } from "../../components/chart/timeline-color";
|
||||
import "../../components/entity/state-badge";
|
||||
@@ -464,24 +463,15 @@ class HaLogbookRenderer extends LitElement {
|
||||
entityName: string | undefined,
|
||||
noLink?: boolean
|
||||
) {
|
||||
if (!entityId) {
|
||||
return entityName || "";
|
||||
}
|
||||
|
||||
const stateObj = this.hass.states[entityId];
|
||||
const hasState = Boolean(stateObj);
|
||||
|
||||
const displayName = hasState
|
||||
? this.hass.formatEntityName(stateObj, DEFAULT_ENTITY_NAME) ||
|
||||
entityName ||
|
||||
stateObj.attributes.friendly_name ||
|
||||
entityId
|
||||
: entityName || entityId;
|
||||
|
||||
const hasState = entityId && entityId in this.hass.states;
|
||||
const displayName =
|
||||
entityName ||
|
||||
(hasState
|
||||
? this.hass.states[entityId].attributes.friendly_name || entityId
|
||||
: entityId);
|
||||
if (!hasState) {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
return noLink
|
||||
? displayName
|
||||
: html`<button
|
||||
|
||||
Reference in New Issue
Block a user