mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-12 20:06:33 +00:00
Use null instead of default, to avoid stomping on netmask (#23382)
This commit is contained in:
parent
147098f0fd
commit
7d0a269f1b
@ -117,11 +117,10 @@ export const accesspointScan = async (
|
||||
};
|
||||
|
||||
export const parseAddress = (address: string) => {
|
||||
const isIPv6 = address.includes(":");
|
||||
const [ip, cidr] = address.includes("/")
|
||||
? address.split("/")
|
||||
: [address, isIPv6 ? "64" : "24"];
|
||||
return { ip, mask: cidrToNetmask(cidr, isIPv6) };
|
||||
const [ip, cidr] = address.split("/");
|
||||
const isIPv6 = ip.includes(":");
|
||||
const mask = cidr ? cidrToNetmask(cidr, isIPv6) : null;
|
||||
return { ip, mask };
|
||||
};
|
||||
|
||||
export const formatAddress = (ip: string, mask: string) =>
|
||||
|
@ -655,8 +655,14 @@ export class HassioNetwork extends LitElement {
|
||||
this._dirty = true;
|
||||
if (id === "address") {
|
||||
const index = (ev.target as any).index as number;
|
||||
const { mask: oldMask } = parseAddress(
|
||||
this._interface![version]!.address![index]
|
||||
);
|
||||
const { mask } = parseAddress(value);
|
||||
this._interface[version]!.address![index] = formatAddress(value, mask);
|
||||
this._interface[version]!.address![index] = formatAddress(
|
||||
value,
|
||||
mask || oldMask || ""
|
||||
);
|
||||
this.requestUpdate("_interface");
|
||||
} else if (id === "netmask") {
|
||||
const index = (ev.target as any).index as number;
|
||||
|
Loading…
x
Reference in New Issue
Block a user