Skip to content

Commit dbbae98

Browse files
authored
Only show analytics and vector buckets for hosted (supabase#40418)
* Only show analytics and vector buckets for hosted * Nit * nit
1 parent 8c326eb commit dbbae98

File tree

3 files changed

+29
-25
lines changed

3 files changed

+29
-25
lines changed

apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const AnalyticBucketDetails = () => {
7272
projectRef,
7373
bucketId: bucket?.id,
7474
})
75-
const { data } = useReplicationPipelineStatusQuery(
75+
const { data, isSuccess: isSuccessPipelineStatus } = useReplicationPipelineStatusQuery(
7676
{ projectRef, pipelineId: pipeline?.id },
7777
{
7878
refetchInterval: (data) => {
@@ -245,7 +245,7 @@ export const AnalyticBucketDetails = () => {
245245
</>
246246
) : (
247247
<>
248-
{!!pipeline && !isPipelineRunning && (
248+
{!!pipeline && !!isSuccessPipelineStatus && !isPipelineRunning && (
249249
<Admonition
250250
type="note"
251251
layout="horizontal"

apps/studio/components/interfaces/Storage/Storage.constants.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export const CONTEXT_MENU_KEYS = {
6262

6363
export const BUCKET_TYPES = {
6464
files: {
65+
platformOnly: false,
6566
displayName: 'Files',
6667
singularName: 'file',
6768
article: 'a',
@@ -70,6 +71,7 @@ export const BUCKET_TYPES = {
7071
docsUrl: `${DOCS_URL}/guides/storage/buckets/fundamentals`,
7172
},
7273
analytics: {
74+
platformOnly: true,
7375
displayName: 'Analytics',
7476
singularName: 'analytics',
7577
article: 'an',
@@ -78,6 +80,7 @@ export const BUCKET_TYPES = {
7880
docsUrl: `${DOCS_URL}/guides/storage/analytics/introduction`,
7981
},
8082
vectors: {
83+
platformOnly: true,
8184
displayName: 'Vectors',
8285
singularName: 'vector',
8386
article: 'a',
@@ -86,5 +89,5 @@ export const BUCKET_TYPES = {
8689
docsUrl: `${DOCS_URL}/guides/storage/vectors`,
8790
},
8891
}
89-
export const BUCKET_TYPE_KEYS = Object.keys(BUCKET_TYPES) as Array<keyof typeof BUCKET_TYPES>
92+
9093
export const DEFAULT_BUCKET_TYPE: keyof typeof BUCKET_TYPES = 'files'

apps/studio/components/interfaces/Storage/StorageMenuV2.tsx

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
useIsVectorBucketsEnabled,
77
} from 'data/config/project-storage-config-query'
88
import { Badge, Menu } from 'ui'
9-
import { BUCKET_TYPES, BUCKET_TYPE_KEYS } from './Storage.constants'
9+
import { BUCKET_TYPES } from './Storage.constants'
1010
import { useStorageV2Page } from './Storage.utils'
1111

1212
export const StorageMenuV2 = () => {
@@ -22,28 +22,29 @@ export const StorageMenuV2 = () => {
2222
<div className="mx-3">
2323
<Menu.Group title={<span className="uppercase font-mono">Manage</span>} />
2424

25-
{BUCKET_TYPE_KEYS.map((bucketTypeKey) => {
26-
const isSelected = page === bucketTypeKey
27-
const config = BUCKET_TYPES[bucketTypeKey]
28-
const isAlphaEnabled =
29-
(bucketTypeKey === 'analytics' && isAnalyticsBucketsEnabled) ||
30-
(bucketTypeKey === 'vectors' && isVectorBucketsEnabled)
25+
{Object.entries(BUCKET_TYPES)
26+
.filter(([_, config]) => IS_PLATFORM || (!IS_PLATFORM && !config.platformOnly))
27+
.map(([type, config]) => {
28+
const isSelected = page === type
29+
const isAlphaEnabled =
30+
(type === 'analytics' && isAnalyticsBucketsEnabled) ||
31+
(type === 'vectors' && isVectorBucketsEnabled)
3132

32-
return (
33-
<Link key={bucketTypeKey} href={`/project/${ref}/storage/${bucketTypeKey}`}>
34-
<Menu.Item rounded active={isSelected}>
35-
<div className="flex items-center justify-between">
36-
<p className="truncate">{config.displayName}</p>
37-
{isAlphaEnabled && (
38-
<Badge variant="success" size="tiny">
39-
New
40-
</Badge>
41-
)}
42-
</div>
43-
</Menu.Item>
44-
</Link>
45-
)
46-
})}
33+
return (
34+
<Link key={type} href={`/project/${ref}/storage/${type}`}>
35+
<Menu.Item rounded active={isSelected}>
36+
<div className="flex items-center justify-between">
37+
<p className="truncate">{config.displayName}</p>
38+
{isAlphaEnabled && (
39+
<Badge variant="default" size="small">
40+
New
41+
</Badge>
42+
)}
43+
</div>
44+
</Menu.Item>
45+
</Link>
46+
)
47+
})}
4748
</div>
4849

4950
{IS_PLATFORM && (

0 commit comments

Comments
 (0)