mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-08-19 04:50:35 -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: {
|
||||
description: "",
|
||||
rulesSource: constants.defaultRulesSource,
|
||||
dnsEnable: false,
|
||||
dnsDomain: "",
|
||||
dnsWildcard: false,
|
||||
},
|
||||
members: [],
|
||||
};
|
||||
|
@ -79,6 +82,15 @@ async function updateNetworkAdditionalData(nwid, data) {
|
|||
if (data.hasOwnProperty("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) {
|
||||
db.get("networks")
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
Typography,
|
||||
TextField,
|
||||
Select,
|
||||
List,
|
||||
} from "@material-ui/core";
|
||||
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
|
||||
|
||||
|
@ -27,18 +28,18 @@ function NetworkSettings({ network, setNetwork }) {
|
|||
}
|
||||
};
|
||||
|
||||
const handleChange = (key1, key2, mode = "text", additionalData = null) => (
|
||||
event
|
||||
) => {
|
||||
const value = parseValue(event, mode, additionalData);
|
||||
const handleChange =
|
||||
(key1, key2, mode = "text", additionalData = null) =>
|
||||
(event) => {
|
||||
const value = parseValue(event, mode, additionalData);
|
||||
|
||||
let updatedNetwork = replaceValue({ ...network }, key1, key2, value);
|
||||
setNetwork(updatedNetwork);
|
||||
let updatedNetwork = replaceValue({ ...network }, key1, key2, value);
|
||||
setNetwork(updatedNetwork);
|
||||
|
||||
let data = setValue({}, key1, key2, value);
|
||||
let data = setValue({}, key1, key2, value);
|
||||
|
||||
sendReq(data);
|
||||
};
|
||||
sendReq(data);
|
||||
};
|
||||
|
||||
return (
|
||||
<Accordion>
|
||||
|
@ -89,6 +90,56 @@ function NetworkSettings({ network, setNetwork }) {
|
|||
<option value={true}>Private</option>
|
||||
<option value={false}>Public</option>
|
||||
</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>
|
||||
<Divider />
|
||||
<Grid item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue