mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
20230802.0 (#17457)
This commit is contained in:
commit
7d80eb06b0
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "home-assistant-frontend"
|
||||
version = "20230801.0"
|
||||
version = "20230802.0"
|
||||
license = {text = "Apache-2.0"}
|
||||
description = "The Home Assistant frontend"
|
||||
readme = "README.md"
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { HassEntity } from "home-assistant-js-websocket";
|
||||
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
|
||||
import { html, LitElement, nothing, PropertyValues, TemplateResult } from "lit";
|
||||
import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
@ -87,6 +87,8 @@ export class HaStatisticPicker extends LitElement {
|
||||
|
||||
private _statistics: StatisticItem[] = [];
|
||||
|
||||
@state() private _filteredItems?: StatisticItem[] = undefined;
|
||||
|
||||
private _rowRenderer: ComboBoxLitRenderer<StatisticItem> = (item) =>
|
||||
html`<mwc-list-item graphic="avatar" twoline>
|
||||
${item.state
|
||||
@ -254,7 +256,11 @@ export class HaStatisticPicker extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
protected render(): TemplateResult | typeof nothing {
|
||||
if (this._statistics.length === 0) {
|
||||
return nothing;
|
||||
}
|
||||
|
||||
return html`
|
||||
<ha-combo-box
|
||||
.hass=${this.hass}
|
||||
@ -265,9 +271,8 @@ export class HaStatisticPicker extends LitElement {
|
||||
.renderer=${this._rowRenderer}
|
||||
.disabled=${this.disabled}
|
||||
.allowCustomValue=${this.allowCustomEntity}
|
||||
.filteredItems=${this.value && this._statistics.length === 0
|
||||
? undefined
|
||||
: this._statistics}
|
||||
.items=${this._statistics}
|
||||
.filteredItems=${this._filteredItems ?? this._statistics}
|
||||
item-value-path="id"
|
||||
item-id-path="id"
|
||||
item-label-path="name"
|
||||
@ -303,11 +308,10 @@ export class HaStatisticPicker extends LitElement {
|
||||
}
|
||||
|
||||
private _filterChanged(ev: CustomEvent): void {
|
||||
const target = ev.target as HaComboBox;
|
||||
const filterString = ev.detail.value.toLowerCase();
|
||||
target.filteredItems = filterString.length
|
||||
this._filteredItems = filterString.length
|
||||
? fuzzyFilterSort<StatisticItem>(filterString, this._statistics)
|
||||
: this._statistics;
|
||||
: undefined;
|
||||
}
|
||||
|
||||
private _setValue(value: string) {
|
||||
|
@ -4,7 +4,6 @@ import "@material/mwc-list/mwc-list-item";
|
||||
import "@material/mwc-tab";
|
||||
import "@material/mwc-tab-bar";
|
||||
import { mdiDotsVertical } from "@mdi/js";
|
||||
import { PaperInputElement } from "@polymer/paper-input/paper-input";
|
||||
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { cache } from "lit/directives/cache";
|
||||
@ -15,7 +14,6 @@ import "../../../components/ha-circular-progress";
|
||||
import "../../../components/ha-expansion-panel";
|
||||
import "../../../components/ha-formfield";
|
||||
import "../../../components/ha-icon-button";
|
||||
import "../../../components/ha-radio";
|
||||
import { extractApiErrorMessage } from "../../../data/hassio/common";
|
||||
import {
|
||||
AccessPoints,
|
||||
@ -31,6 +29,10 @@ import {
|
||||
} from "../../../dialogs/generic/show-dialog-box";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
import { showIPDetailDialog } from "./show-ip-detail-dialog";
|
||||
import "../../../components/ha-textfield";
|
||||
import type { HaTextField } from "../../../components/ha-textfield";
|
||||
import "../../../components/ha-radio";
|
||||
import type { HaRadio } from "../../../components/ha-radio";
|
||||
|
||||
const IP_VERSIONS = ["ipv4", "ipv6"];
|
||||
|
||||
@ -213,18 +215,16 @@ export class HassioNetwork extends LitElement {
|
||||
${this._wifiConfiguration.auth === "wpa-psk" ||
|
||||
this._wifiConfiguration.auth === "wep"
|
||||
? html`
|
||||
<paper-input
|
||||
class="flex-auto"
|
||||
<ha-textfield
|
||||
type="password"
|
||||
id="psk"
|
||||
.label=${this.hass.localize(
|
||||
"ui.panel.config.network.supervisor.wifi_password"
|
||||
)}
|
||||
version="wifi"
|
||||
@value-changed=${this
|
||||
._handleInputValueChangedWifi}
|
||||
.version="wifi"
|
||||
@change=${this._handleInputValueChangedWifi}
|
||||
>
|
||||
</paper-input>
|
||||
</ha-textfield>
|
||||
`
|
||||
: ""}
|
||||
`
|
||||
@ -348,39 +348,36 @@ export class HassioNetwork extends LitElement {
|
||||
</div>
|
||||
${this._interface![version].method === "static"
|
||||
? html`
|
||||
<paper-input
|
||||
class="flex-auto"
|
||||
<ha-textfield
|
||||
id="address"
|
||||
.label=${this.hass.localize(
|
||||
"ui.panel.config.network.supervisor.ip_netmask"
|
||||
)}
|
||||
.version=${version}
|
||||
.value=${this._toString(this._interface![version].address)}
|
||||
@value-changed=${this._handleInputValueChanged}
|
||||
@change=${this._handleInputValueChanged}
|
||||
>
|
||||
</paper-input>
|
||||
<paper-input
|
||||
class="flex-auto"
|
||||
</ha-textfield>
|
||||
<ha-textfield
|
||||
id="gateway"
|
||||
.label=${this.hass.localize(
|
||||
"ui.panel.config.network.supervisor.gateway"
|
||||
)}
|
||||
.version=${version}
|
||||
.value=${this._interface![version].gateway}
|
||||
@value-changed=${this._handleInputValueChanged}
|
||||
@change=${this._handleInputValueChanged}
|
||||
>
|
||||
</paper-input>
|
||||
<paper-input
|
||||
class="flex-auto"
|
||||
</ha-textfield>
|
||||
<ha-textfield
|
||||
id="nameservers"
|
||||
.label=${this.hass.localize(
|
||||
"ui.panel.config.network.supervisor.dns_servers"
|
||||
)}
|
||||
.version=${version}
|
||||
.value=${this._toString(this._interface![version].nameservers)}
|
||||
@value-changed=${this._handleInputValueChanged}
|
||||
@change=${this._handleInputValueChanged}
|
||||
>
|
||||
</paper-input>
|
||||
</ha-textfield>
|
||||
`
|
||||
: ""}
|
||||
</ha-expansion-panel>
|
||||
@ -487,8 +484,9 @@ export class HassioNetwork extends LitElement {
|
||||
this._interface = { ...this._interfaces[ev.detail.index] };
|
||||
}
|
||||
|
||||
private _handleRadioValueChanged(ev: CustomEvent): void {
|
||||
const value = (ev.target as any).value as "disabled" | "auto" | "static";
|
||||
private _handleRadioValueChanged(ev: Event): void {
|
||||
const source = ev.target as HaRadio;
|
||||
const value = source.value as "disabled" | "auto" | "static";
|
||||
const version = (ev.target as any).version as "ipv4" | "ipv6";
|
||||
|
||||
if (
|
||||
@ -504,21 +502,19 @@ export class HassioNetwork extends LitElement {
|
||||
this.requestUpdate("_interface");
|
||||
}
|
||||
|
||||
private _handleRadioValueChangedAp(ev: CustomEvent): void {
|
||||
const value = (ev.target as any).value as string as
|
||||
| "open"
|
||||
| "wep"
|
||||
| "wpa-psk";
|
||||
private _handleRadioValueChangedAp(ev: Event): void {
|
||||
const source = ev.target as HaRadio;
|
||||
const value = source.value as string as "open" | "wep" | "wpa-psk";
|
||||
this._wifiConfiguration!.auth = value;
|
||||
this._dirty = true;
|
||||
this.requestUpdate("_wifiConfiguration");
|
||||
}
|
||||
|
||||
private _handleInputValueChanged(ev: CustomEvent): void {
|
||||
const value: string | null | undefined = (ev.target as PaperInputElement)
|
||||
.value;
|
||||
private _handleInputValueChanged(ev: Event): void {
|
||||
const source = ev.target as HaTextField;
|
||||
const value = source.value;
|
||||
const version = (ev.target as any).version as "ipv4" | "ipv6";
|
||||
const id = (ev.target as PaperInputElement).id;
|
||||
const id = source.id;
|
||||
|
||||
if (
|
||||
!value ||
|
||||
@ -532,10 +528,10 @@ export class HassioNetwork extends LitElement {
|
||||
this._interface[version]![id] = value;
|
||||
}
|
||||
|
||||
private _handleInputValueChangedWifi(ev: CustomEvent): void {
|
||||
const value: string | null | undefined = (ev.target as PaperInputElement)
|
||||
.value;
|
||||
const id = (ev.target as PaperInputElement).id;
|
||||
private _handleInputValueChangedWifi(ev: Event): void {
|
||||
const source = ev.target as HaTextField;
|
||||
const value = source.value;
|
||||
const id = source.id;
|
||||
|
||||
if (
|
||||
!value ||
|
||||
@ -573,8 +569,9 @@ export class HassioNetwork extends LitElement {
|
||||
--expansion-panel-summary-padding: 0 16px;
|
||||
margin: 4px 0;
|
||||
}
|
||||
paper-input {
|
||||
padding: 0 14px;
|
||||
ha-textfield {
|
||||
display: block;
|
||||
margin-top: 16px;
|
||||
}
|
||||
mwc-list-item {
|
||||
--mdc-list-side-padding: 10px;
|
||||
|
@ -80,6 +80,10 @@ export class HuiEnergySourcesTableCard
|
||||
let totalWater = 0;
|
||||
let totalWaterCost = 0;
|
||||
|
||||
let hasGridCost = false;
|
||||
let hasGasCost = false;
|
||||
let hasWaterCost = false;
|
||||
|
||||
let totalGridCompare = 0;
|
||||
let totalGridCostCompare = 0;
|
||||
let totalSolarCompare = 0;
|
||||
@ -477,6 +481,7 @@ export class HuiEnergySourcesTableCard
|
||||
) || 0
|
||||
: null;
|
||||
if (cost !== null) {
|
||||
hasGridCost = true;
|
||||
totalGridCost += cost;
|
||||
}
|
||||
|
||||
@ -575,6 +580,7 @@ export class HuiEnergySourcesTableCard
|
||||
) || 0) * -1
|
||||
: null;
|
||||
if (cost !== null) {
|
||||
hasGridCost = true;
|
||||
totalGridCost += cost;
|
||||
}
|
||||
|
||||
@ -686,14 +692,16 @@ export class HuiEnergySourcesTableCard
|
||||
? html`<td
|
||||
class="mdc-data-table__cell mdc-data-table__cell--numeric"
|
||||
>
|
||||
${formatNumber(
|
||||
totalGridCostCompare,
|
||||
this.hass.locale,
|
||||
{
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
}
|
||||
)}
|
||||
${hasGridCost
|
||||
? formatNumber(
|
||||
totalGridCostCompare,
|
||||
this.hass.locale,
|
||||
{
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
}
|
||||
)
|
||||
: ""}
|
||||
</td>`
|
||||
: ""}`
|
||||
: ""}
|
||||
@ -706,10 +714,12 @@ export class HuiEnergySourcesTableCard
|
||||
? html`<td
|
||||
class="mdc-data-table__cell mdc-data-table__cell--numeric"
|
||||
>
|
||||
${formatNumber(totalGridCost, this.hass.locale, {
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
})}
|
||||
${hasGridCost
|
||||
? formatNumber(totalGridCost, this.hass.locale, {
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
})
|
||||
: ""}
|
||||
</td>`
|
||||
: ""}
|
||||
</tr>`
|
||||
@ -737,6 +747,7 @@ export class HuiEnergySourcesTableCard
|
||||
0
|
||||
: null;
|
||||
if (cost !== null) {
|
||||
hasGasCost = true;
|
||||
totalGasCost += cost;
|
||||
}
|
||||
|
||||
@ -835,14 +846,16 @@ export class HuiEnergySourcesTableCard
|
||||
? html`<td
|
||||
class="mdc-data-table__cell mdc-data-table__cell--numeric"
|
||||
>
|
||||
${formatNumber(
|
||||
totalGasCostCompare,
|
||||
this.hass.locale,
|
||||
{
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
}
|
||||
)}
|
||||
${hasGasCost
|
||||
? formatNumber(
|
||||
totalGasCostCompare,
|
||||
this.hass.locale,
|
||||
{
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
}
|
||||
)
|
||||
: ""}
|
||||
</td>`
|
||||
: ""}`
|
||||
: ""}
|
||||
@ -855,10 +868,12 @@ export class HuiEnergySourcesTableCard
|
||||
? html`<td
|
||||
class="mdc-data-table__cell mdc-data-table__cell--numeric"
|
||||
>
|
||||
${formatNumber(totalGasCost, this.hass.locale, {
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
})}
|
||||
${hasGasCost
|
||||
? formatNumber(totalGasCost, this.hass.locale, {
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
})
|
||||
: ""}
|
||||
</td>`
|
||||
: ""}
|
||||
</tr>`
|
||||
@ -886,6 +901,7 @@ export class HuiEnergySourcesTableCard
|
||||
0
|
||||
: null;
|
||||
if (cost !== null) {
|
||||
hasWaterCost = true;
|
||||
totalWaterCost += cost;
|
||||
}
|
||||
|
||||
@ -984,14 +1000,16 @@ export class HuiEnergySourcesTableCard
|
||||
? html`<td
|
||||
class="mdc-data-table__cell mdc-data-table__cell--numeric"
|
||||
>
|
||||
${formatNumber(
|
||||
totalWaterCostCompare,
|
||||
this.hass.locale,
|
||||
{
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
}
|
||||
)}
|
||||
${hasWaterCost
|
||||
? formatNumber(
|
||||
totalWaterCostCompare,
|
||||
this.hass.locale,
|
||||
{
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
}
|
||||
)
|
||||
: ""}
|
||||
</td>`
|
||||
: ""}`
|
||||
: ""}
|
||||
@ -1004,16 +1022,18 @@ export class HuiEnergySourcesTableCard
|
||||
? html`<td
|
||||
class="mdc-data-table__cell mdc-data-table__cell--numeric"
|
||||
>
|
||||
${formatNumber(totalWaterCost, this.hass.locale, {
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
})}
|
||||
${hasWaterCost
|
||||
? formatNumber(totalWaterCost, this.hass.locale, {
|
||||
style: "currency",
|
||||
currency: this.hass.config.currency!,
|
||||
})
|
||||
: ""}
|
||||
</td>`
|
||||
: ""}
|
||||
</tr>`
|
||||
: ""}
|
||||
${[totalGasCost, totalWaterCost, totalGridCost].filter(Boolean)
|
||||
.length > 1
|
||||
${[hasGasCost, hasWaterCost, hasGridCost].filter(Boolean).length >
|
||||
1
|
||||
? html`<tr class="mdc-data-table__row total">
|
||||
<td class="mdc-data-table__cell"></td>
|
||||
<th class="mdc-data-table__cell" scope="row">
|
||||
@ -1022,9 +1042,7 @@ export class HuiEnergySourcesTableCard
|
||||
)}
|
||||
</th>
|
||||
${compare
|
||||
? html`${showCosts
|
||||
? html`<td class="mdc-data-table__cell"></td>`
|
||||
: ""}
|
||||
? html`<td class="mdc-data-table__cell"></td>
|
||||
<td
|
||||
class="mdc-data-table__cell mdc-data-table__cell--numeric"
|
||||
>
|
||||
|
@ -36,6 +36,7 @@ const HIDE_DOMAIN = new Set([
|
||||
"script",
|
||||
"sun",
|
||||
"zone",
|
||||
"event",
|
||||
]);
|
||||
|
||||
const HIDE_PLATFORM = new Set(["mobile_app"]);
|
||||
|
@ -68,16 +68,23 @@ class HuiEventEntityRow extends LitElement implements LovelaceRow {
|
||||
hasDoubleClick: hasAction(this._config.double_tap_action),
|
||||
})}
|
||||
>
|
||||
<div class="what">
|
||||
${computeStateDisplay(
|
||||
this.hass!.localize,
|
||||
stateObj,
|
||||
this.hass.locale,
|
||||
this.hass.config,
|
||||
this.hass.entities
|
||||
)}
|
||||
</div>
|
||||
<div class="when">
|
||||
${isUnavailableState(stateObj.state)
|
||||
? computeStateDisplay(
|
||||
this.hass!.localize,
|
||||
stateObj,
|
||||
this.hass.locale,
|
||||
this.hass.config,
|
||||
this.hass.entities
|
||||
)
|
||||
: html`<hui-timestamp-display
|
||||
.hass=${this.hass}
|
||||
.ts=${new Date(stateObj.state)}
|
||||
.format=${this._config.format}
|
||||
capitalize
|
||||
></hui-timestamp-display>`}
|
||||
</div>
|
||||
<div class="what">
|
||||
${isUnavailableState(stateObj.state)
|
||||
? ``
|
||||
: computeAttributeValueDisplay(
|
||||
@ -104,10 +111,10 @@ class HuiEventEntityRow extends LitElement implements LovelaceRow {
|
||||
text-align: right;
|
||||
}
|
||||
.when {
|
||||
color: var(--secondary-text-color);
|
||||
color: var(--primary-text-color);
|
||||
}
|
||||
.what {
|
||||
color: var(--primary-text-color);
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
@ -87,8 +87,7 @@ class PanelShoppingList extends LitElement {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
margin-left: 4px;
|
||||
margin-right: 4px;
|
||||
margin: 8px;
|
||||
}
|
||||
.column {
|
||||
flex: 1 0 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user