Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix size validation on disk create from 1023 GiB snapshot #2641

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/forms/disk-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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))
}
}}
/>
Expand Down Expand Up @@ -289,7 +290,7 @@ const SnapshotSelectField = ({ control }: { control: Control<DiskCreate> }) => {
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))
}
}}
/>
Expand Down
Loading