mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 04:45:08 +03:00
https://linear.app/supabase/issue/FE-2226/fix-incorrect-baseline-and-max-iopsthroughput-values - Centralized compute/disk limits in packages/shared-data/compute-disk-limits.ts (MB/s, baseline+max IOPS/throughput) and re-exported from shared-data. - Hooked Docs compute/disk table into shared data, converted docs text/table to MB/s baseline/max. - Removed duplicated compute IOPS/throughput constants from Studio, Studio now imports shared data. - Updated Studio disk schema: compute-aware MAX IOPS/throughput validation (MB/s), defaults computeSize to ci_micro, and gp3/io2 checks use compute caps. - Clarified disk update mutation to send throughput as MB/s despite backend throughput_mbps field name. - Added tests for compute-size mappings and IOPS helper logic. - Added Infra ownership for shared compute/disk data in CODEOWNERS. - Locked zod version via catalog and added zod dep to shared-data. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a reusable Compute Disk Limits table and centralized compute disk limits dataset for dynamic display. * **Documentation** * Replaced static per-size tables with a component-driven MB/s view; clarified baseline vs. burst behavior and updated guides and troubleshooting. * **Bug Fixes** * Validation and UI guidance now honor compute-size limits for IOPS and throughput. * **Tests** * Expanded unit tests for sizing, mappings, and edge cases. * **Chores** * Published shared-data exports, added a validation schema, pinned a dependency, and added ownership entries. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
65 lines
2.3 KiB
TypeScript
65 lines
2.3 KiB
TypeScript
import { AnimatePresence, motion } from 'framer-motion'
|
|
import { ReactNode } from 'react'
|
|
import { UseFormReturn } from 'react-hook-form'
|
|
|
|
import { Admonition } from 'ui-patterns/admonition'
|
|
import { DiskStorageSchemaType } from '../DiskManagement.schema'
|
|
import {
|
|
calculateComputeSizeRequiredForIops,
|
|
calculateMaxIopsForComputeSize,
|
|
mapAddOnVariantIdToComputeSize,
|
|
} from '../DiskManagement.utils'
|
|
import { COMPUTE_BASELINE_IOPS, COMPUTE_MAX_IOPS } from 'shared-data'
|
|
import { RESTRICTED_COMPUTE_FOR_IOPS_ON_GP3 } from './DiskManagement.constants'
|
|
|
|
interface ComputeSizeRecommendationSectionProps {
|
|
actions?: ReactNode
|
|
form: UseFormReturn<DiskStorageSchemaType>
|
|
}
|
|
|
|
export function ComputeSizeRecommendationSection({
|
|
actions,
|
|
form,
|
|
}: ComputeSizeRecommendationSectionProps) {
|
|
const { watch } = form
|
|
const computeSize = watch('computeSize')
|
|
const iops = watch('provisionedIOPS')
|
|
|
|
const computeSizeRecommendedForIops = calculateComputeSizeRequiredForIops(iops)
|
|
const maxIopsForComputeSize = calculateMaxIopsForComputeSize(computeSize ?? 'ci_micro')
|
|
const isVisible =
|
|
iops > maxIopsForComputeSize &&
|
|
!RESTRICTED_COMPUTE_FOR_IOPS_ON_GP3.includes(computeSize ?? 'ci_micro')
|
|
|
|
return (
|
|
<AnimatePresence initial={false}>
|
|
{isVisible && (
|
|
<motion.div
|
|
initial={{ opacity: 0, height: 0 }}
|
|
animate={{ opacity: 1, height: 'auto' }}
|
|
exit={{ opacity: 0, height: 0 }}
|
|
transition={{ duration: 0.15 }}
|
|
>
|
|
<Admonition
|
|
type="default"
|
|
title={`Your compute size baseline is ${COMPUTE_BASELINE_IOPS[computeSize ?? 'ci_micro']} IOPS (max ${COMPUTE_MAX_IOPS[computeSize ?? 'ci_micro'] ?? maxIopsForComputeSize} IOPS)`}
|
|
>
|
|
<div className="flex flex-col gap-2">
|
|
<div>
|
|
<p className="text-sm text-foreground-light">
|
|
To achieve higher IOPS performance we recommend using the{' '}
|
|
<span className="text-foreground">
|
|
{mapAddOnVariantIdToComputeSize(computeSizeRecommendedForIops)}
|
|
</span>{' '}
|
|
compute size.
|
|
</p>
|
|
</div>
|
|
{actions && <div>{actions}</div>}
|
|
</div>
|
|
</Admonition>
|
|
</motion.div>
|
|
)}
|
|
</AnimatePresence>
|
|
)
|
|
}
|