mirror of
https://github.com/supabase/supabase.git
synced 2026-06-20 02:27:21 +08:00
Chore/delay disk size report (#33686)
Dont show warning if project coming_up
This commit is contained in:
@@ -6,7 +6,9 @@ import { DocsButton } from 'components/ui/DocsButton'
|
||||
import { useDiskAttributesQuery } from 'data/config/disk-attributes-query'
|
||||
import { useDiskUtilizationQuery } from 'data/config/disk-utilization-query'
|
||||
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
|
||||
import dayjs from 'dayjs'
|
||||
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
|
||||
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
|
||||
import { GB } from 'lib/constants'
|
||||
import { Button, FormControl_Shadcn_, FormField_Shadcn_, Input_Shadcn_, Skeleton, cn } from 'ui'
|
||||
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
|
||||
@@ -35,6 +37,7 @@ export function DiskSizeField({
|
||||
const { ref: projectRef } = useParams()
|
||||
const { control, formState, setValue, trigger, getValues, resetField, watch } = form
|
||||
const org = useSelectedOrganization()
|
||||
const project = useSelectedProject()
|
||||
|
||||
const {
|
||||
isLoading: isLoadingDiskAttributes,
|
||||
@@ -59,6 +62,12 @@ export function DiskSizeField({
|
||||
const error = subscriptionError || diskUtilError || diskAttributesError
|
||||
const isError = isSubscriptionError || isDiskUtilizationError || isDiskAttributesError
|
||||
|
||||
// coming up typically takes 5 minutes, and the request is cached for 5 mins
|
||||
// so doing less than 10 mins to account for both
|
||||
const isProjectNew =
|
||||
dayjs.utc().diff(dayjs.utc(project?.inserted_at), 'minute') < 10 ||
|
||||
project?.status === 'COMING_UP'
|
||||
|
||||
const watchedStorageType = watch('storageType')
|
||||
const watchedTotalSize = watch('totalSize')
|
||||
|
||||
@@ -174,11 +183,20 @@ export function DiskSizeField({
|
||||
</div>
|
||||
<div className="col-span-8">
|
||||
<DiskSpaceBar form={form} />
|
||||
{error && (
|
||||
<FormMessage message="Failed to load disk size data" type="error">
|
||||
{error?.message}
|
||||
</FormMessage>
|
||||
|
||||
{isProjectNew ? (
|
||||
<FormMessage
|
||||
message="Disk size data is not available for ~10 minutes after project creation"
|
||||
type="error"
|
||||
/>
|
||||
) : (
|
||||
error && (
|
||||
<FormMessage message="Failed to load disk size data" type="error">
|
||||
{error?.message}
|
||||
</FormMessage>
|
||||
)
|
||||
)}
|
||||
|
||||
<DiskManagementDiskSizeReadReplicas
|
||||
isDirty={formState.dirtyFields.totalSize !== undefined}
|
||||
totalSize={(formState.defaultValues?.totalSize || 0) * 1.25}
|
||||
|
||||
Reference in New Issue
Block a user