This commit is contained in:
24
virtweb_frontend/src/widgets/forms/DiskSizeInput.tsx
Normal file
24
virtweb_frontend/src/widgets/forms/DiskSizeInput.tsx
Normal file
@ -0,0 +1,24 @@
|
||||
import { ServerApi } from "../../api/ServerApi";
|
||||
import { TextInput } from "./TextInput";
|
||||
|
||||
export function DiskSizeInput(p: {
|
||||
label?: string;
|
||||
value: number;
|
||||
onChange: (size: number) => void;
|
||||
}): React.ReactElement {
|
||||
return (
|
||||
<TextInput
|
||||
editable={true}
|
||||
label={p.label ?? "Disk size (GB)"}
|
||||
size={{
|
||||
min: ServerApi.Config.constraints.disk_size.min / (1000 * 1000 * 1000),
|
||||
max: ServerApi.Config.constraints.disk_size.max / (1000 * 1000 * 1000),
|
||||
}}
|
||||
value={(p.value / (1000 * 1000 * 1000)).toString()}
|
||||
onValueChange={(v) => {
|
||||
p.onChange?.(Number(v ?? "0") * 1000 * 1000 * 1000);
|
||||
}}
|
||||
type="number"
|
||||
/>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user