diff --git a/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts b/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts index f706f586e2..13c935e4d2 100644 --- a/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts +++ b/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts @@ -5,7 +5,10 @@ import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../../../../common/config/is_component_loaded"; import { stringCompare } from "../../../../../common/string/compare"; +import { extractSearchParam } from "../../../../../common/url/search-params"; import "../../../../../components/ha-card"; +import { getSignedPath } from "../../../../../data/auth"; +import { getConfigEntryDiagnosticsDownloadUrl } from "../../../../../data/diagnostics"; import { getOTBRInfo } from "../../../../../data/otbr"; import { listThreadDataSets, @@ -20,6 +23,7 @@ import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; import { haStyle } from "../../../../../resources/styles"; import { HomeAssistant } from "../../../../../types"; import { brandsUrl } from "../../../../../util/brands-url"; +import { fileDownload } from "../../../../../util/file_download"; interface ThreadNetwork { name: string; @@ -33,6 +37,8 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) { @property({ type: Boolean }) public narrow!: boolean; + @state() private _configEntryId: string | null = null; + @state() private _routers: ThreadRouter[] = []; @state() private _datasets: ThreadDataSet[] = []; @@ -47,6 +53,19 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) { .path=${mdiDotsVertical} slot="trigger" > + + + ${this.hass.localize( + "ui.panel.config.integrations.config_entry.download_diagnostics" + )} + + ${this.hass.localize( "ui.panel.config.thread.add_open_thread_border_router" @@ -177,6 +196,8 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) { super.firstUpdated(changedProps); this._refresh(); + + this._configEntryId = extractSearchParam("config_entry"); } private _groupRoutersByNetwork = memoizeOne( @@ -226,6 +247,16 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) { }); } + private async _signUrl(ev) { + const anchor = ev.target.closest("a"); + ev.preventDefault(); + const signedUrl = await getSignedPath( + this.hass, + anchor.getAttribute("href") + ); + fileDownload(signedUrl.path); + } + private _addOTBR() { showConfigFlowDialog(this, { dialogClosedCallback: () => { @@ -245,6 +276,9 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) { margin: 0 auto; direction: ltr; } + ha-button-menu a { + text-decoration: none; + } .routers { padding-bottom: 0; }