mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 01:06:35 +00:00
Seperate addresses in network configuration (#9319)
This commit is contained in:
parent
07f4e5ac5c
commit
2eb35668fa
@ -1,5 +1,12 @@
|
|||||||
import "@polymer/paper-tooltip/paper-tooltip";
|
import "@polymer/paper-tooltip/paper-tooltip";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import {
|
||||||
|
css,
|
||||||
|
CSSResultGroup,
|
||||||
|
html,
|
||||||
|
nothing,
|
||||||
|
LitElement,
|
||||||
|
TemplateResult,
|
||||||
|
} from "lit";
|
||||||
import { customElement, state, property } from "lit/decorators";
|
import { customElement, state, property } from "lit/decorators";
|
||||||
import {
|
import {
|
||||||
Adapter,
|
Adapter,
|
||||||
@ -17,18 +24,19 @@ import "./ha-icon";
|
|||||||
|
|
||||||
const format_addresses = (
|
const format_addresses = (
|
||||||
addresses: IPv6ConfiguredAddress[] | IPv4ConfiguredAddress[]
|
addresses: IPv6ConfiguredAddress[] | IPv4ConfiguredAddress[]
|
||||||
): TemplateResult[] =>
|
): TemplateResult =>
|
||||||
addresses.map(
|
html`${addresses.map((address, i) => [
|
||||||
(address) => html`<span>${address.address}/${address.network_prefix}</span>`
|
html`<span>${address.address}/${address.network_prefix}</span>`,
|
||||||
);
|
i < addresses.length - 1 ? ", " : nothing,
|
||||||
|
])}`;
|
||||||
|
|
||||||
const format_auto_detected_interfaces = (
|
const format_auto_detected_interfaces = (
|
||||||
adapters: Adapter[]
|
adapters: Adapter[]
|
||||||
): Array<TemplateResult | string> =>
|
): Array<TemplateResult | string> =>
|
||||||
adapters.map((adapter) =>
|
adapters.map((adapter) =>
|
||||||
adapter.auto
|
adapter.auto
|
||||||
? html`${adapter.name} (${format_addresses(adapter.ipv4)}
|
? html`${adapter.name}
|
||||||
${format_addresses(adapter.ipv6)} )`
|
(${format_addresses([...adapter.ipv4, ...adapter.ipv6])})`
|
||||||
: ""
|
: ""
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -88,8 +96,7 @@ export class HaNetwork extends LitElement {
|
|||||||
: ""}
|
: ""}
|
||||||
</span>
|
</span>
|
||||||
<span slot="description">
|
<span slot="description">
|
||||||
${format_addresses(adapter.ipv4)}
|
${format_addresses([...adapter.ipv4, ...adapter.ipv6])}
|
||||||
${format_addresses(adapter.ipv6)}
|
|
||||||
</span>
|
</span>
|
||||||
</ha-settings-row>`
|
</ha-settings-row>`
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user