diff --git a/src/panels/config/automation/ha-automation-trace.ts b/src/panels/config/automation/ha-automation-trace.ts index b2884f064f..31f795f801 100644 --- a/src/panels/config/automation/ha-automation-trace.ts +++ b/src/panels/config/automation/ha-automation-trace.ts @@ -1,5 +1,8 @@ import { + mdiDotsVertical, mdiDownload, + mdiInformationOutline, + mdiPencil, mdiRayEndArrow, mdiRayStartArrow, mdiRefresh, @@ -10,6 +13,8 @@ import { classMap } from "lit/directives/class-map"; import { repeat } from "lit/directives/repeat"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { formatDateTimeWithSeconds } from "../../../common/datetime/format_date_time"; +import { fireEvent } from "../../../common/dom/fire_event"; +import "../../../components/ha-button-menu"; import "../../../components/ha-icon-button"; import "../../../components/trace/ha-trace-blueprint-config"; import "../../../components/trace/ha-trace-config"; @@ -31,9 +36,9 @@ import { loadTraces, } from "../../../data/trace"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; +import "../../../layouts/hass-subpage"; import { haStyle } from "../../../resources/styles"; import { HomeAssistant, Route } from "../../../types"; -import "../../../layouts/hass-subpage"; @customElement("ha-automation-trace") export class HaAutomationTrace extends LitElement { @@ -107,23 +112,63 @@ export class HaAutomationTrace extends LitElement { ` : ""} - - + + + + + ${this.hass.localize("ui.panel.config.automation.editor.show_info")} + + + + ${stateObj?.attributes.id && this.narrow + ? html` + + + ${this.hass.localize( + "ui.panel.config.automation.trace.edit_automation" + )} + + + + ` + : ""} + +
  • + + + ${this.hass.localize("ui.panel.config.automation.trace.refresh")} + + + + + ${this.hass.localize( + "ui.panel.config.automation.trace.download_trace" + )} + + +
    +
    ${this._traces && this._traces.length > 0 ? html` @@ -443,6 +488,13 @@ export class HaAutomationTrace extends LitElement { } } + private _showInfo() { + if (!this.hass || !this._entityId) { + return; + } + fireEvent(this, "hass-more-info", { entityId: this._entityId }); + } + static get styles(): CSSResultGroup { return [ haStyle, diff --git a/src/panels/config/script/ha-script-trace.ts b/src/panels/config/script/ha-script-trace.ts index e0ba6c6d33..ab35977cb1 100644 --- a/src/panels/config/script/ha-script-trace.ts +++ b/src/panels/config/script/ha-script-trace.ts @@ -1,5 +1,8 @@ import { + mdiDotsVertical, mdiDownload, + mdiInformationOutline, + mdiPencil, mdiRayEndArrow, mdiRayStartArrow, mdiRefresh, @@ -34,6 +37,8 @@ import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../resources/styles"; import { HomeAssistant, Route } from "../../../types"; import "../../../layouts/hass-subpage"; +import "../../../components/ha-button-menu"; +import { fireEvent } from "../../../common/dom/fire_event"; @customElement("ha-script-trace") export class HaScriptTrace extends LitElement { @@ -105,23 +110,64 @@ export class HaScriptTrace extends LitElement { ` : ""} - - + + + + + + ${this.hass.localize("ui.panel.config.script.editor.show_info")} + + + + ${this.narrow && this.scriptEntityId + ? html` + + + ${this.hass.localize( + "ui.panel.config.script.trace.edit_script" + )} + + + + ` + : ""} + +
  • + + + ${this.hass.localize("ui.panel.config.automation.trace.refresh")} + + + + + ${this.hass.localize( + "ui.panel.config.automation.trace.download_trace" + )} + + +
    +
    ${this._traces && this._traces.length > 0 ? html` @@ -429,6 +475,13 @@ export class HaScriptTrace extends LitElement { } } + private async _showInfo() { + if (!this.scriptEntityId) { + return; + } + fireEvent(this, "hass-more-info", { entityId: this.scriptEntityId }); + } + static get styles(): CSSResultGroup { return [ haStyle,