mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-08-19 13:01:30 -07:00
feat: input basic data for ZeroNSd setup
Updated Network page Updated save on db.json
This commit is contained in:
parent
9318658a16
commit
60a307f562
2 changed files with 72 additions and 9 deletions
|
@ -62,6 +62,9 @@ async function createNetworkAdditionalData(nwid) {
|
||||||
additionalConfig: {
|
additionalConfig: {
|
||||||
description: "",
|
description: "",
|
||||||
rulesSource: constants.defaultRulesSource,
|
rulesSource: constants.defaultRulesSource,
|
||||||
|
dnsEnable: false,
|
||||||
|
dnsDomain: "",
|
||||||
|
dnsWildcard: false,
|
||||||
},
|
},
|
||||||
members: [],
|
members: [],
|
||||||
};
|
};
|
||||||
|
@ -79,6 +82,15 @@ async function updateNetworkAdditionalData(nwid, data) {
|
||||||
if (data.hasOwnProperty("rulesSource")) {
|
if (data.hasOwnProperty("rulesSource")) {
|
||||||
additionalData.rulesSource = data.rulesSource;
|
additionalData.rulesSource = data.rulesSource;
|
||||||
}
|
}
|
||||||
|
if (data.hasOwnProperty("dnsEnable")) {
|
||||||
|
additionalData.dnsEnable = data.dnsEnable;
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("dnsDomain")) {
|
||||||
|
additionalData.dnsDomain = data.dnsDomain;
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("dnsWildcard")) {
|
||||||
|
additionalData.dnsWildcard = data.dnsWildcard;
|
||||||
|
}
|
||||||
|
|
||||||
if (additionalData) {
|
if (additionalData) {
|
||||||
db.get("networks")
|
db.get("networks")
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
Typography,
|
Typography,
|
||||||
TextField,
|
TextField,
|
||||||
Select,
|
Select,
|
||||||
|
List,
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
|
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
|
||||||
|
|
||||||
|
@ -27,18 +28,18 @@ function NetworkSettings({ network, setNetwork }) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChange = (key1, key2, mode = "text", additionalData = null) => (
|
const handleChange =
|
||||||
event
|
(key1, key2, mode = "text", additionalData = null) =>
|
||||||
) => {
|
(event) => {
|
||||||
const value = parseValue(event, mode, additionalData);
|
const value = parseValue(event, mode, additionalData);
|
||||||
|
|
||||||
let updatedNetwork = replaceValue({ ...network }, key1, key2, value);
|
let updatedNetwork = replaceValue({ ...network }, key1, key2, value);
|
||||||
setNetwork(updatedNetwork);
|
setNetwork(updatedNetwork);
|
||||||
|
|
||||||
let data = setValue({}, key1, key2, value);
|
let data = setValue({}, key1, key2, value);
|
||||||
|
|
||||||
sendReq(data);
|
sendReq(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Accordion>
|
<Accordion>
|
||||||
|
@ -89,6 +90,56 @@ function NetworkSettings({ network, setNetwork }) {
|
||||||
<option value={true}>Private</option>
|
<option value={true}>Private</option>
|
||||||
<option value={false}>Public</option>
|
<option value={false}>Public</option>
|
||||||
</Select>
|
</Select>
|
||||||
|
<Divider />
|
||||||
|
<Typography>ZeroDNS setup</Typography>
|
||||||
|
<List
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Grid item>
|
||||||
|
<Checkbox
|
||||||
|
checked={network["dnsEnable"]}
|
||||||
|
color="primary"
|
||||||
|
onChange={handleChange("dnsEnable", null, "checkbox")}
|
||||||
|
/>
|
||||||
|
<span>Enable DNS</span>
|
||||||
|
</Grid>
|
||||||
|
<Divider
|
||||||
|
orientation="vertical"
|
||||||
|
style={{
|
||||||
|
margin: "10px",
|
||||||
|
}}
|
||||||
|
flexItem
|
||||||
|
/>
|
||||||
|
<Grid item>
|
||||||
|
<TextField
|
||||||
|
value={network["dnsDomain"]}
|
||||||
|
onChange={handleChange("dnsDomain")}
|
||||||
|
label="Domain"
|
||||||
|
variant="filled"
|
||||||
|
InputLabelProps={{
|
||||||
|
shrink: true,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Divider
|
||||||
|
orientation="vertical"
|
||||||
|
style={{
|
||||||
|
margin: "10px",
|
||||||
|
}}
|
||||||
|
flexItem
|
||||||
|
/>
|
||||||
|
<Grid item>
|
||||||
|
<Checkbox
|
||||||
|
checked={network["dnsWildcard"]}
|
||||||
|
color="primary"
|
||||||
|
onChange={handleChange("dnsWildcard", null, "checkbox")}
|
||||||
|
/>
|
||||||
|
<span>Use wildcards</span>
|
||||||
|
</Grid>
|
||||||
|
</List>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Divider />
|
<Divider />
|
||||||
<Grid item>
|
<Grid item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue