[FEATURE] Safely allow modifications
This commit is contained in:
parent
11f70087f1
commit
f277764cc0
3 changed files with 17 additions and 4 deletions
|
@ -3,7 +3,8 @@ import TextField from "@mui/material/TextField";
|
|||
import Autocomplete from "@mui/material/Autocomplete";
|
||||
import Chip from "@mui/material/Chip";
|
||||
|
||||
const validatePort = (p) => p !== "25565" && p !== "25575" && p.length < 6;
|
||||
const validatePort = (p) =>
|
||||
p !== "25565" && p !== "25575" && p.length < 6 && parseInt(p) < 60_000;
|
||||
|
||||
export default function ExtraPortsOption(props) {
|
||||
const { extraPorts: initExtraPorts } = props;
|
||||
|
@ -30,7 +31,14 @@ export default function ExtraPortsOption(props) {
|
|||
value={extraPorts}
|
||||
onChange={portChange}
|
||||
freeSolo
|
||||
renderInput={(p) => <TextField {...p} label="Extra Ports" />}
|
||||
renderInput={(p) => (
|
||||
<TextField
|
||||
{...p}
|
||||
label="Extra Ports"
|
||||
helperText="Remember to press enter to add the port!"
|
||||
FormHelperTextProps={{ sx: { ml: 0 } }}
|
||||
/>
|
||||
)}
|
||||
renderTags={(value, getTagProps) =>
|
||||
value.map((option, index) => {
|
||||
const defaultChipProps = getTagProps({ index });
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import TextField from "@mui/material/TextField";
|
||||
export default function HostOption(props) {
|
||||
const { value, onChange } = props;
|
||||
const { value, onChange, disabled } = props;
|
||||
|
||||
return (
|
||||
<TextField
|
||||
|
@ -10,6 +10,7 @@ export default function HostOption(props) {
|
|||
helperText="Example: host.mydomain.com"
|
||||
FormHelperTextProps={{ sx: { ml: 0 } }}
|
||||
required
|
||||
disabled={disabled}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,11 @@ export default function EditCoreOptions(props) {
|
|||
>
|
||||
<FormControl fullWidth sx={{ mt: "2rem", display: "flex", gap: ".5rem" }}>
|
||||
<NameOption value={spec.name} onChange={coreUpdate("name")} />
|
||||
<HostOption value={spec.host} onChange={coreUpdate("host")} />
|
||||
<HostOption
|
||||
value={spec.host}
|
||||
onChange={coreUpdate("host")}
|
||||
disabled={true}
|
||||
/>
|
||||
<VersionOption value={spec.version} onChange={coreUpdate("version")} />
|
||||
<ServerTypeOption
|
||||
value={spec.serverType}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue