Skip to content

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

studio: clarify storage bucket upgrade message for Pro users on Nano compute (#46008)

Ali Waseema1c7e57df3a9
diff --git a/apps/studio/components/interfaces/Storage/BucketsUpgradePlan.tsx b/apps/studio/components/interfaces/Storage/BucketsUpgradePlan.tsx
index de66af97ca2..d0404546cf7 100644
--- a/apps/studio/components/interfaces/Storage/BucketsUpgradePlan.tsx
+++ b/apps/studio/components/interfaces/Storage/BucketsUpgradePlan.tsx
@@ -1,13 +1,42 @@
+import { useParams } from 'common'
import { AnalyticsBucket as AnalyticsBucketIcon, VectorBucket as VectorBucketIcon } from 'icons'
import { EmptyStatePresentational } from 'ui-patterns'
import { PageContainer } from 'ui-patterns/PageContainer'
import { PageSection, PageSectionContent } from 'ui-patterns/PageSection'
+import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
import { BUCKET_TYPES } from './Storage.constants'
import { AlphaNotice } from '@/components/ui/AlphaNotice'
import { UpgradePlanButton } from '@/components/ui/UpgradePlanButton'
+import { useProjectStorageConfigQuery } from '@/data/config/project-storage-config-query'
+import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
+import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
export const BucketsUpgradePlan = ({ type }: { type: 'analytics' | 'vector' }) => {
+ const { ref: projectRef } = useParams()
+ const { isLoading: isLoadingStorageConfig } = useProjectStorageConfigQuery({ projectRef })
+ const { data: organization, isLoading: isLoadingOrganization } = useSelectedOrganizationQuery()
+ const { data: project, isLoading: isLoadingProject } = useSelectedProjectQuery()
+
+ const isLoading =
+ isLoadingStorageConfig || isLoadingOrganization || isLoadingProject || !organization || !project
+
+ if (isLoading) {
+ return (
+ <PageContainer>
+ <PageSection>
+ <PageSectionContent className="flex flex-col gap-y-8">
+ <GenericSkeletonLoader />
+ </PageSectionContent>
+ </PageSection>
+ </PageContainer>
+ )
+ }
+
+ const isFreePlan = organization.plan?.id === 'free'
+ const isNanoCompute = project.infra_compute_size === 'nano'
+ const requiresComputeUpgrade = !isFreePlan && isNanoCompute
+
return (
<PageContainer>
<PageSection>
@@ -27,14 +56,17 @@ export const BucketsUpgradePlan = ({ type }: { type: 'analytics' | 'vector' }) =
? BUCKET_TYPES.analytics.valueProp
: BUCKET_TYPES.vectors.valueProp
}
- description={`Upgrade to Pro to use ${type} buckets for your project`}
+ description={
+ requiresComputeUpgrade
+ ? `Upgrade your project's compute size to Micro or larger to use ${type} buckets`
+ : `Upgrade to Pro to use ${type} buckets for your project`
+ }
>
- <div className="flex items-center gap-x-2">
- <UpgradePlanButton
- source={`${type}Buckets`}
- featureProposition={`use ${type} buckets`}
- />
- </div>
+ <UpgradePlanButton
+ source={`${type}Buckets`}
+ featureProposition={`use ${type} buckets`}
+ addon={requiresComputeUpgrade ? 'computeSize' : undefined}
+ />
</EmptyStatePresentational>
</PageSectionContent>
</PageSection>
diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/RegionLimitation.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/RegionLimitation.tsx
new file mode 100644
index 00000000000..bb7f7cdce1e
--- /dev/null
+++ b/apps/studio/components/interfaces/Storage/VectorBuckets/RegionLimitation.tsx
@@ -0,0 +1,77 @@
+import { VectorBucket } from 'icons'
+import { AWS_REGIONS } from 'shared-data'
+import { Tooltip, TooltipContent, TooltipTrigger } from 'ui'
+import {
+ EmptyStatePresentational,
+ PageContainer,
+ PageSection,
+ PageSectionContent,
+} from 'ui-patterns'
+
+import { AVAILABLE_REPLICA_REGIONS } from '@/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants'
+import { AlphaNotice } from '@/components/ui/AlphaNotice'
+import { InlineLinkClassName } from '@/components/ui/InlineLink'
+import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
+
+export const VECTOR_BUCKETS_AVAILABLE_REGIONS = [
+ 'us-east-1',
+ 'us-east-2',
+ 'us-west-2',
+ 'eu-central-1',
+ 'ap-southeast-2',
+]
+
+const getRegionNameFromCode = (code: string) =>
+ Object.values(AWS_REGIONS).find((x) => x.code === code)?.displayName
+
+export const RegionLimitation = () => {
+ const { data: project } = useSelectedProjectQuery()
+
+ const regionLabel = AVAILABLE_REPLICA_REGIONS.find((region) =>
+ project?.region?.includes(region.region)
+ )
+
+ return (
+ <PageContainer>
+ <PageSection>
+ <PageSectionContent className="flex flex-col gap-y-8">
+ <AlphaNotice
+ entity="Vector buckets"
+ feedbackUrl="https://github.com/orgs/supabase/discussions/40815"
+ />
+ <EmptyStatePresentational
+ icon={VectorBucket}
+ className="[&>div>div>h3]:flex [&>div>div>h3]:items-center [&>div>div>h3]:gap-x-2"
+ title="Coming soon to your project's region"
+ description={
+ <>
+ Your project is in{' '}
+ <Tooltip>
+ <TooltipTrigger className={InlineLinkClassName}>
+ {regionLabel?.name}
+ </TooltipTrigger>
+ <TooltipContent side="bottom">{regionLabel?.region}</TooltipContent>
+ </Tooltip>
+ , but Vector buckets are only available for{' '}
+ <Tooltip>
+ <TooltipTrigger className={InlineLinkClassName}>certain regions</TooltipTrigger>
+ <TooltipContent side="bottom">
+ <ul>
+ {VECTOR_BUCKETS_AVAILABLE_REGIONS.map((x) => (
+ <li key={x}>
+ <span>{getRegionNameFromCode(x)}</span>
+ <span className="text-foreground-light ml-2">{x}</span>
+ </li>
+ ))}
+ </ul>
+ </TooltipContent>
+ </Tooltip>
+ . We're actively looking to expand that soon.
+ </>
+ }
+ />
+ </PageSectionContent>
+ </PageSection>
+ </PageContainer>
+ )
+}
diff --git a/apps/studio/pages/project/[ref]/storage/vectors/index.tsx b/apps/studio/pages/project/[ref]/storage/vectors/index.tsx
index d15b1cc7139..edc2cd6a79e 100644
--- a/apps/studio/pages/project/[ref]/storage/vectors/index.tsx
+++ b/apps/studio/pages/project/[ref]/storage/vectors/index.tsx
@@ -1,86 +1,30 @@
import { useParams } from 'common'
-import { VectorBucket } from 'icons'
-import { AWS_REGIONS } from 'shared-data'
-import { Tooltip, TooltipContent, TooltipTrigger } from 'ui'
-import {
- EmptyStatePresentational,
- PageContainer,
- PageSection,
- PageSectionContent,
-} from 'ui-patterns'
-import { AVAILABLE_REPLICA_REGIONS } from '@/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants'
import { BucketsUpgradePlan } from '@/components/interfaces/Storage/BucketsUpgradePlan'
import { VectorsBuckets } from '@/components/interfaces/Storage/VectorBuckets'
+import {
+ RegionLimitation,
+ VECTOR_BUCKETS_AVAILABLE_REGIONS,
+} from '@/components/interfaces/Storage/VectorBuckets/RegionLimitation'
import { DefaultLayout } from '@/components/layouts/DefaultLayout'
import { StorageBucketsLayout } from '@/components/layouts/StorageLayout/StorageBucketsLayout'
import StorageLayout from '@/components/layouts/StorageLayout/StorageLayout'
-import { AlphaNotice } from '@/components/ui/AlphaNotice'
-import { InlineLinkClassName } from '@/components/ui/InlineLink'
import { useIsVectorBucketsEnabled } from '@/data/config/project-storage-config-query'
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
import type { NextPageWithLayout } from '@/types'
-const AVAILABLE_REGIONS = ['us-east-1', 'us-east-2', 'us-west-2', 'eu-central-1', 'ap-southeast-2']
-
-const getRegionNameFromCode = (code: string) =>
- Object.values(AWS_REGIONS).find((x) => x.code === code)?.displayName
-
const StorageVectorsPage: NextPageWithLayout = () => {
const { ref: projectRef } = useParams()
const { data: project } = useSelectedProjectQuery()
const isVectorBucketsEnabled = useIsVectorBucketsEnabled({ projectRef })
// [Joshen] We're actively looking into lifting this restriction so can remove once done
- const isAvailableInProjectRegion = AVAILABLE_REGIONS.includes(project?.region ?? '')
- const regionLabel = AVAILABLE_REPLICA_REGIONS.find((region) =>
- project?.region?.includes(region.region)
+ const isAvailableInProjectRegion = VECTOR_BUCKETS_AVAILABLE_REGIONS.includes(
+ project?.region ?? ''
)
if (!isAvailableInProjectRegion) {
- return (
- <PageContainer>
- <PageSection>
- <PageSectionContent className="flex flex-col gap-y-8">
- <AlphaNotice
- entity="Vector buckets"
- feedbackUrl="https://github.com/orgs/supabase/discussions/40815"
- />
- <EmptyStatePresentational
- icon={VectorBucket}
- className="[&>div>div>h3]:flex [&>div>div>h3]:items-center [&>div>div>h3]:gap-x-2"
- title="Coming soon to your project's region"
- description={
- <p>
- Your project is in{' '}
- <Tooltip>
- <TooltipTrigger className={InlineLinkClassName}>
- {regionLabel?.name}
- </TooltipTrigger>
- <TooltipContent side="bottom">{regionLabel?.region}</TooltipContent>
- </Tooltip>
- , but Vector buckets are only available for{' '}
- <Tooltip>
- <TooltipTrigger className={InlineLinkClassName}>certain regions</TooltipTrigger>
- <TooltipContent side="bottom">
- <ul>
- {AVAILABLE_REGIONS.map((x) => (
- <li key={x}>
- <span>{getRegionNameFromCode(x)}</span>
- <span className="text-foreground-light ml-2">{x}</span>
- </li>
- ))}
- </ul>
- </TooltipContent>
- </Tooltip>
- . We're actively looking to expand that soon.
- </p>
- }
- />
- </PageSectionContent>
- </PageSection>
- </PageContainer>
- )
+ return <RegionLimitation />
} else if (!isVectorBucketsEnabled) {
return <BucketsUpgradePlan type="vector" />
} else {