This commit is contained in:
2025-03-28 12:12:11 +01:00
parent 9a905e83f7
commit 3bf8859ff9
20 changed files with 129 additions and 70 deletions

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
import { TextInput } from "./TextInput";
export function MACInput(p: {

@ -1,3 +1,4 @@
/* eslint-disable react-x/no-array-index-key */
import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
import DeleteIcon from "@mui/icons-material/Delete";
@ -66,9 +67,19 @@ export function NWFilterRules(p: {
deleteRule(n);
}}
onGoDown={
n < p.rules.length - 1 ? () => { swapRules(n, n + 1); } : undefined
n < p.rules.length - 1
? () => {
swapRules(n, n + 1);
}
: undefined
}
onGoUp={
n > 0
? () => {
swapRules(n, n - 1);
}
: undefined
}
onGoUp={n > 0 ? () => { swapRules(n, n - 1); } : undefined}
{...p}
/>
))}
@ -153,7 +164,9 @@ function NWRuleEdit(p: {
editable={p.editable}
onChange={p.onChange}
selector={s}
onDelete={() => { deleteSelector(n); }}
onDelete={() => {
deleteSelector(n);
}}
/>
))}
</CardContent>

@ -1,3 +1,4 @@
/* eslint-disable react-x/no-array-index-key */
import { mdiIp } from "@mdi/js";
import Icon from "@mdi/react";
import DeleteIcon from "@mui/icons-material/Delete";

@ -54,6 +54,7 @@ export function NetNatConfiguration(p: {
<>
{p.nat.map((e, num) => (
<NatEntryForm
// eslint-disable-next-line react-x/no-array-index-key
key={num}
{...p}
entry={e}

@ -2,7 +2,7 @@ import { TextField } from "@mui/material";
import { LenConstraint } from "../../api/ServerApi";
/**
* Couple / Member property edition
* Text input property edition
*/
export function TextInput(p: {
label?: string;
@ -42,12 +42,14 @@ export function TextInput(p: {
e.target.value.length === 0 ? undefined : e.target.value
)
}
inputProps={{
maxLength: p.size?.max,
}}
InputProps={{
readOnly: !p.editable,
type: p.type,
slotProps={{
htmlInput: {
maxLength: p.size?.max,
},
input: {
readOnly: !p.editable,
type: p.type,
},
}}
variant={"standard"}
style={p.style ?? { width: "100%", marginBottom: "15px" }}

@ -40,6 +40,7 @@ export function VMDisksList(p: {
{/* disks list */}
{p.vm.disks.map((d, num) => (
<DiskInfo
// eslint-disable-next-line react-x/no-array-index-key
key={num}
editable={p.editable}
disk={d}

@ -1,3 +1,4 @@
/* eslint-disable react-x/no-array-index-key */
import DeleteIcon from "@mui/icons-material/Delete";
import {
Button,

@ -19,7 +19,7 @@ export function VMSelectIsoInput(p: {
attachedISOs: string[];
onChange: (newVal: string[]) => void;
}): React.ReactElement {
if (!p.attachedISOs && !p.editable) return <></>;
if (p.attachedISOs.length === 0 && !p.editable) return <></>;
return (
<>
@ -27,7 +27,7 @@ export function VMSelectIsoInput(p: {
const iso = p.isoList.find((d) => d.filename === isoName);
return (
<ListItem
key={num}
key={isoName}
secondaryAction={
p.editable && (
<IconButton
@ -69,12 +69,11 @@ export function VMSelectIsoInput(p: {
}
}}
options={p.isoList.map((i) => {
return {
label: `${i.filename} ${filesize(i.size)}`,
value: i.filename,
};
})
}
return {
label: `${i.filename} ${filesize(i.size)}`,
value: i.filename,
};
})}
/>
</>
);