Fix dev tools event (#13225)

This commit is contained in:
Bram Kragten 2022-07-19 13:17:13 +02:00 committed by GitHub
parent 8b675cdbba
commit 05418fc83b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 16 deletions

View File

@ -2,10 +2,11 @@ import "@material/mwc-button";
import { HassEvent } from "home-assistant-js-websocket";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators";
import { repeat } from "lit/directives/repeat";
import { formatTime } from "../../../common/datetime/format_time";
import "../../../components/ha-card";
import "../../../components/ha-yaml-editor";
import "../../../components/ha-textfield";
import "../../../components/ha-yaml-editor";
import { HomeAssistant } from "../../../types";
@customElement("event-subscribe-card")
@ -66,21 +67,27 @@ class EventSubscribeCard extends LitElement {
</mwc-button>
</form>
<div class="events">
${this._events.map(
(ev) => html`
<div class="event">
${this.hass!.localize(
"ui.panel.developer-tools.tabs.events.event_fired",
"name",
ev.id
)}
${formatTime(new Date(ev.event.time_fired), this.hass!.locale)}:
<ha-yaml-editor
.defaultValue=${ev.event}
readOnly
></ha-code-editor>
</div>
`
${repeat(
this._events,
(event) => event.id,
(event) =>
html`
<div class="event">
${this.hass!.localize(
"ui.panel.developer-tools.tabs.events.event_fired",
"name",
event.id
)}
${formatTime(
new Date(event.event.time_fired),
this.hass!.locale
)}:
<ha-yaml-editor
.defaultValue=${event.event}
readOnly
></ha-yaml-editor>
</div>
`
)}
</div>
</ha-card>