mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 23:17:21 +00:00
Compare commits
10 Commits
show-proto
...
fixed_ener
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6745a97f86 | ||
|
|
a8286e31a0 | ||
|
|
4fa7274fbe | ||
|
|
414c1315a4 | ||
|
|
04bfc350ea | ||
|
|
75ec9404ce | ||
|
|
41cabde393 | ||
|
|
47d1fdf673 | ||
|
|
e59e83fffe | ||
|
|
b896b78876 |
@@ -101,6 +101,10 @@ const Component = Vue.extend({
|
|||||||
type: String,
|
type: String,
|
||||||
default: "en",
|
default: "en",
|
||||||
},
|
},
|
||||||
|
opensVertical: {
|
||||||
|
type: String,
|
||||||
|
default: undefined,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
render(createElement) {
|
render(createElement) {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
@@ -129,6 +133,11 @@ const Component = Vue.extend({
|
|||||||
},
|
},
|
||||||
expression: "dateRange",
|
expression: "dateRange",
|
||||||
},
|
},
|
||||||
|
on: {
|
||||||
|
toggle: (open: boolean) => {
|
||||||
|
fireEvent(this.$el as HTMLElement, "toggle", { open });
|
||||||
|
},
|
||||||
|
},
|
||||||
scopedSlots: {
|
scopedSlots: {
|
||||||
input() {
|
input() {
|
||||||
return createElement("slot", {
|
return createElement("slot", {
|
||||||
@@ -309,6 +318,10 @@ class DateRangePickerElement extends WrappedElement {
|
|||||||
min-width: unset !important;
|
min-width: unset !important;
|
||||||
display: block !important;
|
display: block !important;
|
||||||
}
|
}
|
||||||
|
:host([opens-vertical="up"]) .daterangepicker {
|
||||||
|
bottom: 100%;
|
||||||
|
top: auto !important;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
if (mainWindow.document.dir === "rtl") {
|
if (mainWindow.document.dir === "rtl") {
|
||||||
style.innerHTML += `
|
style.innerHTML += `
|
||||||
@@ -340,4 +353,7 @@ declare global {
|
|||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
"date-range-picker": DateRangePickerElement;
|
"date-range-picker": DateRangePickerElement;
|
||||||
}
|
}
|
||||||
|
interface HASSDomEvents {
|
||||||
|
toggle: { open: boolean };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ export class HaDateRangePicker extends LitElement {
|
|||||||
@property({ attribute: "extended-presets", type: Boolean })
|
@property({ attribute: "extended-presets", type: Boolean })
|
||||||
public extendedPresets = false;
|
public extendedPresets = false;
|
||||||
|
|
||||||
|
@property({ attribute: "vertical-opening-direction" })
|
||||||
|
public verticalOpeningDirection?: "up" | "down";
|
||||||
|
|
||||||
@property({ attribute: false }) public openingDirection?:
|
@property({ attribute: false }) public openingDirection?:
|
||||||
| "right"
|
| "right"
|
||||||
| "left"
|
| "left"
|
||||||
@@ -127,6 +130,7 @@ export class HaDateRangePicker extends LitElement {
|
|||||||
opening-direction=${ifDefined(
|
opening-direction=${ifDefined(
|
||||||
this.openingDirection || this._calcedOpeningDirection
|
this.openingDirection || this._calcedOpeningDirection
|
||||||
)}
|
)}
|
||||||
|
opens-vertical=${ifDefined(this.verticalOpeningDirection)}
|
||||||
first-day=${firstWeekdayIndex(this.hass.locale)}
|
first-day=${firstWeekdayIndex(this.hass.locale)}
|
||||||
language=${this.hass.locale.language}
|
language=${this.hass.locale.language}
|
||||||
@change=${this._handleChange}
|
@change=${this._handleChange}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { mdiClose, mdiDragHorizontalVariant, mdiTextureBox } from "@mdi/js";
|
import { mdiDragHorizontalVariant, mdiTextureBox } from "@mdi/js";
|
||||||
import type { CSSResultGroup } from "lit";
|
import type { CSSResultGroup } from "lit";
|
||||||
import { LitElement, css, html, nothing } from "lit";
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { repeat } from "lit/directives/repeat";
|
import { repeat } from "lit/directives/repeat";
|
||||||
import {
|
import {
|
||||||
type AreasFloorHierarchy,
|
type AreasFloorHierarchy,
|
||||||
@@ -11,12 +11,10 @@ import {
|
|||||||
} from "../../../common/areas/areas-floor-hierarchy";
|
} from "../../../common/areas/areas-floor-hierarchy";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
import "../../../components/ha-button";
|
import "../../../components/ha-button";
|
||||||
import "../../../components/ha-dialog-header";
|
import "../../../components/ha-dialog-footer";
|
||||||
import "../../../components/ha-floor-icon";
|
import "../../../components/ha-floor-icon";
|
||||||
import "../../../components/ha-icon";
|
import "../../../components/ha-icon";
|
||||||
import "../../../components/ha-icon-button";
|
import "../../../components/ha-wa-dialog";
|
||||||
import "../../../components/ha-md-dialog";
|
|
||||||
import type { HaMdDialog } from "../../../components/ha-md-dialog";
|
|
||||||
import "../../../components/ha-md-list";
|
import "../../../components/ha-md-list";
|
||||||
import "../../../components/ha-md-list-item";
|
import "../../../components/ha-md-list-item";
|
||||||
import "../../../components/ha-sortable";
|
import "../../../components/ha-sortable";
|
||||||
@@ -49,8 +47,6 @@ class DialogAreasFloorsOrder extends LitElement {
|
|||||||
|
|
||||||
@state() private _saving = false;
|
@state() private _saving = false;
|
||||||
|
|
||||||
@query("ha-md-dialog") private _dialog?: HaMdDialog;
|
|
||||||
|
|
||||||
public async showDialog(
|
public async showDialog(
|
||||||
_params: AreasFloorsOrderDialogParams
|
_params: AreasFloorsOrderDialogParams
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@@ -66,7 +62,8 @@ class DialogAreasFloorsOrder extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog(): void {
|
||||||
this._dialog?.close();
|
this._saving = false;
|
||||||
|
this._open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _dialogClosed(): void {
|
private _dialogClosed(): void {
|
||||||
@@ -77,7 +74,7 @@ class DialogAreasFloorsOrder extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (!this._open || !this._hierarchy) {
|
if (!this._hierarchy) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,17 +86,13 @@ class DialogAreasFloorsOrder extends LitElement {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-md-dialog open @closed=${this._dialogClosed}>
|
<ha-wa-dialog
|
||||||
<ha-dialog-header slot="headline">
|
.hass=${this.hass}
|
||||||
<ha-icon-button
|
.open=${this._open}
|
||||||
slot="navigationIcon"
|
header-title=${dialogTitle}
|
||||||
.label=${this.hass.localize("ui.common.close")}
|
@closed=${this._dialogClosed}
|
||||||
.path=${mdiClose}
|
>
|
||||||
@click=${this.closeDialog}
|
<div class="content">
|
||||||
></ha-icon-button>
|
|
||||||
<span slot="title" .title=${dialogTitle}>${dialogTitle}</span>
|
|
||||||
</ha-dialog-header>
|
|
||||||
<div slot="content" class="content">
|
|
||||||
<ha-sortable
|
<ha-sortable
|
||||||
handle-selector=".floor-handle"
|
handle-selector=".floor-handle"
|
||||||
draggable-selector=".floor"
|
draggable-selector=".floor"
|
||||||
@@ -116,15 +109,23 @@ class DialogAreasFloorsOrder extends LitElement {
|
|||||||
</ha-sortable>
|
</ha-sortable>
|
||||||
${this._renderUnassignedAreas()}
|
${this._renderUnassignedAreas()}
|
||||||
</div>
|
</div>
|
||||||
<div slot="actions">
|
<ha-dialog-footer slot="footer">
|
||||||
<ha-button @click=${this.closeDialog} appearance="plain">
|
<ha-button
|
||||||
|
slot="secondaryAction"
|
||||||
|
@click=${this.closeDialog}
|
||||||
|
appearance="plain"
|
||||||
|
>
|
||||||
${this.hass.localize("ui.common.cancel")}
|
${this.hass.localize("ui.common.cancel")}
|
||||||
</ha-button>
|
</ha-button>
|
||||||
<ha-button @click=${this._save} .disabled=${this._saving}>
|
<ha-button
|
||||||
|
slot="primaryAction"
|
||||||
|
@click=${this._save}
|
||||||
|
.disabled=${this._saving}
|
||||||
|
>
|
||||||
${this.hass.localize("ui.common.save")}
|
${this.hass.localize("ui.common.save")}
|
||||||
</ha-button>
|
</ha-button>
|
||||||
</div>
|
</ha-dialog-footer>
|
||||||
</ha-md-dialog>
|
</ha-wa-dialog>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,15 +392,13 @@ class DialogAreasFloorsOrder extends LitElement {
|
|||||||
haStyle,
|
haStyle,
|
||||||
haStyleDialog,
|
haStyleDialog,
|
||||||
css`
|
css`
|
||||||
ha-md-dialog {
|
ha-wa-dialog {
|
||||||
min-width: 600px;
|
|
||||||
max-height: 90%;
|
max-height: 90%;
|
||||||
--dialog-content-padding: 8px 24px;
|
--dialog-content-padding: var(--ha-space-2) var(--ha-space-6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (max-width: 600px), all and (max-height: 500px) {
|
@media all and (max-width: 580px), all and (max-height: 500px) {
|
||||||
ha-md-dialog {
|
ha-wa-dialog {
|
||||||
--md-dialog-container-shape: 0;
|
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import { mdiClose, mdiContentCopy, mdiDownload } from "@mdi/js";
|
import { mdiClose, mdiContentCopy, mdiDownload } from "@mdi/js";
|
||||||
import type { CSSResultGroup } from "lit";
|
import type { CSSResultGroup } from "lit";
|
||||||
import { LitElement, css, html, nothing } from "lit";
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
import { copyToClipboard } from "../../../../common/util/copy-clipboard";
|
import { copyToClipboard } from "../../../../common/util/copy-clipboard";
|
||||||
import "../../../../components/ha-button";
|
import "../../../../components/ha-button";
|
||||||
import "../../../../components/ha-dialog-header";
|
import "../../../../components/ha-dialog-footer";
|
||||||
import "../../../../components/ha-icon-button";
|
import "../../../../components/ha-icon-button";
|
||||||
import "../../../../components/ha-icon-button-prev";
|
import "../../../../components/ha-icon-button-prev";
|
||||||
import "../../../../components/ha-md-dialog";
|
import "../../../../components/ha-wa-dialog";
|
||||||
import type { HaMdDialog } from "../../../../components/ha-md-dialog";
|
|
||||||
import "../../../../components/ha-md-list";
|
import "../../../../components/ha-md-list";
|
||||||
import "../../../../components/ha-md-list-item";
|
import "../../../../components/ha-md-list-item";
|
||||||
import "../../../../components/ha-password-field";
|
import "../../../../components/ha-password-field";
|
||||||
@@ -31,20 +30,18 @@ type Step = (typeof STEPS)[number];
|
|||||||
class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@state() private _opened = false;
|
@state() private _open = false;
|
||||||
|
|
||||||
@state() private _step?: Step;
|
@state() private _step?: Step;
|
||||||
|
|
||||||
@state() private _params?: ChangeBackupEncryptionKeyDialogParams;
|
@state() private _params?: ChangeBackupEncryptionKeyDialogParams;
|
||||||
|
|
||||||
@query("ha-md-dialog") private _dialog!: HaMdDialog;
|
|
||||||
|
|
||||||
@state() private _newEncryptionKey?: string;
|
@state() private _newEncryptionKey?: string;
|
||||||
|
|
||||||
public showDialog(params: ChangeBackupEncryptionKeyDialogParams): void {
|
public showDialog(params: ChangeBackupEncryptionKeyDialogParams): void {
|
||||||
this._params = params;
|
this._params = params;
|
||||||
this._step = STEPS[0];
|
this._step = STEPS[0];
|
||||||
this._opened = true;
|
this._open = true;
|
||||||
this._newEncryptionKey = generateEncryptionKey();
|
this._newEncryptionKey = generateEncryptionKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,10 +49,10 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
if (this._params!.cancel) {
|
if (this._params!.cancel) {
|
||||||
this._params!.cancel();
|
this._params!.cancel();
|
||||||
}
|
}
|
||||||
if (this._opened) {
|
if (this._open) {
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
this._opened = false;
|
this._open = false;
|
||||||
this._step = undefined;
|
this._step = undefined;
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._newEncryptionKey = undefined;
|
this._newEncryptionKey = undefined;
|
||||||
@@ -64,7 +61,7 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
|
|
||||||
private _done() {
|
private _done() {
|
||||||
this._params?.submit!(true);
|
this._params?.submit!(true);
|
||||||
this._dialog.close();
|
this.closeDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _previousStep() {
|
private _previousStep() {
|
||||||
@@ -84,10 +81,6 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (!this._opened || !this._params) {
|
|
||||||
return nothing;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dialogTitle =
|
const dialogTitle =
|
||||||
this._step === "current" || this._step === "new"
|
this._step === "current" || this._step === "new"
|
||||||
? this.hass.localize(
|
? this.hass.localize(
|
||||||
@@ -96,36 +89,40 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
: "";
|
: "";
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-md-dialog disable-cancel-action open @closed=${this.closeDialog}>
|
<ha-wa-dialog
|
||||||
<ha-dialog-header slot="headline">
|
.hass=${this.hass}
|
||||||
${this._step === "new"
|
.open=${this._open}
|
||||||
? html`
|
header-title=${dialogTitle}
|
||||||
<ha-icon-button-prev
|
prevent-scrim-close
|
||||||
slot="navigationIcon"
|
@closed=${this.closeDialog}
|
||||||
@click=${this._previousStep}
|
>
|
||||||
></ha-icon-button-prev>
|
${this._step === "new"
|
||||||
`
|
? html`
|
||||||
: html`
|
<ha-icon-button-prev
|
||||||
<ha-icon-button
|
slot="headerNavigationIcon"
|
||||||
slot="navigationIcon"
|
@click=${this._previousStep}
|
||||||
.label=${this.hass.localize("ui.common.close")}
|
></ha-icon-button-prev>
|
||||||
.path=${mdiClose}
|
`
|
||||||
@click=${this.closeDialog}
|
: html`
|
||||||
></ha-icon-button>
|
<ha-icon-button
|
||||||
`}
|
slot="headerNavigationIcon"
|
||||||
<span slot="title">${dialogTitle}</span>
|
data-dialog="close"
|
||||||
</ha-dialog-header>
|
.label=${this.hass.localize("ui.common.close")}
|
||||||
<div slot="content">${this._renderStepContent()}</div>
|
.path=${mdiClose}
|
||||||
<div slot="actions">
|
></ha-icon-button>
|
||||||
|
`}
|
||||||
|
${this._renderStepContent()}
|
||||||
|
<ha-dialog-footer slot="footer">
|
||||||
${this._step === "current"
|
${this._step === "current"
|
||||||
? html`
|
? html`
|
||||||
<ha-button @click=${this._nextStep}>
|
<ha-button slot="primaryAction" @click=${this._nextStep}>
|
||||||
${this.hass.localize("ui.common.next")}
|
${this.hass.localize("ui.common.next")}
|
||||||
</ha-button>
|
</ha-button>
|
||||||
`
|
`
|
||||||
: this._step === "new"
|
: this._step === "new"
|
||||||
? html`
|
? html`
|
||||||
<ha-button
|
<ha-button
|
||||||
|
slot="primaryAction"
|
||||||
@click=${this._submit}
|
@click=${this._submit}
|
||||||
.disabled=${!this._newEncryptionKey}
|
.disabled=${!this._newEncryptionKey}
|
||||||
variant="danger"
|
variant="danger"
|
||||||
@@ -136,14 +133,14 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
</ha-button>
|
</ha-button>
|
||||||
`
|
`
|
||||||
: html`
|
: html`
|
||||||
<ha-button @click=${this._done}>
|
<ha-button slot="primaryAction" @click=${this._done}>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.backup.dialogs.change_encryption_key.actions.done"
|
"ui.panel.config.backup.dialogs.change_encryption_key.actions.done"
|
||||||
)}
|
)}
|
||||||
</ha-button>
|
</ha-button>
|
||||||
`}
|
`}
|
||||||
</div>
|
</ha-dialog-footer>
|
||||||
</ha-md-dialog>
|
</ha-wa-dialog>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,10 +284,8 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
haStyle,
|
haStyle,
|
||||||
haStyleDialog,
|
haStyleDialog,
|
||||||
css`
|
css`
|
||||||
ha-md-dialog {
|
ha-wa-dialog {
|
||||||
width: 90vw;
|
--dialog-content-padding: var(--ha-space-2) var(--ha-space-6);
|
||||||
max-width: 560px;
|
|
||||||
--dialog-content-padding: 8px 24px;
|
|
||||||
}
|
}
|
||||||
ha-md-list {
|
ha-md-list {
|
||||||
background: none;
|
background: none;
|
||||||
@@ -321,14 +316,7 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
flex: none;
|
flex: none;
|
||||||
margin: -16px;
|
margin: -16px;
|
||||||
}
|
}
|
||||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
|
||||||
ha-md-dialog {
|
|
||||||
max-width: none;
|
|
||||||
}
|
|
||||||
div[slot="content"] {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p {
|
p {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
import { mdiClose } from "@mdi/js";
|
|
||||||
import type { CSSResultGroup } from "lit";
|
import type { CSSResultGroup } from "lit";
|
||||||
import { LitElement, css, html, nothing } from "lit";
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
import "../../../../components/ha-dialog-header";
|
|
||||||
import "../../../../components/ha-icon-button";
|
|
||||||
import "../../../../components/ha-icon-next";
|
|
||||||
import "../../../../components/ha-md-dialog";
|
|
||||||
import type { HaMdDialog } from "../../../../components/ha-md-dialog";
|
|
||||||
import "../../../../components/ha-md-list";
|
|
||||||
import "../../../../components/ha-md-list-item";
|
|
||||||
import "../../../../components/ha-svg-icon";
|
|
||||||
import "../../../../components/ha-password-field";
|
|
||||||
import "../../../../components/ha-alert";
|
import "../../../../components/ha-alert";
|
||||||
|
import "../../../../components/ha-button";
|
||||||
|
import "../../../../components/ha-dialog-footer";
|
||||||
|
import "../../../../components/ha-wa-dialog";
|
||||||
|
import "../../../../components/ha-password-field";
|
||||||
import {
|
import {
|
||||||
canDecryptBackupOnDownload,
|
canDecryptBackupOnDownload,
|
||||||
getPreferredAgentForDownload,
|
getPreferredAgentForDownload,
|
||||||
@@ -27,102 +21,96 @@ import type { DownloadDecryptedBackupDialogParams } from "./show-dialog-download
|
|||||||
class DialogDownloadDecryptedBackup extends LitElement implements HassDialog {
|
class DialogDownloadDecryptedBackup extends LitElement implements HassDialog {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@state() private _opened = false;
|
@state() private _open = false;
|
||||||
|
|
||||||
@state() private _params?: DownloadDecryptedBackupDialogParams;
|
@state() private _params?: DownloadDecryptedBackupDialogParams;
|
||||||
|
|
||||||
@query("ha-md-dialog") private _dialog?: HaMdDialog;
|
|
||||||
|
|
||||||
@state() private _encryptionKey = "";
|
@state() private _encryptionKey = "";
|
||||||
|
|
||||||
@state() private _error = "";
|
@state() private _error = "";
|
||||||
|
|
||||||
public showDialog(params: DownloadDecryptedBackupDialogParams): void {
|
public showDialog(params: DownloadDecryptedBackupDialogParams): void {
|
||||||
this._opened = true;
|
this._open = true;
|
||||||
this._params = params;
|
this._params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog() {
|
public closeDialog() {
|
||||||
this._dialog?.close();
|
this._open = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _dialogClosed() {
|
private _dialogClosed() {
|
||||||
if (this._opened) {
|
if (this._open) {
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
}
|
}
|
||||||
this._opened = false;
|
this._open = false;
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._encryptionKey = "";
|
this._encryptionKey = "";
|
||||||
this._error = "";
|
this._error = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (!this._opened || !this._params) {
|
if (!this._params) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-md-dialog open @closed=${this._dialogClosed} disable-cancel-action>
|
<ha-wa-dialog
|
||||||
<ha-dialog-header slot="headline">
|
.hass=${this.hass}
|
||||||
<ha-icon-button
|
.open=${this._open}
|
||||||
slot="navigationIcon"
|
header-title=${this.hass.localize(
|
||||||
@click=${this.closeDialog}
|
"ui.panel.config.backup.dialogs.download.title"
|
||||||
.label=${this.hass.localize("ui.common.close")}
|
)}
|
||||||
.path=${mdiClose}
|
prevent-scrim-close
|
||||||
></ha-icon-button>
|
@closed=${this._dialogClosed}
|
||||||
<span slot="title">
|
>
|
||||||
${this.hass.localize(
|
<p>
|
||||||
"ui.panel.config.backup.dialogs.download.title"
|
${this.hass.localize(
|
||||||
)}
|
"ui.panel.config.backup.dialogs.download.description"
|
||||||
</span>
|
)}
|
||||||
</ha-dialog-header>
|
</p>
|
||||||
|
<p>
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.backup.dialogs.download.download_backup_encrypted",
|
||||||
|
{
|
||||||
|
download_it_encrypted: html`<button
|
||||||
|
class="link"
|
||||||
|
@click=${this._downloadEncrypted}
|
||||||
|
>
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.backup.dialogs.download.download_it_encrypted"
|
||||||
|
)}
|
||||||
|
</button>`,
|
||||||
|
}
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
|
||||||
<div slot="content">
|
<ha-password-field
|
||||||
<p>
|
.label=${this.hass.localize(
|
||||||
${this.hass.localize(
|
"ui.panel.config.backup.dialogs.download.encryption_key"
|
||||||
"ui.panel.config.backup.dialogs.download.description"
|
)}
|
||||||
)}
|
@input=${this._keyChanged}
|
||||||
</p>
|
></ha-password-field>
|
||||||
<p>
|
|
||||||
${this.hass.localize(
|
|
||||||
"ui.panel.config.backup.dialogs.download.download_backup_encrypted",
|
|
||||||
{
|
|
||||||
download_it_encrypted: html`<button
|
|
||||||
class="link"
|
|
||||||
@click=${this._downloadEncrypted}
|
|
||||||
>
|
|
||||||
${this.hass.localize(
|
|
||||||
"ui.panel.config.backup.dialogs.download.download_it_encrypted"
|
|
||||||
)}
|
|
||||||
</button>`,
|
|
||||||
}
|
|
||||||
)}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ha-password-field
|
${this._error
|
||||||
.label=${this.hass.localize(
|
? html`<ha-alert alert-type="error">${this._error}</ha-alert>`
|
||||||
"ui.panel.config.backup.dialogs.download.encryption_key"
|
: nothing}
|
||||||
)}
|
<ha-dialog-footer slot="footer">
|
||||||
@input=${this._keyChanged}
|
<ha-button
|
||||||
></ha-password-field>
|
slot="secondaryAction"
|
||||||
|
appearance="plain"
|
||||||
${this._error
|
@click=${this._cancel}
|
||||||
? html`<ha-alert alert-type="error">${this._error}</ha-alert>`
|
>
|
||||||
: nothing}
|
|
||||||
</div>
|
|
||||||
<div slot="actions">
|
|
||||||
<ha-button appearance="plain" @click=${this._cancel}>
|
|
||||||
${this.hass.localize("ui.common.cancel")}
|
${this.hass.localize("ui.common.cancel")}
|
||||||
</ha-button>
|
</ha-button>
|
||||||
|
|
||||||
<ha-button @click=${this._submit}>
|
<ha-button slot="primaryAction" @click=${this._submit}>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.backup.dialogs.download.download"
|
"ui.panel.config.backup.dialogs.download.download"
|
||||||
)}
|
)}
|
||||||
</ha-button>
|
</ha-button>
|
||||||
</div>
|
</ha-dialog-footer>
|
||||||
</ha-md-dialog>
|
</ha-wa-dialog>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,17 +179,8 @@ class DialogDownloadDecryptedBackup extends LitElement implements HassDialog {
|
|||||||
haStyle,
|
haStyle,
|
||||||
haStyleDialog,
|
haStyleDialog,
|
||||||
css`
|
css`
|
||||||
ha-md-dialog {
|
ha-wa-dialog {
|
||||||
--dialog-content-padding: 8px 24px;
|
--dialog-content-padding: var(--ha-space-2) var(--ha-space-6);
|
||||||
max-width: 500px;
|
|
||||||
}
|
|
||||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
|
||||||
ha-md-dialog {
|
|
||||||
max-width: none;
|
|
||||||
}
|
|
||||||
div[slot="content"] {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button.link {
|
button.link {
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import { mdiClose, mdiContentCopy, mdiDownload } from "@mdi/js";
|
import { mdiClose, mdiContentCopy, mdiDownload } from "@mdi/js";
|
||||||
import type { CSSResultGroup } from "lit";
|
import type { CSSResultGroup } from "lit";
|
||||||
import { LitElement, css, html, nothing } from "lit";
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
import { copyToClipboard } from "../../../../common/util/copy-clipboard";
|
import { copyToClipboard } from "../../../../common/util/copy-clipboard";
|
||||||
import "../../../../components/ha-button";
|
import "../../../../components/ha-button";
|
||||||
import "../../../../components/ha-dialog-header";
|
import "../../../../components/ha-dialog-footer";
|
||||||
import "../../../../components/ha-icon-button";
|
import "../../../../components/ha-icon-button";
|
||||||
import "../../../../components/ha-icon-button-prev";
|
import "../../../../components/ha-icon-button-prev";
|
||||||
import "../../../../components/ha-md-dialog";
|
import "../../../../components/ha-wa-dialog";
|
||||||
import type { HaMdDialog } from "../../../../components/ha-md-dialog";
|
|
||||||
import "../../../../components/ha-md-list";
|
import "../../../../components/ha-md-list";
|
||||||
import "../../../../components/ha-md-list-item";
|
import "../../../../components/ha-md-list-item";
|
||||||
import "../../../../components/ha-password-field";
|
import "../../../../components/ha-password-field";
|
||||||
@@ -24,89 +23,83 @@ import type { ShowBackupEncryptionKeyDialogParams } from "./show-dialog-show-bac
|
|||||||
class DialogShowBackupEncryptionKey extends LitElement implements HassDialog {
|
class DialogShowBackupEncryptionKey extends LitElement implements HassDialog {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@state() private _params?: ShowBackupEncryptionKeyDialogParams;
|
@state() private _open = false;
|
||||||
|
|
||||||
@query("ha-md-dialog") private _dialog!: HaMdDialog;
|
@state() private _params?: ShowBackupEncryptionKeyDialogParams;
|
||||||
|
|
||||||
public showDialog(params: ShowBackupEncryptionKeyDialogParams): void {
|
public showDialog(params: ShowBackupEncryptionKeyDialogParams): void {
|
||||||
this._params = params;
|
this._params = params;
|
||||||
|
this._open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog() {
|
public closeDialog() {
|
||||||
|
if (this._open) {
|
||||||
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
}
|
||||||
|
this._open = false;
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _closeDialog() {
|
|
||||||
this._dialog.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-md-dialog disable-cancel-action open @closed=${this.closeDialog}>
|
<ha-wa-dialog
|
||||||
<ha-dialog-header slot="headline">
|
.hass=${this.hass}
|
||||||
|
.open=${this._open}
|
||||||
|
header-title=${this.hass.localize(
|
||||||
|
"ui.panel.config.backup.dialogs.show_encryption_key.title"
|
||||||
|
)}
|
||||||
|
prevent-scrim-close
|
||||||
|
@closed=${this.closeDialog}
|
||||||
|
>
|
||||||
|
<ha-icon-button
|
||||||
|
slot="headerNavigationIcon"
|
||||||
|
data-dialog="close"
|
||||||
|
.label=${this.hass.localize("ui.common.close")}
|
||||||
|
.path=${mdiClose}
|
||||||
|
></ha-icon-button>
|
||||||
|
<p>
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.backup.dialogs.show_encryption_key.description"
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
<div class="encryption-key">
|
||||||
|
<p>${this._params?.currentKey}</p>
|
||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
slot="navigationIcon"
|
.path=${mdiContentCopy}
|
||||||
.label=${this.hass.localize("ui.common.close")}
|
@click=${this._copyKeyToClipboard}
|
||||||
.path=${mdiClose}
|
|
||||||
@click=${this._closeDialog}
|
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
<span slot="title">
|
|
||||||
${this.hass.localize(
|
|
||||||
"ui.panel.config.backup.dialogs.show_encryption_key.title"
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
</ha-dialog-header>
|
|
||||||
<div slot="content">
|
|
||||||
<p>
|
|
||||||
${this.hass.localize(
|
|
||||||
"ui.panel.config.backup.dialogs.show_encryption_key.description"
|
|
||||||
)}
|
|
||||||
</p>
|
|
||||||
<div class="encryption-key">
|
|
||||||
<p>${this._params?.currentKey}</p>
|
|
||||||
<ha-icon-button
|
|
||||||
.path=${mdiContentCopy}
|
|
||||||
@click=${this._copyKeyToClipboard}
|
|
||||||
></ha-icon-button>
|
|
||||||
</div>
|
|
||||||
<ha-md-list>
|
|
||||||
<ha-md-list-item>
|
|
||||||
<span slot="headline">
|
|
||||||
${this.hass.localize(
|
|
||||||
"ui.panel.config.backup.encryption_key.download_emergency_kit"
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
<span slot="supporting-text">
|
|
||||||
${this.hass.localize(
|
|
||||||
"ui.panel.config.backup.encryption_key.download_emergency_kit_description"
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
<ha-button
|
|
||||||
size="small"
|
|
||||||
appearance="plain"
|
|
||||||
slot="end"
|
|
||||||
@click=${this._download}
|
|
||||||
>
|
|
||||||
<ha-svg-icon .path=${mdiDownload} slot="start"></ha-svg-icon>
|
|
||||||
${this.hass.localize(
|
|
||||||
"ui.panel.config.backup.encryption_key.download_emergency_kit_action"
|
|
||||||
)}
|
|
||||||
</ha-button>
|
|
||||||
</ha-md-list-item>
|
|
||||||
</ha-md-list>
|
|
||||||
</div>
|
</div>
|
||||||
<div slot="actions">
|
<ha-md-list>
|
||||||
<ha-button @click=${this._closeDialog}>
|
<ha-md-list-item>
|
||||||
|
<span slot="headline">
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.backup.encryption_key.download_emergency_kit"
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
<span slot="supporting-text">
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.backup.encryption_key.download_emergency_kit_description"
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
<ha-button slot="end" @click=${this._download}>
|
||||||
|
<ha-svg-icon .path=${mdiDownload} slot="start"></ha-svg-icon>
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.backup.encryption_key.download_emergency_kit_action"
|
||||||
|
)}
|
||||||
|
</ha-button>
|
||||||
|
</ha-md-list-item>
|
||||||
|
</ha-md-list>
|
||||||
|
<ha-dialog-footer slot="footer">
|
||||||
|
<ha-button slot="primaryAction" @click=${this.closeDialog}>
|
||||||
${this.hass.localize("ui.common.close")}
|
${this.hass.localize("ui.common.close")}
|
||||||
</ha-button>
|
</ha-button>
|
||||||
</div>
|
</ha-dialog-footer>
|
||||||
</ha-md-dialog>
|
</ha-wa-dialog>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,10 +128,8 @@ class DialogShowBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
haStyle,
|
haStyle,
|
||||||
haStyleDialog,
|
haStyleDialog,
|
||||||
css`
|
css`
|
||||||
ha-md-dialog {
|
ha-wa-dialog {
|
||||||
width: 90vw;
|
--dialog-content-padding: var(--ha-space-2) var(--ha-space-6);
|
||||||
max-width: 560px;
|
|
||||||
--dialog-content-padding: 8px 24px;
|
|
||||||
}
|
}
|
||||||
ha-md-list {
|
ha-md-list {
|
||||||
background: none;
|
background: none;
|
||||||
@@ -169,14 +160,7 @@ class DialogShowBackupEncryptionKey extends LitElement implements HassDialog {
|
|||||||
flex: none;
|
flex: none;
|
||||||
margin: -16px;
|
margin: -16px;
|
||||||
}
|
}
|
||||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
|
||||||
ha-md-dialog {
|
|
||||||
max-width: none;
|
|
||||||
}
|
|
||||||
div[slot="content"] {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p {
|
p {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import {
|
|||||||
} from "../../../dialogs/quick-bar/show-dialog-quick-bar";
|
} from "../../../dialogs/quick-bar/show-dialog-quick-bar";
|
||||||
import { showRestartDialog } from "../../../dialogs/restart/show-dialog-restart";
|
import { showRestartDialog } from "../../../dialogs/restart/show-dialog-restart";
|
||||||
import { showShortcutsDialog } from "../../../dialogs/shortcuts/show-shortcuts-dialog";
|
import { showShortcutsDialog } from "../../../dialogs/shortcuts/show-shortcuts-dialog";
|
||||||
|
import type { PageNavigation } from "../../../layouts/hass-tabs-subpage";
|
||||||
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
|
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
|
||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
import type { HomeAssistant } from "../../../types";
|
import type { HomeAssistant } from "../../../types";
|
||||||
@@ -163,24 +164,21 @@ class HaConfigDashboard extends SubscribeMixin(LitElement) {
|
|||||||
total: 0,
|
total: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
private _pages = memoizeOne((cloudStatus, isCloudLoaded) => [
|
private _pages = memoizeOne((cloudStatus, isCloudLoaded) => {
|
||||||
isCloudLoaded
|
const pages: PageNavigation[] = [];
|
||||||
? [
|
if (isCloudLoaded) {
|
||||||
{
|
pages.push({
|
||||||
component: "cloud",
|
component: "cloud",
|
||||||
path: "/config/cloud",
|
path: "/config/cloud",
|
||||||
name: "Home Assistant Cloud",
|
name: "Home Assistant Cloud",
|
||||||
info: cloudStatus,
|
info: cloudStatus,
|
||||||
iconPath: mdiCloudLock,
|
iconPath: mdiCloudLock,
|
||||||
iconColor: "#3B808E",
|
iconColor: "#3B808E",
|
||||||
translationKey: "cloud",
|
translationKey: "cloud",
|
||||||
},
|
});
|
||||||
...configSections.dashboard,
|
}
|
||||||
]
|
return [...pages, ...configSections.dashboard];
|
||||||
: configSections.dashboard,
|
});
|
||||||
configSections.dashboard_2,
|
|
||||||
configSections.dashboard_3,
|
|
||||||
]);
|
|
||||||
|
|
||||||
public hassSubscribe(): UnsubscribeFunc[] {
|
public hassSubscribe(): UnsubscribeFunc[] {
|
||||||
return [
|
return [
|
||||||
@@ -310,21 +308,18 @@ class HaConfigDashboard extends SubscribeMixin(LitElement) {
|
|||||||
: ""}
|
: ""}
|
||||||
</ha-card>`
|
</ha-card>`
|
||||||
: ""}
|
: ""}
|
||||||
${this._pages(
|
|
||||||
this.cloudStatus,
|
<ha-card outlined>
|
||||||
isComponentLoaded(this.hass, "cloud")
|
<ha-config-navigation
|
||||||
).map(
|
.hass=${this.hass}
|
||||||
(categoryPages) => html`
|
.narrow=${this.narrow}
|
||||||
<ha-card outlined>
|
.showAdvanced=${this.showAdvanced}
|
||||||
<ha-config-navigation
|
.pages=${this._pages(
|
||||||
.hass=${this.hass}
|
this.cloudStatus,
|
||||||
.narrow=${this.narrow}
|
isComponentLoaded(this.hass, "cloud")
|
||||||
.showAdvanced=${this.showAdvanced}
|
)}
|
||||||
.pages=${categoryPages}
|
></ha-config-navigation>
|
||||||
></ha-config-navigation>
|
</ha-card>
|
||||||
</ha-card>
|
|
||||||
`
|
|
||||||
)}
|
|
||||||
<ha-tip .hass=${this.hass}>${this._tip}</ha-tip>
|
<ha-tip .hass=${this.hass}>${this._tip}</ha-tip>
|
||||||
</ha-config-section>
|
</ha-config-section>
|
||||||
</ha-top-app-bar-fixed>
|
</ha-top-app-bar-fixed>
|
||||||
|
|||||||
@@ -3,17 +3,14 @@ import {
|
|||||||
mdiAccount,
|
mdiAccount,
|
||||||
mdiBackupRestore,
|
mdiBackupRestore,
|
||||||
mdiBadgeAccountHorizontal,
|
mdiBadgeAccountHorizontal,
|
||||||
mdiBluetooth,
|
|
||||||
mdiCellphoneCog,
|
mdiCellphoneCog,
|
||||||
mdiCog,
|
mdiCog,
|
||||||
mdiDatabase,
|
mdiDatabase,
|
||||||
mdiDevices,
|
mdiDevices,
|
||||||
mdiFlask,
|
mdiFlask,
|
||||||
mdiHub,
|
|
||||||
mdiInformation,
|
mdiInformation,
|
||||||
mdiInformationOutline,
|
mdiInformationOutline,
|
||||||
mdiLabel,
|
mdiLabel,
|
||||||
mdiLan,
|
|
||||||
mdiLightningBolt,
|
mdiLightningBolt,
|
||||||
mdiMapMarkerRadius,
|
mdiMapMarkerRadius,
|
||||||
mdiMathLog,
|
mdiMathLog,
|
||||||
@@ -23,19 +20,15 @@ import {
|
|||||||
mdiNfcVariant,
|
mdiNfcVariant,
|
||||||
mdiPalette,
|
mdiPalette,
|
||||||
mdiPaletteSwatch,
|
mdiPaletteSwatch,
|
||||||
mdiProtocol,
|
|
||||||
mdiPuzzle,
|
mdiPuzzle,
|
||||||
mdiRobot,
|
mdiRobot,
|
||||||
mdiScrewdriver,
|
mdiScrewdriver,
|
||||||
mdiScriptText,
|
mdiScriptText,
|
||||||
mdiShape,
|
mdiShape,
|
||||||
mdiSofa,
|
mdiSofa,
|
||||||
mdiStore,
|
|
||||||
mdiTools,
|
mdiTools,
|
||||||
mdiUpdate,
|
mdiUpdate,
|
||||||
mdiViewDashboard,
|
mdiViewDashboard,
|
||||||
mdiZigbee,
|
|
||||||
mdiZWave,
|
|
||||||
} from "@mdi/js";
|
} from "@mdi/js";
|
||||||
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
|
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||||
import type { PropertyValues } from "lit";
|
import type { PropertyValues } from "lit";
|
||||||
@@ -108,72 +101,6 @@ export const configSections: Record<string, PageNavigation[]> = {
|
|||||||
iconPath: mdiMicrophone,
|
iconPath: mdiMicrophone,
|
||||||
iconColor: "#3263C3",
|
iconColor: "#3263C3",
|
||||||
},
|
},
|
||||||
],
|
|
||||||
dashboard_2: [
|
|
||||||
{
|
|
||||||
path: "/config/zwave_js",
|
|
||||||
name: "Z-Wave",
|
|
||||||
iconPath: mdiZWave,
|
|
||||||
iconColor: "#153163",
|
|
||||||
component: "zwave_js",
|
|
||||||
translationKey: "zwave_js",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/config/zha",
|
|
||||||
name: "Zigbee",
|
|
||||||
iconPath: mdiZigbee,
|
|
||||||
iconColor: "#E74011",
|
|
||||||
component: "zha",
|
|
||||||
translationKey: "zha",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/config/matter",
|
|
||||||
name: "Matter",
|
|
||||||
iconPath: mdiHub,
|
|
||||||
iconColor: "#2458B3",
|
|
||||||
component: "matter",
|
|
||||||
translationKey: "matter",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/config/thread",
|
|
||||||
name: "Thread",
|
|
||||||
iconPath: mdiProtocol,
|
|
||||||
iconColor: "#ED7744",
|
|
||||||
component: "thread",
|
|
||||||
translationKey: "thread",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/config/bluetooth",
|
|
||||||
name: "Bluetooth",
|
|
||||||
iconPath: mdiBluetooth,
|
|
||||||
iconColor: "#0082FC",
|
|
||||||
component: "bluetooth",
|
|
||||||
translationKey: "bluetooth",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/knx",
|
|
||||||
name: "KNX",
|
|
||||||
iconPath: mdiLan,
|
|
||||||
iconColor: "#4EAA66",
|
|
||||||
component: "knx",
|
|
||||||
translationKey: "knx",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/insteon",
|
|
||||||
name: "Insteon",
|
|
||||||
iconPath: mdiLan,
|
|
||||||
iconColor: "#E4002C",
|
|
||||||
component: "insteon",
|
|
||||||
translationKey: "insteon",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/hacs",
|
|
||||||
name: "Home Assistant Community Store",
|
|
||||||
iconPath: mdiStore,
|
|
||||||
iconColor: "#41BDF5",
|
|
||||||
component: "hacs",
|
|
||||||
translationKey: "hacs",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/config/tags",
|
path: "/config/tags",
|
||||||
translationKey: "tags",
|
translationKey: "tags",
|
||||||
@@ -181,8 +108,6 @@ export const configSections: Record<string, PageNavigation[]> = {
|
|||||||
iconColor: "#616161",
|
iconColor: "#616161",
|
||||||
component: "tag",
|
component: "tag",
|
||||||
},
|
},
|
||||||
],
|
|
||||||
dashboard_3: [
|
|
||||||
{
|
{
|
||||||
path: "/config/person",
|
path: "/config/person",
|
||||||
translationKey: "people",
|
translationKey: "people",
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { css, html, LitElement, nothing } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
||||||
import { relativeTime } from "../../../common/datetime/relative_time";
|
import { relativeTime } from "../../../common/datetime/relative_time";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
import "../../../components/ha-button";
|
import "../../../components/ha-button";
|
||||||
import type { HaMdDialog } from "../../../components/ha-md-dialog";
|
import "../../../components/ha-dialog-footer";
|
||||||
import "../../../components/ha-md-dialog";
|
import "../../../components/ha-wa-dialog";
|
||||||
import "../../../components/ha-md-list";
|
import "../../../components/ha-md-list";
|
||||||
import "../../../components/ha-md-list-item";
|
import "../../../components/ha-md-list-item";
|
||||||
import type { HaSwitch } from "../../../components/ha-switch";
|
import type { HaSwitch } from "../../../components/ha-switch";
|
||||||
@@ -30,13 +30,14 @@ export class DialogLabsPreviewFeatureEnable
|
|||||||
|
|
||||||
@state() private _createBackup = false;
|
@state() private _createBackup = false;
|
||||||
|
|
||||||
@query("ha-md-dialog") private _dialog?: HaMdDialog;
|
@state() private _open = false;
|
||||||
|
|
||||||
public async showDialog(
|
public async showDialog(
|
||||||
params: LabsPreviewFeatureEnableDialogParams
|
params: LabsPreviewFeatureEnableDialogParams
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
this._params = params;
|
this._params = params;
|
||||||
this._createBackup = false;
|
this._createBackup = false;
|
||||||
|
this._open = true;
|
||||||
this._fetchBackupConfig();
|
this._fetchBackupConfig();
|
||||||
if (isComponentLoaded(this.hass, "hassio")) {
|
if (isComponentLoaded(this.hass, "hassio")) {
|
||||||
this._fetchUpdateBackupConfig();
|
this._fetchUpdateBackupConfig();
|
||||||
@@ -44,7 +45,7 @@ export class DialogLabsPreviewFeatureEnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): boolean {
|
public closeDialog(): boolean {
|
||||||
this._dialog?.close();
|
this._open = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,72 +144,69 @@ export class DialogLabsPreviewFeatureEnable
|
|||||||
const createBackupTexts = this._computeCreateBackupTexts();
|
const createBackupTexts = this._computeCreateBackupTexts();
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-md-dialog open @closed=${this._dialogClosed}>
|
<ha-wa-dialog
|
||||||
<span slot="headline">
|
.hass=${this.hass}
|
||||||
${this.hass.localize("ui.panel.config.labs.enable_title")}
|
.open=${this._open}
|
||||||
</span>
|
header-title=${this.hass.localize("ui.panel.config.labs.enable_title")}
|
||||||
<div slot="content">
|
@closed=${this._dialogClosed}
|
||||||
<p>
|
>
|
||||||
${this.hass.localize(
|
<p>
|
||||||
`component.${this._params.preview_feature.domain}.preview_features.${this._params.preview_feature.preview_feature}.enable_confirmation`
|
${this.hass.localize(
|
||||||
) || this.hass.localize("ui.panel.config.labs.enable_confirmation")}
|
`component.${this._params.preview_feature.domain}.preview_features.${this._params.preview_feature.preview_feature}.enable_confirmation`
|
||||||
</p>
|
) || this.hass.localize("ui.panel.config.labs.enable_confirmation")}
|
||||||
</div>
|
</p>
|
||||||
<div slot="actions">
|
${createBackupTexts
|
||||||
${createBackupTexts
|
? html`
|
||||||
? html`
|
<ha-md-list>
|
||||||
<ha-md-list>
|
<ha-md-list-item>
|
||||||
<ha-md-list-item>
|
<span slot="headline">${createBackupTexts.title}</span>
|
||||||
<span slot="headline">${createBackupTexts.title}</span>
|
${createBackupTexts.description
|
||||||
${createBackupTexts.description
|
? html`
|
||||||
? html`
|
<span slot="supporting-text">
|
||||||
<span slot="supporting-text">
|
${createBackupTexts.description}
|
||||||
${createBackupTexts.description}
|
</span>
|
||||||
</span>
|
`
|
||||||
`
|
: nothing}
|
||||||
: nothing}
|
<ha-switch
|
||||||
<ha-switch
|
slot="end"
|
||||||
slot="end"
|
.checked=${this._createBackup}
|
||||||
.checked=${this._createBackup}
|
@change=${this._createBackupChanged}
|
||||||
@change=${this._createBackupChanged}
|
></ha-switch>
|
||||||
></ha-switch>
|
</ha-md-list-item>
|
||||||
</ha-md-list-item>
|
</ha-md-list>
|
||||||
</ha-md-list>
|
`
|
||||||
`
|
: nothing}
|
||||||
: nothing}
|
<ha-dialog-footer slot="footer">
|
||||||
<div>
|
<ha-button
|
||||||
<ha-button appearance="plain" @click=${this._handleCancel}>
|
slot="secondaryAction"
|
||||||
${this.hass.localize("ui.common.cancel")}
|
appearance="plain"
|
||||||
</ha-button>
|
@click=${this._handleCancel}
|
||||||
<ha-button
|
>
|
||||||
appearance="filled"
|
${this.hass.localize("ui.common.cancel")}
|
||||||
variant="brand"
|
</ha-button>
|
||||||
@click=${this._handleConfirm}
|
<ha-button
|
||||||
>
|
slot="primaryAction"
|
||||||
${this.hass.localize("ui.panel.config.labs.enable")}
|
appearance="filled"
|
||||||
</ha-button>
|
variant="brand"
|
||||||
</div>
|
@click=${this._handleConfirm}
|
||||||
</div>
|
>
|
||||||
</ha-md-dialog>
|
${this.hass.localize("ui.panel.config.labs.enable")}
|
||||||
|
</ha-button>
|
||||||
|
</ha-dialog-footer>
|
||||||
|
</ha-wa-dialog>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly styles = css`
|
static readonly styles = css`
|
||||||
ha-md-dialog {
|
ha-wa-dialog {
|
||||||
--dialog-content-padding: var(--ha-space-6);
|
--dialog-content-padding: var(--ha-space-0);
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin: 0;
|
margin: 0 var(--ha-space-6) var(--ha-space-6);
|
||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
div[slot="actions"] {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ha-md-list {
|
ha-md-list {
|
||||||
background: none;
|
background: none;
|
||||||
--md-list-item-leading-space: var(--ha-space-6);
|
--md-list-item-leading-space: var(--ha-space-6);
|
||||||
@@ -217,13 +215,6 @@ export class DialogLabsPreviewFeatureEnable
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
border-top: var(--ha-border-width-sm) solid var(--divider-color);
|
border-top: var(--ha-border-width-sm) solid var(--divider-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
div[slot="actions"] > div {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
gap: var(--ha-space-2);
|
|
||||||
padding: var(--ha-space-4) var(--ha-space-6);
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { css, html, LitElement, nothing } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
import "../../../components/ha-md-dialog";
|
import "../../../components/ha-wa-dialog";
|
||||||
import "../../../components/ha-spinner";
|
import "../../../components/ha-spinner";
|
||||||
import type { HassDialog } from "../../../dialogs/make-dialog-manager";
|
import type { HassDialog } from "../../../dialogs/make-dialog-manager";
|
||||||
import type { HomeAssistant } from "../../../types";
|
import type { HomeAssistant } from "../../../types";
|
||||||
@@ -39,36 +39,36 @@ export class DialogLabsProgress
|
|||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-md-dialog
|
<ha-wa-dialog
|
||||||
|
.hass=${this.hass}
|
||||||
.open=${this._open}
|
.open=${this._open}
|
||||||
disable-cancel-action
|
prevent-scrim-close
|
||||||
@closed=${this._handleClosed}
|
@closed=${this._handleClosed}
|
||||||
>
|
>
|
||||||
<div slot="content">
|
<div slot="header"></div>
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
<ha-spinner></ha-spinner>
|
<ha-spinner></ha-spinner>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<p class="heading">
|
<p class="heading">
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.labs.progress.creating_backup"
|
"ui.panel.config.labs.progress.creating_backup"
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
<p class="description">
|
<p class="description">
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
this._params.enabled
|
this._params.enabled
|
||||||
? "ui.panel.config.labs.progress.backing_up_before_enabling"
|
? "ui.panel.config.labs.progress.backing_up_before_enabling"
|
||||||
: "ui.panel.config.labs.progress.backing_up_before_disabling"
|
: "ui.panel.config.labs.progress.backing_up_before_disabling"
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ha-md-dialog>
|
</ha-wa-dialog>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly styles = css`
|
static readonly styles = css`
|
||||||
ha-md-dialog {
|
ha-wa-dialog {
|
||||||
--dialog-content-padding: var(--ha-space-6);
|
--dialog-content-padding: var(--ha-space-6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import { mdiDownload } from "@mdi/js";
|
|||||||
import type { CSSResultGroup, PropertyValues } from "lit";
|
import type { CSSResultGroup, PropertyValues } from "lit";
|
||||||
import { LitElement, css, html, nothing } from "lit";
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
|
import { classMap } from "lit/directives/class-map";
|
||||||
import { navigate } from "../../common/navigate";
|
import { navigate } from "../../common/navigate";
|
||||||
|
import type { LocalizeKeys } from "../../common/translations/localize";
|
||||||
import "../../components/ha-alert";
|
import "../../components/ha-alert";
|
||||||
import "../../components/ha-icon-button-arrow-prev";
|
import "../../components/ha-icon-button-arrow-prev";
|
||||||
import "../../components/ha-menu-button";
|
import "../../components/ha-menu-button";
|
||||||
@@ -22,7 +24,10 @@ import {
|
|||||||
getSummedData,
|
getSummedData,
|
||||||
} from "../../data/energy";
|
} from "../../data/energy";
|
||||||
import type { LovelaceConfig } from "../../data/lovelace/config/types";
|
import type { LovelaceConfig } from "../../data/lovelace/config/types";
|
||||||
import type { LovelaceViewConfig } from "../../data/lovelace/config/view";
|
import {
|
||||||
|
isStrategyView,
|
||||||
|
type LovelaceViewConfig,
|
||||||
|
} from "../../data/lovelace/config/view";
|
||||||
import type { StatisticValue } from "../../data/recorder";
|
import type { StatisticValue } from "../../data/recorder";
|
||||||
import { haStyle } from "../../resources/styles";
|
import { haStyle } from "../../resources/styles";
|
||||||
import type { HomeAssistant, PanelInfo } from "../../types";
|
import type { HomeAssistant, PanelInfo } from "../../types";
|
||||||
@@ -33,7 +38,6 @@ import type { ExtraActionItem } from "../lovelace/hui-root";
|
|||||||
import type { Lovelace } from "../lovelace/types";
|
import type { Lovelace } from "../lovelace/types";
|
||||||
import "../lovelace/views/hui-view";
|
import "../lovelace/views/hui-view";
|
||||||
import "../lovelace/views/hui-view-container";
|
import "../lovelace/views/hui-view-container";
|
||||||
import type { LocalizeKeys } from "../../common/translations/localize";
|
|
||||||
|
|
||||||
export const DEFAULT_ENERGY_COLLECTION_KEY = "energy_dashboard";
|
export const DEFAULT_ENERGY_COLLECTION_KEY = "energy_dashboard";
|
||||||
|
|
||||||
@@ -48,6 +52,7 @@ const OVERVIEW_VIEW = {
|
|||||||
strategy: {
|
strategy: {
|
||||||
type: "energy-overview",
|
type: "energy-overview",
|
||||||
collection_key: DEFAULT_ENERGY_COLLECTION_KEY,
|
collection_key: DEFAULT_ENERGY_COLLECTION_KEY,
|
||||||
|
show_period_selector: true,
|
||||||
},
|
},
|
||||||
} as LovelaceViewConfig;
|
} as LovelaceViewConfig;
|
||||||
|
|
||||||
@@ -56,6 +61,7 @@ const ENERGY_VIEW = {
|
|||||||
strategy: {
|
strategy: {
|
||||||
type: "energy",
|
type: "energy",
|
||||||
collection_key: DEFAULT_ENERGY_COLLECTION_KEY,
|
collection_key: DEFAULT_ENERGY_COLLECTION_KEY,
|
||||||
|
show_period_selector: true,
|
||||||
},
|
},
|
||||||
} as LovelaceViewConfig;
|
} as LovelaceViewConfig;
|
||||||
|
|
||||||
@@ -64,6 +70,7 @@ const WATER_VIEW = {
|
|||||||
strategy: {
|
strategy: {
|
||||||
type: "water",
|
type: "water",
|
||||||
collection_key: DEFAULT_ENERGY_COLLECTION_KEY,
|
collection_key: DEFAULT_ENERGY_COLLECTION_KEY,
|
||||||
|
show_period_selector: true,
|
||||||
},
|
},
|
||||||
} as LovelaceViewConfig;
|
} as LovelaceViewConfig;
|
||||||
|
|
||||||
@@ -72,6 +79,7 @@ const GAS_VIEW = {
|
|||||||
strategy: {
|
strategy: {
|
||||||
type: "gas",
|
type: "gas",
|
||||||
collection_key: DEFAULT_ENERGY_COLLECTION_KEY,
|
collection_key: DEFAULT_ENERGY_COLLECTION_KEY,
|
||||||
|
show_period_selector: true,
|
||||||
},
|
},
|
||||||
} as LovelaceViewConfig;
|
} as LovelaceViewConfig;
|
||||||
|
|
||||||
@@ -223,6 +231,16 @@ class PanelEnergy extends LitElement {
|
|||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const routePath = this.route?.path?.split("/")[1] || "";
|
||||||
|
const currentView = this._lovelace.config.views.find(
|
||||||
|
(view) => view.path === routePath
|
||||||
|
);
|
||||||
|
|
||||||
|
const showEnergySelector =
|
||||||
|
currentView &&
|
||||||
|
isStrategyView(currentView) &&
|
||||||
|
currentView.strategy?.show_period_selector;
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<hui-root
|
<hui-root
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@@ -232,7 +250,20 @@ class PanelEnergy extends LitElement {
|
|||||||
.panel=${this.panel}
|
.panel=${this.panel}
|
||||||
.extraActionItems=${this._extraActionItems}
|
.extraActionItems=${this._extraActionItems}
|
||||||
@reload-energy-panel=${this._reloadConfig}
|
@reload-energy-panel=${this._reloadConfig}
|
||||||
></hui-root>
|
class=${classMap({ "has-period-selector": showEnergySelector })}
|
||||||
|
>
|
||||||
|
</hui-root>
|
||||||
|
${showEnergySelector
|
||||||
|
? html`
|
||||||
|
<ha-card raised class="period-selector">
|
||||||
|
<hui-energy-period-selector
|
||||||
|
.hass=${this.hass}
|
||||||
|
.collectionKey=${DEFAULT_ENERGY_COLLECTION_KEY}
|
||||||
|
vertical-opening-direction="up"
|
||||||
|
></hui-energy-period-selector>
|
||||||
|
</ha-card>
|
||||||
|
`
|
||||||
|
: nothing}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,24 +662,6 @@ class PanelEnergy extends LitElement {
|
|||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
}
|
}
|
||||||
.toolbar {
|
|
||||||
height: var(--header-height);
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
align-items: center;
|
|
||||||
font-size: var(--ha-font-size-xl);
|
|
||||||
padding: 0px 12px;
|
|
||||||
font-weight: var(--ha-font-weight-normal);
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
:host([narrow]) .toolbar {
|
|
||||||
padding: 0 4px;
|
|
||||||
}
|
|
||||||
.main-title {
|
|
||||||
margin: var(--margin-title);
|
|
||||||
line-height: var(--ha-line-height-normal);
|
|
||||||
flex-grow: 1;
|
|
||||||
}
|
|
||||||
.centered {
|
.centered {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -656,6 +669,28 @@ class PanelEnergy extends LitElement {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
hui-root.has-period-selector {
|
||||||
|
--view-container-padding-bottom: var(--ha-space-16);
|
||||||
|
}
|
||||||
|
.period-selector {
|
||||||
|
position: fixed;
|
||||||
|
bottom: calc(var(--ha-space-2) + var(--safe-area-inset-bottom, 0px));
|
||||||
|
left: var(--mdc-drawer-width, 0);
|
||||||
|
right: var(--safe-area-inset-right, 0px);
|
||||||
|
inset-inline-start: var(--mdc-drawer-width, 0);
|
||||||
|
inset-inline-end: var(--safe-area-inset-right, 0px);
|
||||||
|
margin: var(--ha-space-2) auto;
|
||||||
|
max-width: calc(min(450px, 100% - var(--ha-space-4)));
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-left: calc(
|
||||||
|
var(--ha-space-4) + var(--safe-area-inset-left, 0px)
|
||||||
|
);
|
||||||
|
padding-right: 0;
|
||||||
|
padding-inline-start: calc(
|
||||||
|
var(--ha-space-4) + var(--safe-area-inset-left, 0px)
|
||||||
|
);
|
||||||
|
padding-inline-end: 0;
|
||||||
|
}
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { getEnergyDataCollection } from "../../../data/energy";
|
|||||||
import type { HomeAssistant } from "../../../types";
|
import type { HomeAssistant } from "../../../types";
|
||||||
import type { LovelaceViewConfig } from "../../../data/lovelace/config/view";
|
import type { LovelaceViewConfig } from "../../../data/lovelace/config/view";
|
||||||
import type { LovelaceStrategyConfig } from "../../../data/lovelace/config/strategy";
|
import type { LovelaceStrategyConfig } from "../../../data/lovelace/config/strategy";
|
||||||
import type { LovelaceSectionConfig } from "../../../data/lovelace/config/section";
|
|
||||||
import { DEFAULT_ENERGY_COLLECTION_KEY } from "../ha-panel-energy";
|
import { DEFAULT_ENERGY_COLLECTION_KEY } from "../ha-panel-energy";
|
||||||
|
|
||||||
@customElement("energy-overview-view-strategy")
|
@customElement("energy-overview-view-strategy")
|
||||||
@@ -64,24 +63,20 @@ export class EnergyOverviewViewStrategy extends ReactiveElement {
|
|||||||
(source.type === "grid" && source.power?.length)
|
(source.type === "grid" && source.power?.length)
|
||||||
);
|
);
|
||||||
|
|
||||||
const overviewSection: LovelaceSectionConfig = {
|
|
||||||
type: "grid",
|
|
||||||
cards: [
|
|
||||||
{
|
|
||||||
type: "energy-date-selection",
|
|
||||||
collection_key: collectionKey,
|
|
||||||
allow_compare: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
if (hasGrid || hasBattery || hasSolar) {
|
if (hasGrid || hasBattery || hasSolar) {
|
||||||
overviewSection.cards!.push({
|
view.sections!.push({
|
||||||
title: hass.localize("ui.panel.energy.cards.energy_distribution_title"),
|
type: "grid",
|
||||||
type: "energy-distribution",
|
cards: [
|
||||||
collection_key: collectionKey,
|
{
|
||||||
|
title: hass.localize(
|
||||||
|
"ui.panel.energy.cards.energy_distribution_title"
|
||||||
|
),
|
||||||
|
type: "energy-distribution",
|
||||||
|
collection_key: collectionKey,
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
view.sections!.push(overviewSection);
|
|
||||||
|
|
||||||
if (prefs.energy_sources.length) {
|
if (prefs.energy_sources.length) {
|
||||||
view.sections!.push({
|
view.sections!.push({
|
||||||
|
|||||||
@@ -53,10 +53,6 @@ export class EnergyViewStrategy extends ReactiveElement {
|
|||||||
(d) => d.included_in_stat
|
(d) => d.included_in_stat
|
||||||
);
|
);
|
||||||
|
|
||||||
view.cards!.push({
|
|
||||||
type: "energy-date-selection",
|
|
||||||
collection_key: collectionKey,
|
|
||||||
});
|
|
||||||
view.cards!.push({
|
view.cards!.push({
|
||||||
type: "energy-compare",
|
type: "energy-compare",
|
||||||
collection_key: "energy_dashboard",
|
collection_key: "energy_dashboard",
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ export class GasViewStrategy extends ReactiveElement {
|
|||||||
|
|
||||||
const section = view.sections![0] as LovelaceSectionConfig;
|
const section = view.sections![0] as LovelaceSectionConfig;
|
||||||
|
|
||||||
section.cards!.push({
|
|
||||||
type: "energy-date-selection",
|
|
||||||
collection_key: collectionKey,
|
|
||||||
});
|
|
||||||
section.cards!.push({
|
section.cards!.push({
|
||||||
type: "energy-compare",
|
type: "energy-compare",
|
||||||
collection_key: collectionKey,
|
collection_key: collectionKey,
|
||||||
|
|||||||
@@ -41,10 +41,6 @@ export class WaterViewStrategy extends ReactiveElement {
|
|||||||
|
|
||||||
const section = view.sections![0] as LovelaceSectionConfig;
|
const section = view.sections![0] as LovelaceSectionConfig;
|
||||||
|
|
||||||
section.cards!.push({
|
|
||||||
type: "energy-date-selection",
|
|
||||||
collection_key: collectionKey,
|
|
||||||
});
|
|
||||||
section.cards!.push({
|
section.cards!.push({
|
||||||
type: "energy-compare",
|
type: "energy-compare",
|
||||||
collection_key: collectionKey,
|
collection_key: collectionKey,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import type { PropertyValues } from "lit";
|
|||||||
import { LitElement, css, html, nothing } from "lit";
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
|
import { classMap } from "lit/directives/class-map";
|
||||||
import {
|
import {
|
||||||
calcDate,
|
calcDate,
|
||||||
calcDateProperty,
|
calcDateProperty,
|
||||||
@@ -69,6 +70,11 @@ export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) {
|
|||||||
@property({ type: Boolean, attribute: "allow-compare" }) public allowCompare =
|
@property({ type: Boolean, attribute: "allow-compare" }) public allowCompare =
|
||||||
true;
|
true;
|
||||||
|
|
||||||
|
@property({ attribute: "vertical-opening-direction" })
|
||||||
|
public verticalOpeningDirection?: "up" | "down";
|
||||||
|
|
||||||
|
@state() _datepickerOpen = false;
|
||||||
|
|
||||||
@state() _startDate?: Date;
|
@state() _startDate?: Date;
|
||||||
|
|
||||||
@state() _endDate?: Date;
|
@state() _endDate?: Date;
|
||||||
@@ -150,7 +156,13 @@ export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="row">
|
<div
|
||||||
|
class=${classMap({
|
||||||
|
row: true,
|
||||||
|
"datepicker-open": this._datepickerOpen,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<div class="backdrop"></div>
|
||||||
<div class="label">
|
<div class="label">
|
||||||
${simpleRange === "day"
|
${simpleRange === "day"
|
||||||
? this.narrow
|
? this.narrow
|
||||||
@@ -202,8 +214,10 @@ export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) {
|
|||||||
.ranges=${this._ranges}
|
.ranges=${this._ranges}
|
||||||
@value-changed=${this._dateRangeChanged}
|
@value-changed=${this._dateRangeChanged}
|
||||||
@preset-selected=${this._presetSelected}
|
@preset-selected=${this._presetSelected}
|
||||||
|
@toggle=${this._handleDatepickerToggle}
|
||||||
minimal
|
minimal
|
||||||
header-position
|
header-position
|
||||||
|
.verticalOpeningDirection=${this.verticalOpeningDirection}
|
||||||
></ha-date-range-picker>
|
></ha-date-range-picker>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -446,6 +460,10 @@ export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) {
|
|||||||
this._endDate = energyData.end || endOfToday();
|
this._endDate = energyData.end || endOfToday();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _handleDatepickerToggle(ev: CustomEvent<{ open: boolean }>) {
|
||||||
|
this._datepickerOpen = ev.detail.open;
|
||||||
|
}
|
||||||
|
|
||||||
private _toggleCompare(ev: CustomEvent<RequestSelectedDetail>) {
|
private _toggleCompare(ev: CustomEvent<RequestSelectedDetail>) {
|
||||||
if (ev.detail.source !== "interaction") {
|
if (ev.detail.source !== "interaction") {
|
||||||
return;
|
return;
|
||||||
@@ -496,6 +514,29 @@ export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) {
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
--ha-button-theme-color: currentColor;
|
--ha-button-theme-color: currentColor;
|
||||||
}
|
}
|
||||||
|
.backdrop {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: var(--dialog-z-index, 8);
|
||||||
|
-webkit-backdrop-filter: var(
|
||||||
|
--ha-dialog-scrim-backdrop-filter,
|
||||||
|
var(--dialog-backdrop-filter)
|
||||||
|
);
|
||||||
|
backdrop-filter: var(
|
||||||
|
--ha-dialog-scrim-backdrop-filter,
|
||||||
|
var(--dialog-backdrop-filter)
|
||||||
|
);
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity var(--ha-animation-base-duration) ease-in-out;
|
||||||
|
}
|
||||||
|
.datepicker-open .backdrop {
|
||||||
|
opacity: 1;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { classMap } from "lit/directives/class-map";
|
|||||||
import { ifDefined } from "lit/directives/if-defined";
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { isComponentLoaded } from "../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../common/config/is_component_loaded";
|
||||||
|
import { UndoRedoController } from "../../common/controllers/undo-redo-controller";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import { shouldHandleRequestSelectedEvent } from "../../common/mwc/handle-request-selected-event";
|
import { shouldHandleRequestSelectedEvent } from "../../common/mwc/handle-request-selected-event";
|
||||||
import { goBack, navigate } from "../../common/navigate";
|
import { goBack, navigate } from "../../common/navigate";
|
||||||
@@ -37,8 +38,8 @@ import {
|
|||||||
removeSearchParam,
|
removeSearchParam,
|
||||||
} from "../../common/url/search-params";
|
} from "../../common/url/search-params";
|
||||||
import { debounce } from "../../common/util/debounce";
|
import { debounce } from "../../common/util/debounce";
|
||||||
import { isMobileClient } from "../../util/is_mobile";
|
|
||||||
import { afterNextRender } from "../../common/util/render-status";
|
import { afterNextRender } from "../../common/util/render-status";
|
||||||
|
import { withViewTransition } from "../../common/util/view-transition";
|
||||||
import "../../components/ha-button";
|
import "../../components/ha-button";
|
||||||
import "../../components/ha-button-menu";
|
import "../../components/ha-button-menu";
|
||||||
import "../../components/ha-icon";
|
import "../../components/ha-icon";
|
||||||
@@ -81,6 +82,7 @@ import { showVoiceCommandDialog } from "../../dialogs/voice-command-dialog/show-
|
|||||||
import { haStyle } from "../../resources/styles";
|
import { haStyle } from "../../resources/styles";
|
||||||
import type { HomeAssistant, PanelInfo } from "../../types";
|
import type { HomeAssistant, PanelInfo } from "../../types";
|
||||||
import { documentationUrl } from "../../util/documentation-url";
|
import { documentationUrl } from "../../util/documentation-url";
|
||||||
|
import { isMobileClient } from "../../util/is_mobile";
|
||||||
import { showToast } from "../../util/toast";
|
import { showToast } from "../../util/toast";
|
||||||
import { showAreaRegistryDetailDialog } from "../config/areas/show-dialog-area-registry-detail";
|
import { showAreaRegistryDetailDialog } from "../config/areas/show-dialog-area-registry-detail";
|
||||||
import { showNewAutomationDialog } from "../config/automation/show-dialog-new-automation";
|
import { showNewAutomationDialog } from "../config/automation/show-dialog-new-automation";
|
||||||
@@ -98,8 +100,6 @@ import "./views/hui-view";
|
|||||||
import type { HUIView } from "./views/hui-view";
|
import type { HUIView } from "./views/hui-view";
|
||||||
import "./views/hui-view-background";
|
import "./views/hui-view-background";
|
||||||
import "./views/hui-view-container";
|
import "./views/hui-view-container";
|
||||||
import { UndoRedoController } from "../../common/controllers/undo-redo-controller";
|
|
||||||
import { withViewTransition } from "../../common/util/view-transition";
|
|
||||||
|
|
||||||
interface ActionItem {
|
interface ActionItem {
|
||||||
icon: string;
|
icon: string;
|
||||||
@@ -1546,7 +1546,10 @@ class HUIRoot extends LitElement {
|
|||||||
padding-top: calc(var(--header-height) + var(--safe-area-inset-top));
|
padding-top: calc(var(--header-height) + var(--safe-area-inset-top));
|
||||||
padding-right: var(--safe-area-inset-right);
|
padding-right: var(--safe-area-inset-right);
|
||||||
padding-inline-end: var(--safe-area-inset-right);
|
padding-inline-end: var(--safe-area-inset-right);
|
||||||
padding-bottom: var(--safe-area-inset-bottom);
|
padding-bottom: calc(
|
||||||
|
var(--safe-area-inset-bottom) +
|
||||||
|
var(--view-container-padding-bottom, 0px)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
.narrow hui-view-container {
|
.narrow hui-view-container {
|
||||||
padding-left: var(--safe-area-inset-left);
|
padding-left: var(--safe-area-inset-left);
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ export const mainStyles = css`
|
|||||||
*/
|
*/
|
||||||
--safe-width: calc(100vw - var(--safe-area-inset-left) - var(--safe-area-inset-right));
|
--safe-width: calc(100vw - var(--safe-area-inset-left) - var(--safe-area-inset-right));
|
||||||
--safe-height: calc(100vh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
|
--safe-height: calc(100vh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
|
||||||
|
|
||||||
|
/* dialog backdrop filter */
|
||||||
|
--ha-dialog-scrim-backdrop-filter: brightness(68%);
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -2308,30 +2308,6 @@
|
|||||||
},
|
},
|
||||||
"cloud": {
|
"cloud": {
|
||||||
"secondary": "Loading..."
|
"secondary": "Loading..."
|
||||||
},
|
|
||||||
"zwave_js": {
|
|
||||||
"secondary": "Manage your Z-Wave network"
|
|
||||||
},
|
|
||||||
"zha": {
|
|
||||||
"secondary": "Manage your Zigbee network"
|
|
||||||
},
|
|
||||||
"matter": {
|
|
||||||
"secondary": "Manage your Matter network"
|
|
||||||
},
|
|
||||||
"thread": {
|
|
||||||
"secondary": "Manage your Thread network"
|
|
||||||
},
|
|
||||||
"bluetooth": {
|
|
||||||
"secondary": "Manage your Bluetooth devices"
|
|
||||||
},
|
|
||||||
"knx": {
|
|
||||||
"secondary": "Manage your KNX network"
|
|
||||||
},
|
|
||||||
"insteon": {
|
|
||||||
"secondary": "Manage your Insteon network"
|
|
||||||
},
|
|
||||||
"hacs": {
|
|
||||||
"secondary": "Manage community integrations and frontend modules"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
|
|||||||
Reference in New Issue
Block a user