mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Replace paper-input elements in supervisor network dialog (#17387)
This commit is contained in:
parent
f792e708a3
commit
e8aa08b717
@ -4,7 +4,6 @@ import "@material/mwc-list/mwc-list-item";
|
|||||||
import "@material/mwc-tab";
|
import "@material/mwc-tab";
|
||||||
import "@material/mwc-tab-bar";
|
import "@material/mwc-tab-bar";
|
||||||
import { mdiDotsVertical } from "@mdi/js";
|
import { mdiDotsVertical } from "@mdi/js";
|
||||||
import { PaperInputElement } from "@polymer/paper-input/paper-input";
|
|
||||||
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { cache } from "lit/directives/cache";
|
import { cache } from "lit/directives/cache";
|
||||||
@ -15,7 +14,6 @@ import "../../../components/ha-circular-progress";
|
|||||||
import "../../../components/ha-expansion-panel";
|
import "../../../components/ha-expansion-panel";
|
||||||
import "../../../components/ha-formfield";
|
import "../../../components/ha-formfield";
|
||||||
import "../../../components/ha-icon-button";
|
import "../../../components/ha-icon-button";
|
||||||
import "../../../components/ha-radio";
|
|
||||||
import { extractApiErrorMessage } from "../../../data/hassio/common";
|
import { extractApiErrorMessage } from "../../../data/hassio/common";
|
||||||
import {
|
import {
|
||||||
AccessPoints,
|
AccessPoints,
|
||||||
@ -31,6 +29,10 @@ import {
|
|||||||
} from "../../../dialogs/generic/show-dialog-box";
|
} from "../../../dialogs/generic/show-dialog-box";
|
||||||
import type { HomeAssistant } from "../../../types";
|
import type { HomeAssistant } from "../../../types";
|
||||||
import { showIPDetailDialog } from "./show-ip-detail-dialog";
|
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"];
|
const IP_VERSIONS = ["ipv4", "ipv6"];
|
||||||
|
|
||||||
@ -213,18 +215,16 @@ export class HassioNetwork extends LitElement {
|
|||||||
${this._wifiConfiguration.auth === "wpa-psk" ||
|
${this._wifiConfiguration.auth === "wpa-psk" ||
|
||||||
this._wifiConfiguration.auth === "wep"
|
this._wifiConfiguration.auth === "wep"
|
||||||
? html`
|
? html`
|
||||||
<paper-input
|
<ha-textfield
|
||||||
class="flex-auto"
|
|
||||||
type="password"
|
type="password"
|
||||||
id="psk"
|
id="psk"
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.network.supervisor.wifi_password"
|
"ui.panel.config.network.supervisor.wifi_password"
|
||||||
)}
|
)}
|
||||||
version="wifi"
|
.version="wifi"
|
||||||
@value-changed=${this
|
@change=${this._handleInputValueChangedWifi}
|
||||||
._handleInputValueChangedWifi}
|
|
||||||
>
|
>
|
||||||
</paper-input>
|
</ha-textfield>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
`
|
`
|
||||||
@ -348,39 +348,36 @@ export class HassioNetwork extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
${this._interface![version].method === "static"
|
${this._interface![version].method === "static"
|
||||||
? html`
|
? html`
|
||||||
<paper-input
|
<ha-textfield
|
||||||
class="flex-auto"
|
|
||||||
id="address"
|
id="address"
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.network.supervisor.ip_netmask"
|
"ui.panel.config.network.supervisor.ip_netmask"
|
||||||
)}
|
)}
|
||||||
.version=${version}
|
.version=${version}
|
||||||
.value=${this._toString(this._interface![version].address)}
|
.value=${this._toString(this._interface![version].address)}
|
||||||
@value-changed=${this._handleInputValueChanged}
|
@change=${this._handleInputValueChanged}
|
||||||
>
|
>
|
||||||
</paper-input>
|
</ha-textfield>
|
||||||
<paper-input
|
<ha-textfield
|
||||||
class="flex-auto"
|
|
||||||
id="gateway"
|
id="gateway"
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.network.supervisor.gateway"
|
"ui.panel.config.network.supervisor.gateway"
|
||||||
)}
|
)}
|
||||||
.version=${version}
|
.version=${version}
|
||||||
.value=${this._interface![version].gateway}
|
.value=${this._interface![version].gateway}
|
||||||
@value-changed=${this._handleInputValueChanged}
|
@change=${this._handleInputValueChanged}
|
||||||
>
|
>
|
||||||
</paper-input>
|
</ha-textfield>
|
||||||
<paper-input
|
<ha-textfield
|
||||||
class="flex-auto"
|
|
||||||
id="nameservers"
|
id="nameservers"
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.network.supervisor.dns_servers"
|
"ui.panel.config.network.supervisor.dns_servers"
|
||||||
)}
|
)}
|
||||||
.version=${version}
|
.version=${version}
|
||||||
.value=${this._toString(this._interface![version].nameservers)}
|
.value=${this._toString(this._interface![version].nameservers)}
|
||||||
@value-changed=${this._handleInputValueChanged}
|
@change=${this._handleInputValueChanged}
|
||||||
>
|
>
|
||||||
</paper-input>
|
</ha-textfield>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
</ha-expansion-panel>
|
</ha-expansion-panel>
|
||||||
@ -487,8 +484,9 @@ export class HassioNetwork extends LitElement {
|
|||||||
this._interface = { ...this._interfaces[ev.detail.index] };
|
this._interface = { ...this._interfaces[ev.detail.index] };
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleRadioValueChanged(ev: CustomEvent): void {
|
private _handleRadioValueChanged(ev: Event): void {
|
||||||
const value = (ev.target as any).value as "disabled" | "auto" | "static";
|
const source = ev.target as HaRadio;
|
||||||
|
const value = source.value as "disabled" | "auto" | "static";
|
||||||
const version = (ev.target as any).version as "ipv4" | "ipv6";
|
const version = (ev.target as any).version as "ipv4" | "ipv6";
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -504,21 +502,19 @@ export class HassioNetwork extends LitElement {
|
|||||||
this.requestUpdate("_interface");
|
this.requestUpdate("_interface");
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleRadioValueChangedAp(ev: CustomEvent): void {
|
private _handleRadioValueChangedAp(ev: Event): void {
|
||||||
const value = (ev.target as any).value as string as
|
const source = ev.target as HaRadio;
|
||||||
| "open"
|
const value = source.value as string as "open" | "wep" | "wpa-psk";
|
||||||
| "wep"
|
|
||||||
| "wpa-psk";
|
|
||||||
this._wifiConfiguration!.auth = value;
|
this._wifiConfiguration!.auth = value;
|
||||||
this._dirty = true;
|
this._dirty = true;
|
||||||
this.requestUpdate("_wifiConfiguration");
|
this.requestUpdate("_wifiConfiguration");
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleInputValueChanged(ev: CustomEvent): void {
|
private _handleInputValueChanged(ev: Event): void {
|
||||||
const value: string | null | undefined = (ev.target as PaperInputElement)
|
const source = ev.target as HaTextField;
|
||||||
.value;
|
const value = source.value;
|
||||||
const version = (ev.target as any).version as "ipv4" | "ipv6";
|
const version = (ev.target as any).version as "ipv4" | "ipv6";
|
||||||
const id = (ev.target as PaperInputElement).id;
|
const id = source.id;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!value ||
|
!value ||
|
||||||
@ -532,10 +528,10 @@ export class HassioNetwork extends LitElement {
|
|||||||
this._interface[version]![id] = value;
|
this._interface[version]![id] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleInputValueChangedWifi(ev: CustomEvent): void {
|
private _handleInputValueChangedWifi(ev: Event): void {
|
||||||
const value: string | null | undefined = (ev.target as PaperInputElement)
|
const source = ev.target as HaTextField;
|
||||||
.value;
|
const value = source.value;
|
||||||
const id = (ev.target as PaperInputElement).id;
|
const id = source.id;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!value ||
|
!value ||
|
||||||
@ -573,8 +569,9 @@ export class HassioNetwork extends LitElement {
|
|||||||
--expansion-panel-summary-padding: 0 16px;
|
--expansion-panel-summary-padding: 0 16px;
|
||||||
margin: 4px 0;
|
margin: 4px 0;
|
||||||
}
|
}
|
||||||
paper-input {
|
ha-textfield {
|
||||||
padding: 0 14px;
|
display: block;
|
||||||
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
mwc-list-item {
|
mwc-list-item {
|
||||||
--mdc-list-side-padding: 10px;
|
--mdc-list-side-padding: 10px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user