Skip to content

Commit b374628

Browse files
authored
Chore/small fix vectors (supabase#40693)
* Flip vectors enabled features to true * Fix enabled logic
1 parent e067920 commit b374628

File tree

3 files changed

+35
-28
lines changed

3 files changed

+35
-28
lines changed

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

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
useIsAnalyticsBucketsEnabled,
66
useIsVectorBucketsEnabled,
77
} from 'data/config/project-storage-config-query'
8+
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
89
import { Badge, Menu } from 'ui'
910
import { BUCKET_TYPES } from './Storage.constants'
1011
import { useStorageV2Page } from './Storage.utils'
@@ -13,38 +14,47 @@ export const StorageMenuV2 = () => {
1314
const { ref } = useParams()
1415
const page = useStorageV2Page()
1516

17+
const { storageAnalytics, storageVectors } = useIsFeatureEnabled([
18+
'storage:analytics',
19+
'storage:vectors',
20+
])
21+
1622
const isAnalyticsBucketsEnabled = useIsAnalyticsBucketsEnabled({ projectRef: ref })
1723
const isVectorBucketsEnabled = useIsVectorBucketsEnabled({ projectRef: ref })
1824

25+
const bucketTypes = Object.entries(BUCKET_TYPES).filter(([key, config]) => {
26+
if (key === 'analytics') return storageAnalytics
27+
if (key === 'vectors') return storageVectors
28+
return IS_PLATFORM || (!IS_PLATFORM && !config.platformOnly)
29+
})
30+
1931
return (
2032
<Menu type="pills" className="my-6 flex flex-grow flex-col">
2133
<div className="space-y-6">
2234
<div className="mx-3">
2335
<Menu.Group title={<span className="uppercase font-mono">Manage</span>} />
2436

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)
37+
{bucketTypes.map(([type, config]) => {
38+
const isSelected = page === type
39+
const isAlphaEnabled =
40+
(type === 'analytics' && isAnalyticsBucketsEnabled) ||
41+
(type === 'vectors' && isVectorBucketsEnabled)
3242

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-
})}
43+
return (
44+
<Link key={type} href={`/project/${ref}/storage/${type}`}>
45+
<Menu.Item rounded active={isSelected}>
46+
<div className="flex items-center justify-between">
47+
<p className="truncate">{config.displayName}</p>
48+
{isAlphaEnabled && (
49+
<Badge variant="default" size="small">
50+
New
51+
</Badge>
52+
)}
53+
</div>
54+
</Menu.Item>
55+
</Link>
56+
)
57+
})}
4858
</div>
4959

5060
{IS_PLATFORM && (

apps/studio/data/config/project-storage-config-query.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useQuery } from '@tanstack/react-query'
33
import { useFlag } from 'common'
44
import { components } from 'data/api'
55
import { get, handleError } from 'data/fetchers'
6-
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
76
import { IS_PLATFORM } from 'lib/constants'
87
import type { ResponseError, UseCustomQueryOptions } from 'types'
98
import { configKeys } from './keys'
@@ -55,15 +54,13 @@ export const useProjectStorageConfigQuery = <TData = ProjectStorageConfigData>(
5554
})
5655

5756
export const useIsAnalyticsBucketsEnabled = ({ projectRef }: { projectRef?: string }) => {
58-
const { storageAnalytics } = useIsFeatureEnabled(['storage:analytics'])
5957
const { data } = useProjectStorageConfigQuery({ projectRef })
6058
const isIcebergCatalogEnabled = !!data?.features.icebergCatalog?.enabled
61-
return storageAnalytics && isIcebergCatalogEnabled
59+
return isIcebergCatalogEnabled
6260
}
6361

6462
export const useIsVectorBucketsEnabled = ({ projectRef }: { projectRef?: string }) => {
65-
const { storageVectors } = useIsFeatureEnabled(['storage:vectors'])
6663
// [Joshen] Temp using feature flag - will need to shift to storage config like analytics bucket once ready
6764
const isVectorBucketsEnabled = useFlag('storageAnalyticsVector')
68-
return storageVectors && isVectorBucketsEnabled
65+
return isVectorBucketsEnabled
6966
}

packages/common/enabled-features/enabled-features.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"sdk:swift": true,
123123

124124
"storage:analytics": true,
125-
"storage:vectors": false,
125+
"storage:vectors": true,
126126

127127
"search:fullIndex": true,
128128

0 commit comments

Comments
 (0)