Files
supabase/apps/studio/components/interfaces/DiskManagement/ui/DiskCountdownRadial.tsx
Alaister YoungandAlaister Young 4a18670367 [FE-2417] fix(studio): update disk EBS UI copy to match new limits (#47646)
Updates the dashboard disk-management copy to match the new AWS EBS
modification limits (already reflected in the docs): from the old fixed
"4-hour cooldown / once every 4 hours" framing to "up to 4 modifications
within a rolling 24-hour window".

This is a copy-only change plus one small logic-constant alignment.
Timer/countdown behavior is unchanged — this only updates wording to
bring the dashboard in line with the docs.

**Changed:**
- `DiskSpaceBar` autoscaling tooltip, `DiskCountdownRadial` card,
`DiskSizeConfiguration` "Importing a lot of data?" alert,
`DiskSizeConfigurationModal` alert title + both countdown branches,
`DiskManagementReviewAndSubmitDialog` IOPS + disk-size row descriptions,
and two code comments — all reworded to the new "4 per rolling 24-hour
window" framing
- `DiskSizeConfigurationModal` countdown now derives from the shared
`COOLDOWN_DURATION` constant (4h) instead of a stale hardcoded `6 * 60`
(6h), so the legacy resize path matches the newer disk-attributes path

## To test

- Open a Pro AWS project → **Settings → Compute and Disk** → hover the
**Autoscaling** pill on the disk bar: tooltip should read "…limited to 4
within a rolling 24-hour window" (no "once every 4 hours")
- Change IOPS only → **Review changes** → IOPS row description shows the
new "rolling 24-hour window… as soon as the previous one completes" copy
- Change disk size → **Review changes** → Disk size row shows "You can
modify disk attributes up to 4 times within a rolling 24-hour window"
(not "For 4 hours after changes…")
- On a non-AWS Pro project → **Database → Settings → Increase disk
size**: modal title reads "Disk modifications are limited to 4 per
rolling 24-hour window"; any "resize again in ~X" countdown is bounded
by 4 hours, not 6
- Sanity: none of the old "4-hour cooldown" / "once every 4 hours"
strings appear anywhere in the disk UI

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Updated disk resizing messages across the app to reflect a rolling
24-hour limit instead of a fixed 4-hour cooldown.
* Clarified when disk size, IOPS, and throughput changes are available
again, including more accurate next-available timing.
* Improved warning copy in disk configuration and review dialogs so
limit messages are consistent and easier to understand.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-07-06 23:16:00 +08:00

70 lines
2.4 KiB
TypeScript

import { useParams } from 'common'
import { AnimatePresence, motion } from 'framer-motion'
import { useEffect, useState } from 'react'
import { Card, CardContent } from 'ui'
import FormMessage from './FormMessage'
import CountdownTimerRadial from '@/components/ui/CountdownTimer/CountdownTimerRadial'
import CountdownTimerSpan from '@/components/ui/CountdownTimer/CountdownTimerSpan'
import { useRemainingDurationForDiskAttributeUpdate } from '@/data/config/disk-attributes-query'
import { COOLDOWN_DURATION } from '@/data/config/disk-attributes-update-mutation'
export function DiskCountdownRadial() {
const { ref } = useParams()
const [remainingTime, setRemainingTime] = useState(0)
const {
remainingDuration: initialRemainingTime,
error,
isSuccess,
} = useRemainingDurationForDiskAttributeUpdate({
projectRef: ref,
})
const progressPercentage = (remainingTime / COOLDOWN_DURATION) * 100
useEffect(() => {
if (initialRemainingTime > 0) setRemainingTime(initialRemainingTime)
}, [initialRemainingTime])
useEffect(() => {
if (remainingTime <= 0) return
const timer = setInterval(() => {
setRemainingTime(Math.max(0, remainingTime - 1))
}, 1000)
return () => clearInterval(timer)
}, [remainingTime])
return (
<AnimatePresence>
{remainingTime > 0 && isSuccess && (
<motion.div
initial={{ opacity: 0, height: 0 }}
animate={{ opacity: 1, height: 'auto' }}
exit={{ opacity: 0, height: 0 }}
transition={{ duration: 0.2 }}
>
<Card className="px-2 rounded-sm bg-surface-100">
<CardContent className="py-3 flex gap-3 px-3 items-start">
<CountdownTimerRadial progress={progressPercentage} />
<div className="flex flex-col gap-2">
<div>
<p className="text-foreground text-sm p-0">Disk modification limit reached</p>
<p className="text-foreground-lighter text-sm p-0">
You can modify disk attributes up to 4 times within a rolling 24-hour window.
You'll be able to make changes again once the window allows it.
</p>
</div>
<CountdownTimerSpan seconds={remainingTime} />
</div>
</CardContent>
</Card>
</motion.div>
)}
{error && <FormMessage message={error.message} type="error" />}
</AnimatePresence>
)
}