Add clear button to Assist debug page (#23774)

* Add clear button to Assist debug page

* Move destructive to ha-button
This commit is contained in:
Jan-Philipp Benecke 2025-01-18 08:27:30 +01:00 committed by GitHub
parent 8efaf2b031
commit d67c463b98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -23,6 +23,9 @@ export class HaButton extends Button {
.slot-container {
overflow: var(--button-slot-container-overflow, visible);
}
:host([destructive]) {
--mdc-theme-primary: var(--error-color);
}
`,
];
}

View File

@ -1,4 +1,4 @@
import { mdiDownload } from "@mdi/js";
import { mdiDownload, mdiTrashCan } from "@mdi/js";
import { dump } from "js-yaml";
import type { CSSResultGroup } from "lit";
import { LitElement, css, html, nothing } from "lit";
@ -162,6 +162,10 @@ class HaPanelDevAssist extends SubscribeMixin(LitElement) {
${this._results.length
? html`
<div class="result-toolbar">
<ha-button outlined @click=${this._clear} destructive>
<ha-svg-icon slot="icon" .path=${mdiTrashCan}></ha-svg-icon>
${this.hass.localize("ui.common.clear")}
</ha-button>
<ha-button outlined @click=${this._download}>
<ha-svg-icon slot="icon" .path=${mdiDownload}></ha-svg-icon>
${this.hass.localize(
@ -221,6 +225,10 @@ class HaPanelDevAssist extends SubscribeMixin(LitElement) {
);
}
private _clear() {
this._results = [];
}
static get styles(): CSSResultGroup {
return [
haStyle,