mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
chore: pitr entitlement check in db backups (#42901)
Adds the PITR entitlement check to the `Database Backup` -> `PITR` page.
This commit is contained in:
1 parent
c558c5d22e
commit
22ef5a306c
1 file changed
+7
-6
@@ -29,6 +29,7 @@ import {
|
||||
} from 'ui-patterns/PageHeader'
|
||||
import { PageSection, PageSectionContent } from 'ui-patterns/PageSection'
|
||||
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
|
||||
import { useCheckEntitlements } from '@/hooks/misc/useCheckEntitlements'
|
||||
|
||||
const DatabasePhysicalBackups: NextPageWithLayout = () => {
|
||||
return (
|
||||
@@ -65,18 +66,18 @@ DatabasePhysicalBackups.getLayout = (page) => (
|
||||
const PITR = () => {
|
||||
const { ref: projectRef } = useParams()
|
||||
const { data: project } = useSelectedProjectQuery()
|
||||
const { data: organization } = useSelectedOrganizationQuery()
|
||||
const { hasAccess: hasAccessToPitr, isLoading: isLoadingEntitlements } =
|
||||
useCheckEntitlements('pitr.available_variants')
|
||||
const isOrioleDbInAws = useIsOrioleDbInAws()
|
||||
const {
|
||||
data: backups,
|
||||
error,
|
||||
isPending: isLoading,
|
||||
isPending: isLoadingBackups,
|
||||
isError,
|
||||
isSuccess,
|
||||
} = useBackupsQuery({ projectRef })
|
||||
|
||||
const plan = organization?.plan?.id
|
||||
const isFreePlan = plan === 'free'
|
||||
const isLoading = isLoadingBackups || isLoadingEntitlements
|
||||
const isEnabled = backups?.pitr_enabled
|
||||
const isActiveHealthy = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY
|
||||
|
||||
@@ -109,12 +110,12 @@ const PITR = () => {
|
||||
<>
|
||||
{!isEnabled ? (
|
||||
<UpgradeToPro
|
||||
addon={isFreePlan ? undefined : 'pitr'}
|
||||
addon={hasAccessToPitr ? 'pitr' : undefined}
|
||||
source="pitr"
|
||||
featureProposition="enable Point in Time Recovery"
|
||||
primaryText="Point in Time Recovery is a Pro Plan add-on"
|
||||
secondaryText={
|
||||
isFreePlan
|
||||
!hasAccessToPitr
|
||||
? 'Roll back your database to a specific second. Starts at $100/month. Pro Plan already includes daily backups at no extra cost.'
|
||||
: 'Please enable the add-on to enable point in time recovery for your project.'
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user