Can resize disk image when adding a new disk image to a VM
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -31,6 +31,9 @@ export interface BaseFileVMDisk {
|
||||
// For new disk only
|
||||
from_image?: string;
|
||||
|
||||
// Resize disk image after clone
|
||||
resize?: boolean;
|
||||
|
||||
// application attributes
|
||||
new?: boolean;
|
||||
deleteType?: "keepfile" | "deletefile";
|
||||
|
@ -218,24 +218,40 @@ function DiskInfo(p: {
|
||||
/>
|
||||
)}
|
||||
|
||||
<TextInput
|
||||
editable={true}
|
||||
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.disk.size / (1000 * 1000 * 1000)).toString()}
|
||||
onValueChange={(v) => {
|
||||
p.disk.size = Number(v ?? "0") * 1000 * 1000 * 1000;
|
||||
p.onChange?.();
|
||||
}}
|
||||
type="number"
|
||||
disabled={!!p.disk.from_image}
|
||||
/>
|
||||
{/* Resize disk image */}
|
||||
{!!p.disk.from_image && (
|
||||
<CheckboxInput
|
||||
editable
|
||||
checked={p.disk.resize}
|
||||
label="Resize disk file"
|
||||
onValueChange={(v) => {
|
||||
p.disk.resize = v;
|
||||
p.onChange?.();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Disk size */}
|
||||
{(!p.disk.from_image || p.disk.resize === true) && (
|
||||
<TextInput
|
||||
editable={true}
|
||||
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.disk.size / (1000 * 1000 * 1000)).toString()}
|
||||
onValueChange={(v) => {
|
||||
p.disk.size = Number(v ?? "0") * 1000 * 1000 * 1000;
|
||||
p.onChange?.();
|
||||
}}
|
||||
type="number"
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Disk image selection */}
|
||||
<DiskImageSelect
|
||||
label="Use disk image as template"
|
||||
list={p.diskImagesList}
|
||||
|
Reference in New Issue
Block a user