diff --git a/app/forms/disk-create.tsx b/app/forms/disk-create.tsx index 680115e268..e807b64177 100644 --- a/app/forms/disk-create.tsx +++ b/app/forms/disk-create.tsx @@ -11,6 +11,7 @@ import { useController, useForm, type Control } from 'react-hook-form' import { useNavigate, type NavigateFunction } from 'react-router' import { + MAX_DISK_SIZE_GiB, useApiMutation, useApiQuery, useApiQueryClient, @@ -228,7 +229,7 @@ const DiskSourceField = ({ const imageSizeGiB = image.size / GiB if (diskSizeField.value < imageSizeGiB) { const nearest10 = Math.ceil(imageSizeGiB / 10) * 10 - diskSizeField.onChange(nearest10) + diskSizeField.onChange(Math.min(nearest10, MAX_DISK_SIZE_GiB)) } }} /> @@ -289,7 +290,7 @@ const SnapshotSelectField = ({ control }: { control: Control }) => { const snapshotSizeGiB = snapshot.size / GiB if (diskSizeField.value < snapshotSizeGiB) { const nearest10 = Math.ceil(snapshotSizeGiB / 10) * 10 - diskSizeField.onChange(nearest10) + diskSizeField.onChange(Math.min(nearest10, MAX_DISK_SIZE_GiB)) } }} />