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 { 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,21 +67,27 @@ class EventSubscribeCard extends LitElement {
</mwc-button> </mwc-button>
</form> </form>
<div class="events"> <div class="events">
${this._events.map( ${repeat(
(ev) => html` this._events,
<div class="event"> (event) => event.id,
${this.hass!.localize( (event) =>
"ui.panel.developer-tools.tabs.events.event_fired", html`
"name", <div class="event">
ev.id ${this.hass!.localize(
)} "ui.panel.developer-tools.tabs.events.event_fired",
${formatTime(new Date(ev.event.time_fired), this.hass!.locale)}: "name",
<ha-yaml-editor event.id
.defaultValue=${ev.event} )}
readOnly ${formatTime(
></ha-code-editor> new Date(event.event.time_fired),
</div> this.hass!.locale
` )}:
<ha-yaml-editor
.defaultValue=${event.event}
readOnly
></ha-yaml-editor>
</div>
`
)} )}
</div> </div>
</ha-card> </ha-card>