mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-20 15:56:35 +00:00
Small config fixes (#12472)
This commit is contained in:
parent
cfba957313
commit
6822f0d067
@ -99,6 +99,7 @@ class HassSubpage extends LitElement {
|
|||||||
ha-icon-button-arrow-prev,
|
ha-icon-button-arrow-prev,
|
||||||
::slotted([slot="toolbar-icon"]) {
|
::slotted([slot="toolbar-icon"]) {
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
|
color: var(--sidebar-icon-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-title {
|
.main-title {
|
||||||
|
@ -1,15 +1,23 @@
|
|||||||
|
import "@material/mwc-list/mwc-list-item";
|
||||||
import timezones from "google-timezones-json";
|
import timezones from "google-timezones-json";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import { css, html, LitElement, TemplateResult } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
|
import memoizeOne from "memoize-one";
|
||||||
import { UNIT_C } from "../../../common/const";
|
import { UNIT_C } from "../../../common/const";
|
||||||
import { stopPropagation } from "../../../common/dom/stop_propagation";
|
import { stopPropagation } from "../../../common/dom/stop_propagation";
|
||||||
import { navigate } from "../../../common/navigate";
|
import { navigate } from "../../../common/navigate";
|
||||||
import { HaProgressButton } from "../../../components/buttons/ha-progress-button";
|
import "../../../components/buttons/ha-progress-button";
|
||||||
|
import type { HaProgressButton } from "../../../components/buttons/ha-progress-button";
|
||||||
import { currencies } from "../../../components/currency-datalist";
|
import { currencies } from "../../../components/currency-datalist";
|
||||||
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-formfield";
|
import "../../../components/ha-formfield";
|
||||||
import "../../../components/ha-radio";
|
import "../../../components/ha-radio";
|
||||||
import type { HaRadio } from "../../../components/ha-radio";
|
import type { HaRadio } from "../../../components/ha-radio";
|
||||||
|
import "../../../components/ha-select";
|
||||||
import "../../../components/ha-settings-row";
|
import "../../../components/ha-settings-row";
|
||||||
|
import "../../../components/ha-textfield";
|
||||||
|
import "../../../components/map/ha-locations-editor";
|
||||||
|
import type { MarkerLocation } from "../../../components/map/ha-locations-editor";
|
||||||
import { ConfigUpdateValues, saveCoreConfig } from "../../../data/core";
|
import { ConfigUpdateValues, saveCoreConfig } from "../../../data/core";
|
||||||
import { SYMBOL_TO_ISO } from "../../../data/currency";
|
import { SYMBOL_TO_ISO } from "../../../data/currency";
|
||||||
import "../../../layouts/hass-subpage";
|
import "../../../layouts/hass-subpage";
|
||||||
@ -34,6 +42,8 @@ class HaConfigSectionGeneral extends LitElement {
|
|||||||
|
|
||||||
@state() private _timeZone?: string;
|
@state() private _timeZone?: string;
|
||||||
|
|
||||||
|
@state() private _location?: [number, number];
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
const canEdit = ["storage", "default"].includes(
|
const canEdit = ["storage", "default"].includes(
|
||||||
this.hass.config.config_source
|
this.hass.config.config_source
|
||||||
@ -47,7 +57,7 @@ class HaConfigSectionGeneral extends LitElement {
|
|||||||
.header=${this.hass.localize("ui.panel.config.core.caption")}
|
.header=${this.hass.localize("ui.panel.config.core.caption")}
|
||||||
>
|
>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<ha-card>
|
<ha-card outlined>
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
${!canEdit
|
${!canEdit
|
||||||
? html`
|
? html`
|
||||||
@ -183,6 +193,19 @@ class HaConfigSectionGeneral extends LitElement {
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
${this.narrow
|
||||||
|
? html`
|
||||||
|
<ha-locations-editor
|
||||||
|
.hass=${this.hass}
|
||||||
|
.locations=${this._markerLocation(
|
||||||
|
this.hass.config.latitude,
|
||||||
|
this.hass.config.longitude,
|
||||||
|
this._location
|
||||||
|
)}
|
||||||
|
@location-updated=${this._locationChanged}
|
||||||
|
></ha-locations-editor>
|
||||||
|
`
|
||||||
|
: html`
|
||||||
<ha-settings-row>
|
<ha-settings-row>
|
||||||
<div slot="heading">
|
<div slot="heading">
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
@ -198,6 +221,7 @@ class HaConfigSectionGeneral extends LitElement {
|
|||||||
>${this.hass.localize("ui.common.edit")}</mwc-button
|
>${this.hass.localize("ui.common.edit")}</mwc-button
|
||||||
>
|
>
|
||||||
</ha-settings-row>
|
</ha-settings-row>
|
||||||
|
`}
|
||||||
<div class="card-actions">
|
<div class="card-actions">
|
||||||
<ha-progress-button @click=${this._updateEntry}>
|
<ha-progress-button @click=${this._updateEntry}>
|
||||||
${this.hass!.localize("ui.panel.config.zone.detail.update")}
|
${this.hass!.localize("ui.panel.config.zone.detail.update")}
|
||||||
@ -237,7 +261,11 @@ class HaConfigSectionGeneral extends LitElement {
|
|||||||
this._unitSystem = (ev.target as HaRadio).value as "metric" | "imperial";
|
this._unitSystem = (ev.target as HaRadio).value as "metric" | "imperial";
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _updateEntry(ev) {
|
private _locationChanged(ev: CustomEvent) {
|
||||||
|
this._location = ev.detail.location;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _updateEntry(ev: CustomEvent) {
|
||||||
const button = ev.target as HaProgressButton;
|
const button = ev.target as HaProgressButton;
|
||||||
if (button.progress) {
|
if (button.progress) {
|
||||||
return;
|
return;
|
||||||
@ -261,6 +289,21 @@ class HaConfigSectionGeneral extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _markerLocation = memoizeOne(
|
||||||
|
(
|
||||||
|
lat: number,
|
||||||
|
lng: number,
|
||||||
|
location?: [number, number]
|
||||||
|
): MarkerLocation[] => [
|
||||||
|
{
|
||||||
|
id: "location",
|
||||||
|
latitude: location ? location[0] : lat,
|
||||||
|
longitude: location ? location[1] : lng,
|
||||||
|
location_editable: true,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
private _editLocation() {
|
private _editLocation() {
|
||||||
navigate("/config/zone");
|
navigate("/config/zone");
|
||||||
}
|
}
|
||||||
@ -274,7 +317,7 @@ class HaConfigSectionGeneral extends LitElement {
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
ha-card {
|
ha-card {
|
||||||
max-width: 500px;
|
max-width: 600px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@ -302,6 +345,11 @@ class HaConfigSectionGeneral extends LitElement {
|
|||||||
ha-select {
|
ha-select {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
ha-locations-editor {
|
||||||
|
display: block;
|
||||||
|
height: 400px;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ class HaConfigSystemNavigation extends LitElement {
|
|||||||
>
|
>
|
||||||
<ha-button-menu
|
<ha-button-menu
|
||||||
corner="BOTTOM_START"
|
corner="BOTTOM_START"
|
||||||
slot="toolbar-icon"
|
|
||||||
@action=${this._handleAction}
|
@action=${this._handleAction}
|
||||||
|
slot="toolbar-icon"
|
||||||
>
|
>
|
||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
slot="trigger"
|
slot="trigger"
|
||||||
@ -63,11 +63,6 @@ class HaConfigSystemNavigation extends LitElement {
|
|||||||
full-width
|
full-width
|
||||||
>
|
>
|
||||||
<ha-card outlined>
|
<ha-card outlined>
|
||||||
${this.narrow
|
|
||||||
? html`<div class="title">
|
|
||||||
${this.hass.localize("ui.panel.config.dashboard.system.main")}
|
|
||||||
</div>`
|
|
||||||
: ""}
|
|
||||||
<ha-navigation-list
|
<ha-navigation-list
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user