Remove action to download state dump from zwave_js (#11348)

This commit is contained in:
Raman Gupta 2022-01-18 00:53:41 -05:00 committed by GitHub
parent ef39317019
commit 2d651c2a66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 76 deletions

View File

@ -14,13 +14,11 @@ import "../../../../../components/ha-icon-button";
import "../../../../../components/ha-fab"; import "../../../../../components/ha-fab";
import "../../../../../components/ha-icon-next"; import "../../../../../components/ha-icon-next";
import "../../../../../components/ha-svg-icon"; import "../../../../../components/ha-svg-icon";
import { getSignedPath } from "../../../../../data/auth";
import { import {
fetchZwaveDataCollectionStatus, fetchZwaveDataCollectionStatus,
fetchZwaveNetworkStatus, fetchZwaveNetworkStatus,
fetchZwaveNodeStatus, fetchZwaveNodeStatus,
fetchZwaveProvisioningEntries, fetchZwaveProvisioningEntries,
NodeStatus,
setZwaveDataCollectionPreference, setZwaveDataCollectionPreference,
ZWaveJSNetwork, ZWaveJSNetwork,
ZWaveJSNodeStatus, ZWaveJSNodeStatus,
@ -31,14 +29,9 @@ import {
getConfigEntries, getConfigEntries,
ERROR_STATES, ERROR_STATES,
} from "../../../../../data/config_entries"; } from "../../../../../data/config_entries";
import {
showAlertDialog,
showConfirmationDialog,
} from "../../../../../dialogs/generic/show-dialog-box";
import "../../../../../layouts/hass-tabs-subpage"; import "../../../../../layouts/hass-tabs-subpage";
import { haStyle } from "../../../../../resources/styles"; import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types"; import type { HomeAssistant, Route } from "../../../../../types";
import { fileDownload } from "../../../../../util/file_download";
import "../../../ha-config-section"; import "../../../ha-config-section";
import { showZWaveJSAddNodeDialog } from "./show-dialog-zwave_js-add-node"; import { showZWaveJSAddNodeDialog } from "./show-dialog-zwave_js-add-node";
import { showZWaveJSHealNetworkDialog } from "./show-dialog-zwave_js-heal-network"; import { showZWaveJSHealNetworkDialog } from "./show-dialog-zwave_js-heal-network";
@ -212,14 +205,6 @@ class ZWaveJSConfigDashboard extends LitElement {
${this._network.client.ws_server_url}<br /> ${this._network.client.ws_server_url}<br />
</div> </div>
<div class="card-actions"> <div class="card-actions">
<mwc-button
@click=${this._dumpDebugClicked}
.disabled=${this._status === "connecting"}
>
${this.hass.localize(
"ui.panel.config.zwave_js.dashboard.dump_debug"
)}
</mwc-button>
<mwc-button <mwc-button
@click=${this._removeNodeClicked} @click=${this._removeNodeClicked}
.disabled=${this._status === "connecting"} .disabled=${this._status === "connecting"}
@ -446,60 +431,6 @@ class ZWaveJSConfigDashboard extends LitElement {
showOptionsFlowDialog(this, configEntry!); showOptionsFlowDialog(this, configEntry!);
} }
private async _dumpDebugClicked() {
await this._fetchNodeStatus();
const notReadyNodes = this._nodes?.filter((node) => !node.ready);
const deadNodes = this._nodes?.filter(
(node) => node.status === NodeStatus.Dead
);
if (deadNodes?.length) {
await showAlertDialog(this, {
title: this.hass.localize(
"ui.panel.config.zwave_js.dashboard.dump_dead_nodes_title"
),
text: this.hass.localize(
"ui.panel.config.zwave_js.dashboard.dump_dead_nodes_text"
),
});
}
if (
notReadyNodes?.length &&
notReadyNodes.length !== deadNodes?.length &&
!(await showConfirmationDialog(this, {
title: this.hass.localize(
"ui.panel.config.zwave_js.dashboard.dump_not_ready_title"
),
text: this.hass.localize(
"ui.panel.config.zwave_js.dashboard.dump_not_ready_text"
),
confirmText: this.hass.localize(
"ui.panel.config.zwave_js.dashboard.dump_not_ready_confirm"
),
}))
) {
return;
}
let signedPath: { path: string };
try {
signedPath = await getSignedPath(
this.hass,
`/api/zwave_js/dump/${this.configEntryId}`
);
} catch (err: any) {
showAlertDialog(this, {
title: "Error",
text: err.error || err.body || err,
});
return;
}
fileDownload(this, signedPath.path, `zwave_js_dump.jsonl`);
}
static get styles(): CSSResultGroup { static get styles(): CSSResultGroup {
return [ return [
haStyle, haStyle,

View File

@ -2896,13 +2896,7 @@
"server_url": "Server URL", "server_url": "Server URL",
"devices": "{count} {count, plural,\n one {device}\n other {devices}\n}", "devices": "{count} {count, plural,\n one {device}\n other {devices}\n}",
"provisioned_devices": "Provisioned devices", "provisioned_devices": "Provisioned devices",
"not_ready": "{count} not ready", "not_ready": "{count} not ready"
"dump_debug": "Download data",
"dump_dead_nodes_title": "Some of your devices are dead",
"dump_dead_nodes_text": "Some of your devices didn't respond and are assumed dead. These will not be fully exported.",
"dump_not_ready_title": "Not all devices are ready yet",
"dump_not_ready_text": "If you create an export while not all devices are ready, you could miss needed data. Give your network some time to query all devices. Do you want to continue with the dump?",
"dump_not_ready_confirm": "Download"
}, },
"device_info": { "device_info": {
"zwave_info": "Z-Wave Info", "zwave_info": "Z-Wave Info",