mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 17:56:46 +00:00
Use download util for diagnostics (#11349)
This commit is contained in:
parent
2d651c2a66
commit
f3642a1677
@ -330,7 +330,6 @@ class HassioBackupDialog
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileDownload(
|
fileDownload(
|
||||||
this,
|
|
||||||
signedPath.path,
|
signedPath.path,
|
||||||
`home_assistant_backup_${slugify(this._computeName)}.tar`
|
`home_assistant_backup_${slugify(this._computeName)}.tar`
|
||||||
);
|
);
|
||||||
|
@ -45,6 +45,7 @@ import {
|
|||||||
} from "../../../dialogs/generic/show-dialog-box";
|
} from "../../../dialogs/generic/show-dialog-box";
|
||||||
import { haStyle, haStyleScrollbar } from "../../../resources/styles";
|
import { haStyle, haStyleScrollbar } from "../../../resources/styles";
|
||||||
import type { HomeAssistant } from "../../../types";
|
import type { HomeAssistant } from "../../../types";
|
||||||
|
import { fileDownload } from "../../../util/file_download";
|
||||||
import type { ConfigEntryExtended } from "./ha-config-integrations";
|
import type { ConfigEntryExtended } from "./ha-config-integrations";
|
||||||
import "./ha-integration-header";
|
import "./ha-integration-header";
|
||||||
|
|
||||||
@ -647,7 +648,7 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
this.hass,
|
this.hass,
|
||||||
anchor.getAttribute("href")
|
anchor.getAttribute("href")
|
||||||
);
|
);
|
||||||
document.location.assign(signedUrl.path);
|
fileDownload(signedUrl.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
|
@ -131,7 +131,6 @@ class ZWaveJSLogs extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
private _downloadLogs() {
|
private _downloadLogs() {
|
||||||
fileDownload(
|
fileDownload(
|
||||||
this,
|
|
||||||
`data:text/plain;charset=utf-8,${encodeURIComponent(
|
`data:text/plain;charset=utf-8,${encodeURIComponent(
|
||||||
this._textarea!.value
|
this._textarea!.value
|
||||||
)}`,
|
)}`,
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
export const fileDownload = (
|
export const fileDownload = (href: string, filename = ""): void => {
|
||||||
element: HTMLElement,
|
|
||||||
href: string,
|
|
||||||
filename: string
|
|
||||||
): void => {
|
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
a.target = "_blank";
|
a.target = "_blank";
|
||||||
a.href = href;
|
a.href = href;
|
||||||
a.download = filename;
|
a.download = filename;
|
||||||
|
|
||||||
element.shadowRoot!.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.dispatchEvent(new MouseEvent("click"));
|
a.dispatchEvent(new MouseEvent("click"));
|
||||||
element.shadowRoot!.removeChild(a);
|
document.body.removeChild(a);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user