41 lines
993 B
TypeScript
41 lines
993 B
TypeScript
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>
|
|
);
|
|
}
|