mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
chore: allow PITR without small compute addon (#50699)
We no longer require Small Compute add-on to configure PITR.
This commit is contained in:
1 parent
4b365eb4ee
commit
cee7461a9a
2 files changed
+2
-30
No files matched your search
@@ -29,7 +29,6 @@ import { BillingChangeBadge } from '../ui/BillingChangeBadge'
|
||||
import FormMessage from '../ui/FormMessage'
|
||||
import { useShowMicroUpgradeBadge } from './useShowMicroUpgradeBadge'
|
||||
import { SupportLink } from '@/components/interfaces/Support/SupportLink'
|
||||
import { InlineLink } from '@/components/ui/InlineLink'
|
||||
import { useProjectAddonsQuery } from '@/data/subscriptions/project-addons-query'
|
||||
import { useHighAvailability } from '@/hooks/misc/useHighAvailability'
|
||||
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
|
||||
@@ -113,8 +112,6 @@ export function ComputeSizeField({ form, disabled }: ComputeSizeFieldProps) {
|
||||
return getAvailableComputeOptions(availableAddons, project?.cloud_provider)
|
||||
}, [availableAddons, project?.cloud_provider])
|
||||
|
||||
const subscriptionPitr = addons?.selected_addons.find((addon) => addon.type === 'pitr')
|
||||
|
||||
const showSkeletons = isLoading
|
||||
const showLoadError = !isLoading && !!addonsError
|
||||
const showComputeOptions = !isLoading && !addonsError
|
||||
@@ -152,8 +149,6 @@ export function ComputeSizeField({ form, disabled }: ComputeSizeFieldProps) {
|
||||
{showComputeOptions && (
|
||||
<>
|
||||
{availableOptions.map((compute) => {
|
||||
const lockedMicroDueToPITR =
|
||||
compute.identifier === 'ci_micro' && !!subscriptionPitr
|
||||
const lockedNanoDueToPlan =
|
||||
org?.plan.id !== 'free' &&
|
||||
project?.infra_compute_size !== 'nano' &&
|
||||
@@ -161,8 +156,7 @@ export function ComputeSizeField({ form, disabled }: ComputeSizeFieldProps) {
|
||||
const lockedDueToHighAvailability =
|
||||
isHighAvailability && compute.identifier !== currentComputeVariantId
|
||||
|
||||
const lockedOption =
|
||||
lockedNanoDueToPlan || lockedMicroDueToPITR || lockedDueToHighAvailability
|
||||
const lockedOption = lockedNanoDueToPlan || lockedDueToHighAvailability
|
||||
|
||||
// Nano on a paid plan is billed at the Micro rate
|
||||
const isNanoBilledAsMicro =
|
||||
@@ -282,16 +276,6 @@ export function ComputeSizeField({ form, disabled }: ComputeSizeFieldProps) {
|
||||
Alpha
|
||||
</TooltipContent>
|
||||
)}
|
||||
{!lockedDueToHighAvailability && lockedMicroDueToPITR && (
|
||||
<TooltipContent side="bottom" className="w-64 text-center">
|
||||
Project has PITR enabled which requires a minimum of Small compute.
|
||||
Please{' '}
|
||||
<InlineLink href="/project/_/settings/addons?panel=pitr">
|
||||
disable PITR
|
||||
</InlineLink>{' '}
|
||||
first before selecting Micro
|
||||
</TooltipContent>
|
||||
)}
|
||||
</Tooltip>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -101,15 +101,12 @@ const PITRSidePanel = () => {
|
||||
const selectedAddons = addons?.selected_addons ?? []
|
||||
const availableAddons = addons?.available_addons ?? []
|
||||
|
||||
const subscriptionCompute = selectedAddons.find((addon) => addon.type === 'compute_instance')
|
||||
const subscriptionPitr = selectedAddons.find((addon) => addon.type === 'pitr')
|
||||
const availableOptions = availableAddons.find((addon) => addon.type === 'pitr')?.variants ?? []
|
||||
|
||||
const hasChanges = selectedOption !== (subscriptionPitr?.variant.identifier ?? 'pitr_0')
|
||||
const { hasAccess: hasAccessToPitrVariants } = useCheckEntitlements('pitr.available_variants')
|
||||
const selectedPitr = availableOptions.find((option) => option.identifier === selectedOption)
|
||||
const hasSufficientCompute =
|
||||
!!subscriptionCompute && subscriptionCompute.variant.identifier !== 'ci_micro'
|
||||
|
||||
// These are illegal states. If they are true, we should block the user from saving them.
|
||||
const blockDowngradeDueToHipaa =
|
||||
@@ -153,7 +150,6 @@ const PITRSidePanel = () => {
|
||||
!hasChanges ||
|
||||
isSubmitting ||
|
||||
!canUpdatePitr ||
|
||||
(!!selectedPitr && !hasSufficientCompute) ||
|
||||
(blockDowngradeDueToHipaa ?? undefined)
|
||||
}
|
||||
tooltip={
|
||||
@@ -269,14 +265,6 @@ const PITRSidePanel = () => {
|
||||
secondaryText="Upgrade your plan to change PITR for your project."
|
||||
featureProposition="enable PITR"
|
||||
/>
|
||||
) : !hasSufficientCompute ? (
|
||||
<UpgradeToPro
|
||||
className="mb-4"
|
||||
addon="computeSize"
|
||||
primaryText="Project needs to be at least on a Small compute size to enable PITR"
|
||||
secondaryText="This ensures enough resources to execute PITR successfully."
|
||||
featureProposition="enable PITR"
|
||||
/>
|
||||
) : null}
|
||||
|
||||
<label className="block text-sm text-foreground-light mb-4" htmlFor="pitr">
|
||||
@@ -287,7 +275,7 @@ const PITRSidePanel = () => {
|
||||
className="flex flex-wrap gap-3"
|
||||
value={selectedOption}
|
||||
onValueChange={(value) => setSelectedOption(value)}
|
||||
disabled={!hasAccessToPitrVariants || subscriptionCompute === undefined}
|
||||
disabled={!hasAccessToPitrVariants}
|
||||
>
|
||||
{availableOptions.map((option) => (
|
||||
<RadioGroupCardItem
|
||||
|
||||
Reference in new issue
Block a user