mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 01:06:35 +00:00
Enable weather entity row to show secondary info (#14639)
This commit is contained in:
parent
50cc8594be
commit
e768c78dce
@ -69,6 +69,7 @@ class HuiWeatherEntityRow extends LitElement implements LovelaceRow {
|
|||||||
this._config.tap_action && this._config.tap_action.action !== "none"
|
this._config.tap_action && this._config.tap_action.action !== "none"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const hasSecondary = this._config.secondary_info;
|
||||||
const weatherStateIcon = getWeatherStateIcon(stateObj.state, this);
|
const weatherStateIcon = getWeatherStateIcon(stateObj.state, this);
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
@ -94,6 +95,7 @@ class HuiWeatherEntityRow extends LitElement implements LovelaceRow {
|
|||||||
<div
|
<div
|
||||||
class="info ${classMap({
|
class="info ${classMap({
|
||||||
pointer,
|
pointer,
|
||||||
|
"text-content": !hasSecondary,
|
||||||
})}"
|
})}"
|
||||||
@action=${this._handleAction}
|
@action=${this._handleAction}
|
||||||
.actionHandler=${actionHandler({
|
.actionHandler=${actionHandler({
|
||||||
@ -102,6 +104,31 @@ class HuiWeatherEntityRow extends LitElement implements LovelaceRow {
|
|||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
${this._config.name || computeStateName(stateObj)}
|
${this._config.name || computeStateName(stateObj)}
|
||||||
|
${hasSecondary
|
||||||
|
? html`
|
||||||
|
<div class="secondary">
|
||||||
|
${this._config.secondary_info === "entity-id"
|
||||||
|
? stateObj.entity_id
|
||||||
|
: this._config.secondary_info === "last-changed"
|
||||||
|
? html`
|
||||||
|
<ha-relative-time
|
||||||
|
.hass=${this.hass}
|
||||||
|
.datetime=${stateObj.last_changed}
|
||||||
|
capitalize
|
||||||
|
></ha-relative-time>
|
||||||
|
`
|
||||||
|
: this._config.secondary_info === "last-updated"
|
||||||
|
? html`
|
||||||
|
<ha-relative-time
|
||||||
|
.hass=${this.hass}
|
||||||
|
.datetime=${stateObj.last_updated}
|
||||||
|
capitalize
|
||||||
|
></ha-relative-time>
|
||||||
|
`
|
||||||
|
: ""}
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
: ""}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="attributes ${classMap({
|
class="attributes ${classMap({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user