mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Add last updated property to tile card state content (#21191)
This commit is contained in:
parent
49c42fc757
commit
5273293cd6
@ -238,6 +238,14 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
|
|||||||
></ha-relative-time>
|
></ha-relative-time>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
if (content === "last-updated") {
|
||||||
|
return html`
|
||||||
|
<ha-relative-time
|
||||||
|
.hass=${this.hass}
|
||||||
|
.datetime=${stateObj.last_updated}
|
||||||
|
></ha-relative-time>
|
||||||
|
`;
|
||||||
|
}
|
||||||
if (content === "last_triggered") {
|
if (content === "last_triggered") {
|
||||||
return html`
|
return html`
|
||||||
<ha-relative-time
|
<ha-relative-time
|
||||||
|
@ -201,6 +201,12 @@ export class HuiTileCardEditor
|
|||||||
),
|
),
|
||||||
value: "last-changed",
|
value: "last-changed",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: localize(
|
||||||
|
`ui.panel.lovelace.editor.card.tile.state_content_options.last-updated`
|
||||||
|
),
|
||||||
|
value: "last-updated",
|
||||||
|
},
|
||||||
...Object.keys(stateObj?.attributes ?? {})
|
...Object.keys(stateObj?.attributes ?? {})
|
||||||
.filter((a) => !HIDDEN_ATTRIBUTES.includes(a))
|
.filter((a) => !HIDDEN_ATTRIBUTES.includes(a))
|
||||||
.map((attribute) => ({
|
.map((attribute) => ({
|
||||||
|
@ -5987,7 +5987,8 @@
|
|||||||
"state_content": "State content",
|
"state_content": "State content",
|
||||||
"state_content_options": {
|
"state_content_options": {
|
||||||
"state": "State",
|
"state": "State",
|
||||||
"last-changed": "Last changed"
|
"last-changed": "Last changed",
|
||||||
|
"last-updated": "Last updated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"vertical-stack": {
|
"vertical-stack": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user