mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
chore: compute entitlement set (#40352)
* chore: compute entitlement set * Clean up * Clean up * Format
This commit is contained in:
1 parent
23c7c8c63e
commit
35387c6f1c
2 files changed
+11
-7
No files matched your search
@@ -89,7 +89,9 @@ export function DiskManagementForm() {
|
||||
},
|
||||
})
|
||||
|
||||
const { hasAccess } = useCheckEntitlements('instances.compute_update')
|
||||
const { hasAccess, isSuccess: isEntitlementsLoaded } = useCheckEntitlements(
|
||||
'instances.compute_update_available_sizes'
|
||||
)
|
||||
|
||||
const [isDialogOpen, setIsDialogOpen] = useState<boolean>(false)
|
||||
const [refetchInterval, setRefetchInterval] = useState<number | false>(false)
|
||||
@@ -318,7 +320,7 @@ export function DiskManagementForm() {
|
||||
<ScaffoldContainer className="relative flex flex-col gap-10" bottomPadding>
|
||||
<NoticeBar
|
||||
type="default"
|
||||
visible={!hasAccess}
|
||||
visible={isEntitlementsLoaded && !hasAccess}
|
||||
title="Compute and Disk configuration is not available on the Free Plan"
|
||||
actions={<UpgradePlanButton source="diskManagementConfigure" plan="Pro" />}
|
||||
description="You will need to upgrade to at least the Pro Plan to configure compute and disk"
|
||||
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
import { BillingChangeBadge } from '../ui/BillingChangeBadge'
|
||||
import FormMessage from '../ui/FormMessage'
|
||||
import { NoticeBar } from '../ui/NoticeBar'
|
||||
import { useCheckEntitlements } from 'hooks/misc/useCheckEntitlements'
|
||||
|
||||
/**
|
||||
* to do: this could be a type from api-types
|
||||
@@ -57,6 +58,9 @@ export function ComputeSizeField({ form, disabled }: ComputeSizeFieldProps) {
|
||||
const { data: org } = useSelectedOrganizationQuery()
|
||||
const { data: project, isLoading: isProjectLoading } = useSelectedProjectQuery()
|
||||
|
||||
const { hasAccess: entitledUpdateCompute, isLoading: isEntitlementLoading } =
|
||||
useCheckEntitlements('instances.compute_update_available_sizes')
|
||||
|
||||
const showComputePrice = useIsFeatureEnabled('project_addons:show_compute_price')
|
||||
|
||||
const { computeSize, storageType } = form.watch()
|
||||
@@ -67,7 +71,7 @@ export function ComputeSizeField({ form, disabled }: ComputeSizeFieldProps) {
|
||||
error: addonsError,
|
||||
} = useProjectAddonsQuery({ projectRef: ref })
|
||||
|
||||
const isLoading = isProjectLoading || isAddonsLoading
|
||||
const isLoading = isProjectLoading || isAddonsLoading || isEntitlementLoading
|
||||
|
||||
const { control, formState, setValue, trigger } = form
|
||||
|
||||
@@ -92,10 +96,8 @@ export function ComputeSizeField({ form, disabled }: ComputeSizeFieldProps) {
|
||||
plan: org?.plan.id ?? 'free',
|
||||
})
|
||||
|
||||
const showUpgradeBadge = showMicroUpgrade(
|
||||
org?.plan.id ?? 'free',
|
||||
project?.infra_compute_size ?? 'nano'
|
||||
)
|
||||
const projectComputeSize = project?.infra_compute_size ?? 'nano'
|
||||
const showUpgradeBadge = entitledUpdateCompute && projectComputeSize === 'nano'
|
||||
|
||||
return (
|
||||
<FormField_Shadcn_
|
||||
|
||||
Reference in new issue
Block a user