From d93db169631f6862164a80c40e326d3bc7454211 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Thu, 24 Jun 2021 13:21:30 +0200 Subject: [PATCH] Add button for zwave_js options flow (#9001) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Joakim Sørensen --- .../zwave_js/zwave_js-config-dashboard.ts | 18 ++++++++++++++++++ src/translations/en.json | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts index 44c66b7ba4..07e0b72d9f 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts @@ -29,6 +29,8 @@ import "../../../ha-config-section"; import { showZWaveJSAddNodeDialog } from "./show-dialog-zwave_js-add-node"; import { showZWaveJSRemoveNodeDialog } from "./show-dialog-zwave_js-remove-node"; import { configTabs } from "./zwave_js-config-router"; +import { getConfigEntries } from "../../../../../data/config_entries"; +import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow"; @customElement("zwave_js-config-dashboard") class ZWaveJSConfigDashboard extends LitElement { @@ -162,6 +164,11 @@ class ZWaveJSConfigDashboard extends LitElement { "ui.panel.config.zwave_js.common.remove_node" )} + + ${this.hass.localize( + "ui.panel.config.zwave_js.common.reconfigure_server" + )} + @@ -262,6 +269,17 @@ class ZWaveJSConfigDashboard extends LitElement { ); } + private async _openOptionFlow() { + if (!this.configEntryId) { + return; + } + const configEntries = await getConfigEntries(this.hass); + const configEntry = configEntries.find( + (entry) => entry.entry_id === this.configEntryId + ); + showOptionsFlowDialog(this, configEntry!); + } + private async _dumpDebugClicked() { await this._fetchNodeStatus(); diff --git a/src/translations/en.json b/src/translations/en.json index 030742b168..4896d0c5bd 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2587,7 +2587,8 @@ "home_id": "Home ID", "close": "Close", "add_node": "Add Node", - "remove_node": "Remove Node" + "remove_node": "Remove Node", + "reconfigure_server": "Re-configure Server" }, "dashboard": { "header": "Manage your Z-Wave Network",