Skip to content

Commit

Permalink
Add clear button to Assist debug page (#23774)
Browse files Browse the repository at this point in the history
* Add clear button to Assist debug page

* Move destructive to ha-button
  • Loading branch information
jpbede authored Jan 18, 2025
1 parent 8efaf2b commit d67c463
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/components/ha-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
`,
];
}
Expand Down
10 changes: 9 additions & 1 deletion src/panels/developer-tools/assist/developer-tools-assist.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -221,6 +225,10 @@ class HaPanelDevAssist extends SubscribeMixin(LitElement) {
);
}

private _clear() {
this._results = [];
}

static get styles(): CSSResultGroup {
return [
haStyle,
Expand Down

0 comments on commit d67c463

Please sign in to comment.