Skip to content

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

Only show analytics and vector buckets for hosted (#40418)

Joshen Limdbbae988a91c
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/index.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/index.tsx
index e68594c9c31..8c1b10def65 100644
--- a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/index.tsx
+++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/index.tsx
@@ -72,7 +72,7 @@ export const AnalyticBucketDetails = () => {
projectRef,
bucketId: bucket?.id,
})
- const { data } = useReplicationPipelineStatusQuery(
+ const { data, isSuccess: isSuccessPipelineStatus } = useReplicationPipelineStatusQuery(
{ projectRef, pipelineId: pipeline?.id },
{
refetchInterval: (data) => {
@@ -245,7 +245,7 @@ export const AnalyticBucketDetails = () => {
</>
) : (
<>
- {!!pipeline && !isPipelineRunning && (
+ {!!pipeline && !!isSuccessPipelineStatus && !isPipelineRunning && (
<Admonition
type="note"
layout="horizontal"
diff --git a/apps/studio/components/interfaces/Storage/Storage.constants.ts b/apps/studio/components/interfaces/Storage/Storage.constants.ts
index ce316ec56a8..f38e691985f 100644
--- a/apps/studio/components/interfaces/Storage/Storage.constants.ts
+++ b/apps/studio/components/interfaces/Storage/Storage.constants.ts
@@ -62,6 +62,7 @@ export const CONTEXT_MENU_KEYS = {
export const BUCKET_TYPES = {
files: {
+ platformOnly: false,
displayName: 'Files',
singularName: 'file',
article: 'a',
@@ -70,6 +71,7 @@ export const BUCKET_TYPES = {
docsUrl: `${DOCS_URL}/guides/storage/buckets/fundamentals`,
},
analytics: {
+ platformOnly: true,
displayName: 'Analytics',
singularName: 'analytics',
article: 'an',
@@ -78,6 +80,7 @@ export const BUCKET_TYPES = {
docsUrl: `${DOCS_URL}/guides/storage/analytics/introduction`,
},
vectors: {
+ platformOnly: true,
displayName: 'Vectors',
singularName: 'vector',
article: 'a',
@@ -86,5 +89,5 @@ export const BUCKET_TYPES = {
docsUrl: `${DOCS_URL}/guides/storage/vectors`,
},
}
-export const BUCKET_TYPE_KEYS = Object.keys(BUCKET_TYPES) as Array<keyof typeof BUCKET_TYPES>
+
export const DEFAULT_BUCKET_TYPE: keyof typeof BUCKET_TYPES = 'files'
diff --git a/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx b/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx
index 5d09ecb5ce9..3e2a5b6b64b 100644
--- a/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx
@@ -6,7 +6,7 @@ import {
useIsVectorBucketsEnabled,
} from 'data/config/project-storage-config-query'
import { Badge, Menu } from 'ui'
-import { BUCKET_TYPES, BUCKET_TYPE_KEYS } from './Storage.constants'
+import { BUCKET_TYPES } from './Storage.constants'
import { useStorageV2Page } from './Storage.utils'
export const StorageMenuV2 = () => {
@@ -22,28 +22,29 @@ export const StorageMenuV2 = () => {
<div className="mx-3">
<Menu.Group title={<span className="uppercase font-mono">Manage</span>} />
- {BUCKET_TYPE_KEYS.map((bucketTypeKey) => {
- const isSelected = page === bucketTypeKey
- const config = BUCKET_TYPES[bucketTypeKey]
- const isAlphaEnabled =
- (bucketTypeKey === 'analytics' && isAnalyticsBucketsEnabled) ||
- (bucketTypeKey === 'vectors' && isVectorBucketsEnabled)
+ {Object.entries(BUCKET_TYPES)
+ .filter(([_, config]) => IS_PLATFORM || (!IS_PLATFORM && !config.platformOnly))
+ .map(([type, config]) => {
+ const isSelected = page === type
+ const isAlphaEnabled =
+ (type === 'analytics' && isAnalyticsBucketsEnabled) ||
+ (type === 'vectors' && isVectorBucketsEnabled)
- return (
- <Link key={bucketTypeKey} href={`/project/${ref}/storage/${bucketTypeKey}`}>
- <Menu.Item rounded active={isSelected}>
- <div className="flex items-center justify-between">
- <p className="truncate">{config.displayName}</p>
- {isAlphaEnabled && (
- <Badge variant="success" size="tiny">
- New
- </Badge>
- )}
- </div>
- </Menu.Item>
- </Link>
- )
- })}
+ return (
+ <Link key={type} href={`/project/${ref}/storage/${type}`}>
+ <Menu.Item rounded active={isSelected}>
+ <div className="flex items-center justify-between">
+ <p className="truncate">{config.displayName}</p>
+ {isAlphaEnabled && (
+ <Badge variant="default" size="small">
+ New
+ </Badge>
+ )}
+ </div>
+ </Menu.Item>
+ </Link>
+ )
+ })}
</div>
{IS_PLATFORM && (