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

View File

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