Process size of disks in bytes instead of megabytes
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-05-27 21:29:16 +02:00
parent 19ec9992be
commit 5a5450070a
3 changed files with 30 additions and 18 deletions

View File

@ -27,7 +27,7 @@ export function VMDisksList(p: {
const addNewDisk = () => {
p.vm.file_disks.push({
format: "QCow2",
size: 10000,
size: 10000 * 1000 * 1000,
delete: false,
name: `disk${p.vm.file_disks.length}`,
new: true,
@ -125,9 +125,9 @@ function DiskInfo(p: {
)}
</>
}
secondary={`${filesize(p.disk.size * 1000 * 1000)} - ${
p.disk.format
}${p.disk.format == "Raw" ? " - " + p.disk.alloc_type : ""}`}
secondary={`${filesize(p.disk.size)} - ${p.disk.format}${
p.disk.format == "Raw" ? " - " + p.disk.alloc_type : ""
}`}
/>
</ListItem>
);
@ -153,11 +153,16 @@ function DiskInfo(p: {
<TextInput
editable={true}
label="Disk size (MB)"
size={ServerApi.Config.constraints.disk_size}
value={p.disk.size.toString()}
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");
p.disk.size = Number(v ?? "0") * 1000 * 1000 * 1000;
p.onChange?.();
}}
type="number"