From f69eb15a90c3a1f4deee2e3350806fe6ab94a0f3 Mon Sep 17 00:00:00 2001 From: Zack Barett Date: Sun, 24 Apr 2022 22:25:47 -0500 Subject: [PATCH] Config Menu: Addressing Comments in #12377 (#12399) --- src/components/ha-metric.ts | 30 ++++++++++--------- .../config/core/ha-config-section-storage.ts | 15 ++++------ .../config/zone/dialog-core-zone-detail.ts | 2 ++ src/panels/config/zone/ha-config-zone.ts | 24 ++++++++++----- src/translations/en.json | 1 + 5 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/components/ha-metric.ts b/src/components/ha-metric.ts index 2c576b9fde..77bf266941 100644 --- a/src/components/ha-metric.ts +++ b/src/components/ha-metric.ts @@ -9,25 +9,27 @@ import "./ha-settings-row"; class HaMetric extends LitElement { @property({ type: Number }) public value!: number; - @property({ type: String }) public description!: string; + @property({ type: String }) public heading!: string; @property({ type: String }) public tooltip?: string; protected render(): TemplateResult { const roundedValue = roundWithOneDecimal(this.value); - return html` - ${this.description} -
- ${roundedValue} % - 50, - "target-critical": roundedValue > 85, - })} - .value=${this.value} - > -
-
`; + return html` + + ${this.heading} +
+ ${roundedValue} % + 50, + "target-critical": roundedValue > 85, + })} + .value=${this.value} + > +
+
+ `; } static get styles(): CSSResultGroup { diff --git a/src/panels/config/core/ha-config-section-storage.ts b/src/panels/config/core/ha-config-section-storage.ts index b40eaa4d44..0d92424c96 100644 --- a/src/panels/config/core/ha-config-section-storage.ts +++ b/src/panels/config/core/ha-config-section-storage.ts @@ -1,6 +1,5 @@ import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; import { customElement, property, state } from "lit/decorators"; -import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import "../../../components/ha-alert"; import "../../../components/ha-bar"; @@ -52,7 +51,7 @@ class HaConfigSectionStorage extends LitElement { ? html` = 10 ? html` - roundWithOneDecimal(getValueInPercentage(used, 0, total)) - ); + private _getUsedSpace = (used: number, total: number) => + roundWithOneDecimal(getValueInPercentage(used, 0, total)); static styles = css` .content { diff --git a/src/panels/config/zone/dialog-core-zone-detail.ts b/src/panels/config/zone/dialog-core-zone-detail.ts index f72a959351..7c388bd964 100644 --- a/src/panels/config/zone/dialog-core-zone-detail.ts +++ b/src/panels/config/zone/dialog-core-zone-detail.ts @@ -9,8 +9,10 @@ import { fireEvent } from "../../../common/dom/fire_event"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { currencies } from "../../../components/currency-datalist"; import { createCloseHeading } from "../../../components/ha-dialog"; +import "../../../components/ha-formfield"; import { HaRadio } from "../../../components/ha-radio"; import "../../../components/ha-select"; +import "../../../components/ha-textfield"; import { ConfigUpdateValues, saveCoreConfig } from "../../../data/core"; import { SYMBOL_TO_ISO } from "../../../data/currency"; import { haStyleDialog } from "../../../resources/styles"; diff --git a/src/panels/config/zone/ha-config-zone.ts b/src/panels/config/zone/ha-config-zone.ts index e5802d069e..7b7cc1373b 100644 --- a/src/panels/config/zone/ha-config-zone.ts +++ b/src/panels/config/zone/ha-config-zone.ts @@ -1,4 +1,4 @@ -import { mdiPencil, mdiPencilOff, mdiPlus } from "@mdi/js"; +import { mdiPencil, mdiPlus } from "@mdi/js"; import "@polymer/paper-item/paper-icon-item"; import "@polymer/paper-item/paper-item-body"; import "@polymer/paper-listbox/paper-listbox"; @@ -36,7 +36,10 @@ import { Zone, ZoneMutableParams, } from "../../../data/zone"; -import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; +import { + showAlertDialog, + showConfirmationDialog, +} from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-loading-screen"; import "../../../layouts/hass-tabs-subpage"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; @@ -186,12 +189,9 @@ export class HaConfigZone extends SubscribeMixin(LitElement) { {}, + }); + return; + } showCoreZoneDetailDialog(this); } diff --git a/src/translations/en.json b/src/translations/en.json index da380f5dfc..c7fe10dbd8 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2622,6 +2622,7 @@ "add_zone": "Add Zone", "edit_zone": "Edit Zone", "confirm_delete": "Are you sure you want to delete this zone?", + "can_not_edit": "Unable to edit zone", "configured_in_yaml": "Zones configured via configuration.yaml cannot be edited via the UI.", "edit_home_zone": "The radius of the Home zone can't be edited from the frontend yet. Drag the marker on the map to move the home zone.", "edit_home_zone_narrow": "The radius of the Home zone can't be edited from the frontend yet. The location can be changed from the general configuration.",