Can define IP reservations for networks
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Checkbox, Grid } from "@mui/material";
|
||||
import { Checkbox, Grid, Paper } from "@mui/material";
|
||||
import React from "react";
|
||||
import { IpConfig, NetworkApi, NetworkInfo } from "../../api/NetworksApi";
|
||||
import { ServerApi } from "../../api/ServerApi";
|
||||
@ -10,6 +10,7 @@ import { TextInput } from "../forms/TextInput";
|
||||
import { useConfirm } from "../../hooks/providers/ConfirmDialogProvider";
|
||||
import { CheckboxInput } from "../forms/CheckboxInput";
|
||||
import { ResAutostartInput } from "../forms/ResAutostartInput";
|
||||
import { DHCPHostReservations } from "./DHCPHostReservations";
|
||||
|
||||
interface DetailsProps {
|
||||
net: NetworkInfo;
|
||||
@ -239,44 +240,59 @@ function IPSection(p: {
|
||||
/>
|
||||
|
||||
<CheckboxInput
|
||||
checked={!!p.config.dhcp_range}
|
||||
checked={!!p.config.dhcp}
|
||||
editable={p.editable}
|
||||
label="Enable DHCP"
|
||||
onValueChange={(v) => {
|
||||
if (v)
|
||||
p.config!.dhcp_range =
|
||||
p.config!.dhcp =
|
||||
p.version === 4
|
||||
? ["192.168.1.100", "192.168.1.200"]
|
||||
: ["fd00::100", "fd00::f00"];
|
||||
else p.config!.dhcp_range = undefined;
|
||||
? {
|
||||
start: "192.168.1.100",
|
||||
end: "192.168.1.200",
|
||||
hosts: [],
|
||||
}
|
||||
: { start: "fd00::100", end: "fd00::f00", hosts: [] };
|
||||
else p.config!.dhcp = undefined;
|
||||
p.onChange?.(p.config);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{p.config?.dhcp_range && (
|
||||
{p.config?.dhcp && (
|
||||
<>
|
||||
<IPInput
|
||||
label="DHCP allocation start"
|
||||
editable={p.editable}
|
||||
version={p.version}
|
||||
value={p.config.dhcp_range[0]}
|
||||
onValueChange={(v) => {
|
||||
p.config!.dhcp_range![0] = v!;
|
||||
p.onChange(p.config);
|
||||
}}
|
||||
/>
|
||||
<IPInput
|
||||
label="DHCP allocation end"
|
||||
editable={p.editable}
|
||||
version={p.version}
|
||||
value={p.config.dhcp_range[1]}
|
||||
onValueChange={(v) => {
|
||||
p.config!.dhcp_range![1] = v!;
|
||||
p.onChange(p.config);
|
||||
}}
|
||||
/>
|
||||
<Paper elevation={3} style={{ padding: "10px" }}>
|
||||
<IPInput
|
||||
label="DHCP allocation start"
|
||||
editable={p.editable}
|
||||
version={p.version}
|
||||
value={p.config.dhcp.start}
|
||||
onValueChange={(v) => {
|
||||
p.config!.dhcp!.start = v!;
|
||||
p.onChange(p.config);
|
||||
}}
|
||||
/>
|
||||
<IPInput
|
||||
label="DHCP allocation end"
|
||||
editable={p.editable}
|
||||
version={p.version}
|
||||
value={p.config.dhcp.end}
|
||||
onValueChange={(v) => {
|
||||
p.config!.dhcp!.end = v!;
|
||||
p.onChange(p.config);
|
||||
}}
|
||||
/>
|
||||
|
||||
<DHCPHostReservations
|
||||
{...p}
|
||||
dhcp={p.config.dhcp}
|
||||
onChange={(d) => {
|
||||
p.config!.dhcp = d;
|
||||
p.onChange?.(p.config);
|
||||
}}
|
||||
/>
|
||||
</Paper>
|
||||
</>
|
||||
)}
|
||||
</EditSection>
|
||||
|
Reference in New Issue
Block a user