Use YAML in developer tools events (#13222)

This commit is contained in:
Franck Nijhof 2022-07-19 12:07:51 +02:00 committed by GitHub
parent 9309a4c7bc
commit 6ac4560b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -41,7 +41,7 @@ export class HaYamlEditor extends LitElement {
try { try {
this._yaml = this._yaml =
value && !isEmpty(value) value && !isEmpty(value)
? dump(value, { schema: this.yamlSchema }) ? dump(value, { schema: this.yamlSchema, quotingType: '"' })
: ""; : "";
} catch (err: any) { } catch (err: any) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console

View File

@ -4,6 +4,7 @@ import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
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 { HomeAssistant } from "../../../types"; import { HomeAssistant } from "../../../types";
@ -74,7 +75,10 @@ class EventSubscribeCard extends LitElement {
ev.id ev.id
)} )}
${formatTime(new Date(ev.event.time_fired), this.hass!.locale)}: ${formatTime(new Date(ev.event.time_fired), this.hass!.locale)}:
<pre>${JSON.stringify(ev.event, null, 4)}</pre> <ha-yaml-editor
.defaultValue=${ev.event}
readOnly
></ha-code-editor>
</div> </div>
` `
)} )}