Can restore disk image when adding disks to virtual machine
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
40
virtweb_frontend/src/widgets/forms/DiskImageSelect.tsx
Normal file
40
virtweb_frontend/src/widgets/forms/DiskImageSelect.tsx
Normal file
@ -0,0 +1,40 @@
|
||||
import React from "react";
|
||||
import { DiskImage } from "../../api/DiskImageApi";
|
||||
import {
|
||||
FormControl,
|
||||
InputLabel,
|
||||
Select,
|
||||
MenuItem,
|
||||
SelectChangeEvent,
|
||||
} from "@mui/material";
|
||||
import { FileDiskImageWidget } from "../FileDiskImageWidget";
|
||||
|
||||
/**
|
||||
* Select a disk image
|
||||
*/
|
||||
export function DiskImageSelect(p: {
|
||||
label: string;
|
||||
value?: string;
|
||||
onValueChange: (image: string | undefined) => void;
|
||||
list: DiskImage[];
|
||||
}): React.ReactElement {
|
||||
const handleChange = (event: SelectChangeEvent) => {
|
||||
p.onValueChange(event.target.value);
|
||||
};
|
||||
|
||||
return (
|
||||
<FormControl fullWidth variant="standard">
|
||||
<InputLabel>{p.label}</InputLabel>
|
||||
<Select value={p.value} label={p.label} onChange={handleChange}>
|
||||
<MenuItem value={undefined}>
|
||||
<i>None</i>
|
||||
</MenuItem>
|
||||
{p.list.map((d) => (
|
||||
<MenuItem value={d.file_name}>
|
||||
<FileDiskImageWidget image={d} />
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user