Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: compute Instances entitlements (#39848)

Ignacio Dobronich26286fd16243
diff --git a/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx b/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx
index 34b228bc60e..19ab6c1881f 100644
--- a/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx
+++ b/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx
@@ -64,6 +64,7 @@ import {
} from './ui/DiskManagement.constants'
import { NoticeBar } from './ui/NoticeBar'
import { SpendCapDisabledSection } from './ui/SpendCapDisabledSection'
+import { useCheckEntitlements } from 'hooks/misc/useCheckEntitlements'
export function DiskManagementForm() {
const { ref: projectRef } = useParams()
@@ -88,6 +89,8 @@ export function DiskManagementForm() {
},
})
+ const { hasAccess, entitlementConfig } = useCheckEntitlements('instances.compute_update')
+
const [isDialogOpen, setIsDialogOpen] = useState<boolean>(false)
const [refetchInterval, setRefetchInterval] = useState<number | false>(false)
const [message, setMessageState] = useState<DiskManagementMessage | null>(null)
@@ -192,7 +195,7 @@ export function DiskManagementForm() {
const isRequestingChanges = data?.requested_modification !== undefined
const readReplicas = (databases ?? []).filter((db) => db.identifier !== projectRef)
- const isPlanUpgradeRequired = org?.plan.id === 'free'
+ const isPlanUpgradeRequired = !hasAccess
const { formState } = form
const usedSize = Math.round(((diskUtil?.metrics.fs_used_bytes ?? 0) / GB) * 100) / 100
@@ -200,8 +203,7 @@ export function DiskManagementForm() {
const usedPercentage = (usedSize / totalSize) * 100
const disableIopsThroughputConfig =
- RESTRICTED_COMPUTE_FOR_THROUGHPUT_ON_GP3.includes(form.watch('computeSize')) &&
- org?.plan.id !== 'free'
+ RESTRICTED_COMPUTE_FOR_THROUGHPUT_ON_GP3.includes(form.watch('computeSize')) && !hasAccess
const isBranch = project?.parent_project_ref !== undefined
@@ -316,7 +318,7 @@ export function DiskManagementForm() {
<ScaffoldContainer className="relative flex flex-col gap-10" bottomPadding>
<NoticeBar
type="default"
- visible={isPlanUpgradeRequired}
+ visible={!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"