Ready to implement network routes contents

This commit is contained in:
2023-12-04 20:16:32 +01:00
parent 0e3945089c
commit e579a3aadd
16 changed files with 523 additions and 46 deletions

View File

@ -1,19 +1,18 @@
import { Grid, Paper, Typography } from "@mui/material";
import { PropsWithChildren } from "react";
import { Grid } from "@mui/material";
import React from "react";
import { validate as validateUUID } from "uuid";
import { IsoFile, IsoFilesApi } from "../../api/IsoFilesApi";
import { ServerApi } from "../../api/ServerApi";
import { VMInfo } from "../../api/VMApi";
import { AsyncWidget } from "../AsyncWidget";
import { CheckboxInput } from "../forms/CheckboxInput";
import { EditSection } from "../forms/EditSection";
import { SelectInput } from "../forms/SelectInput";
import { TextInput } from "../forms/TextInput";
import { VMScreenshot } from "./VMScreenshot";
import { IsoFile, IsoFilesApi } from "../../api/IsoFilesApi";
import { AsyncWidget } from "../AsyncWidget";
import React from "react";
import { filesize } from "filesize";
import { VMAutostartInput } from "../forms/VMAutostartInput";
import { VMDisksList } from "../forms/VMDisksList";
import { VMSelectIsoInput } from "../forms/VMSelectIsoInput";
import { VMAutostartInput } from "../forms/VMAutostartInput";
import { VMScreenshot } from "./VMScreenshot";
interface DetailsProps {
vm: VMInfo;
@ -34,7 +33,7 @@ export function VMDetails(p: DetailsProps): React.ReactElement {
loadKey={"1"}
load={load}
errMsg="Failed to load the list of ISO files"
build={() => <VMDetailsInner isoList={list!} {...p} />}
build={() => <VMDetailsInner isoList={list} {...p} />}
/>
);
}
@ -63,7 +62,7 @@ function VMDetailsInner(
p.onChange?.();
}}
checkValue={(v) => /^[a-zA-Z0-9]+$/.test(v)}
size={ServerApi.Config.constraints.name_size}
size={ServerApi.Config.constraints.vm_name_size}
/>
<TextInput label="UUID" editable={false} value={p.vm.uuid} />
@ -87,7 +86,7 @@ function VMDetailsInner(
p.vm.title = v;
p.onChange?.();
}}
size={ServerApi.Config.constraints.title_size}
size={ServerApi.Config.constraints.vm_title_size}
/>
<TextInput
@ -176,18 +175,3 @@ function VMDetailsInner(
</Grid>
);
}
function EditSection(
p: { title: string } & PropsWithChildren
): React.ReactElement {
return (
<Grid item sm={12} md={6}>
<Paper style={{ margin: "10px", padding: "10px" }}>
<Typography variant="h5" style={{ marginBottom: "15px" }}>
{p.title}
</Typography>
{p.children}
</Paper>
</Grid>
);
}