From e99f20c4f3630ddda0f3b4c8f5f6f71b4b693199 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 3 Dec 2021 01:51:50 -0800 Subject: [PATCH] Tweak ZJS dashboard (#10772) --- .../zwave_js/zwave_js-config-dashboard.ts | 112 ++++++++++++------ src/translations/en.json | 6 +- 2 files changed, 82 insertions(+), 36 deletions(-) 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 e7e97addf4..fd68822b05 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 @@ -1,10 +1,17 @@ import "@material/mwc-button/mwc-button"; -import { mdiAlertCircle, mdiCheckCircle, mdiCircle, mdiRefresh } from "@mdi/js"; +import { + mdiAlertCircle, + mdiCheckCircle, + mdiCircle, + mdiPlus, + mdiRefresh, +} from "@mdi/js"; import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import "../../../../../components/ha-card"; import "../../../../../components/ha-icon-button"; +import "../../../../../components/ha-fab"; import "../../../../../components/ha-icon-next"; import "../../../../../components/ha-svg-icon"; import { getSignedPath } from "../../../../../data/auth"; @@ -36,6 +43,7 @@ import { showZWaveJSHealNetworkDialog } from "./show-dialog-zwave_js-heal-networ import { showZWaveJSRemoveNodeDialog } from "./show-dialog-zwave_js-remove-node"; import { configTabs } from "./zwave_js-config-router"; import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow"; +import { computeRTL } from "../../../../../common/util/compute_rtl"; @customElement("zwave_js-config-dashboard") class ZWaveJSConfigDashboard extends LitElement { @@ -76,6 +84,9 @@ class ZWaveJSConfigDashboard extends LitElement { return this._renderErrorScreen(); } + const notReadyDevices = + this._nodes?.filter((node) => node.ready).length ?? 0; + return html` - ${this._network.client.ws_server_url} + + ${this.hass.localize( + `ui.panel.config.zwave_js.dashboard.devices`, + { + count: + this._network.controller.nodes.length, + } + )} + ${notReadyDevices > 0 + ? html`(${this.hass.localize( + `ui.panel.config.zwave_js.dashboard.not_ready`, + { count: notReadyDevices } + )})` + : ""} + ` : ``} -
- ${this.hass.localize( - "ui.panel.config.zwave_js.dashboard.driver_version" - )}: - ${this._network.client.driver_version}
- ${this.hass.localize( - "ui.panel.config.zwave_js.dashboard.server_version" - )}: - ${this._network.client.server_version}
- ${this.hass.localize( - "ui.panel.config.zwave_js.dashboard.home_id" - )}: - ${this._network.controller.home_id}
- ${this.hass.localize( - "ui.panel.config.zwave_js.dashboard.nodes_ready" - )}: - ${this._nodes?.filter((node) => node.ready).length ?? 0} / - ${this._network.controller.nodes.length} -
- +
+ + +
+ ${this.hass.localize( + "ui.panel.config.zwave_js.dashboard.driver_version" + )}: + ${this._network.client.driver_version}
+ ${this.hass.localize( + "ui.panel.config.zwave_js.dashboard.server_version" + )}: + ${this._network.client.server_version}
+ ${this.hass.localize( + "ui.panel.config.zwave_js.dashboard.home_id" + )}: + ${this._network.controller.home_id}
+ ${this.hass.localize( + "ui.panel.config.zwave_js.dashboard.server_url" + )}: + ${this._network.client.ws_server_url}
+
+
+ ${this.hass.localize( - "ui.panel.config.zwave_js.common.add_node" + "ui.panel.config.zwave_js.dashboard.dump_debug" )} - + ${this.hass.localize( "ui.panel.config.zwave_js.common.remove_node" )} - + ${this.hass.localize( "ui.panel.config.zwave_js.common.heal_network" )} - + ${this.hass.localize( "ui.panel.config.zwave_js.common.reconfigure_server" )} @@ -229,12 +267,19 @@ class ZWaveJSConfigDashboard extends LitElement { ` : ``} - + + + `; } @@ -486,7 +531,6 @@ class ZWaveJSConfigDashboard extends LitElement { .network-status div.heading { display: flex; align-items: center; - margin-bottom: 16px; } .network-status div.heading .icon { diff --git a/src/translations/en.json b/src/translations/en.json index d92bd7b38f..4ee6773a57 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2808,8 +2808,10 @@ "driver_version": "Driver Version", "server_version": "Server Version", "home_id": "Home ID", - "nodes_ready": "Devices ready", - "dump_debug": "Download a dump of your network to help diagnose issues", + "server_url": "Server URL", + "devices": "{count} {count, plural,\n one {device}\n other {devices}\n}", + "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",