Skip to content

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

Use new Storage UI layout (#40076)

Joshen Lim1f9906aab339
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx
index 03d791ca891..ce8d859e785 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx
@@ -8,13 +8,6 @@ export const FEATURE_PREVIEWS = [
isNew: true,
isPlatformOnly: true,
},
- {
- key: LOCAL_STORAGE_KEYS.UI_PREVIEW_NEW_STORAGE_UI,
- name: 'New Storage interface',
- discussionsUrl: undefined,
- isNew: true,
- isPlatformOnly: false,
- },
{
key: LOCAL_STORAGE_KEYS.UI_PREVIEW_UNIFIED_LOGS,
name: 'New Logs interface',
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
index bb2b449c4d5..248d731e5a7 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
@@ -110,11 +110,6 @@ export const useIsAdvisorRulesEnabled = () => {
return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_ADVISOR_RULES]
}
-export const useIsNewStorageUIEnabled = () => {
- const { flags } = useFeaturePreviewContext()
- return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_NEW_STORAGE_UI]
-}
-
export const useIsSecurityNotificationsEnabled = () => {
const { flags } = useFeaturePreviewContext()
return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_SECURITY_NOTIFICATIONS]
@@ -126,7 +121,6 @@ export const useFeaturePreviewModal = () => {
const gitlessBranchingEnabled = useFlag('gitlessBranching')
const advisorRulesEnabled = useFlag('advisorRules')
const isUnifiedLogsPreviewAvailable = useFlag('unifiedLogs')
- const isNewStorageUIAvailable = useFlag('storageAnalyticsVector')
const isSecurityNotificationsAvailable = useFlag('securityNotifications')
const selectedFeatureKeyFromQuery = featurePreviewModal?.trim() ?? null
@@ -142,8 +136,6 @@ export const useFeaturePreviewModal = () => {
return advisorRulesEnabled
case 'supabase-ui-preview-unified-logs':
return isUnifiedLogsPreviewAvailable
- case 'new-storage-ui':
- return isNewStorageUIAvailable
case 'security-notifications':
return isSecurityNotificationsAvailable
default:
@@ -154,7 +146,6 @@ export const useFeaturePreviewModal = () => {
gitlessBranchingEnabled,
advisorRulesEnabled,
isUnifiedLogsPreviewAvailable,
- isNewStorageUIAvailable,
isSecurityNotificationsAvailable,
]
)
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx
index 3fa262e4b12..524e7cd28e5 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx
@@ -14,9 +14,8 @@ import { CLSPreview } from './CLSPreview'
import { FEATURE_PREVIEWS } from './FeaturePreview.constants'
import { useFeaturePreviewContext, useFeaturePreviewModal } from './FeaturePreviewContext'
import { InlineEditorPreview } from './InlineEditorPreview'
-import { NewStorageUIPreview } from './NewStorageUIPreview'
-import { UnifiedLogsPreview } from './UnifiedLogsPreview'
import { SecurityNotificationsPreview } from './SecurityNotificationsPreview'
+import { UnifiedLogsPreview } from './UnifiedLogsPreview'
const FEATURE_PREVIEW_KEY_TO_CONTENT: {
[key: string]: ReactNode
@@ -27,7 +26,6 @@ const FEATURE_PREVIEW_KEY_TO_CONTENT: {
[LOCAL_STORAGE_KEYS.UI_PREVIEW_API_SIDE_PANEL]: <APISidePanelPreview />,
[LOCAL_STORAGE_KEYS.UI_PREVIEW_CLS]: <CLSPreview />,
[LOCAL_STORAGE_KEYS.UI_PREVIEW_UNIFIED_LOGS]: <UnifiedLogsPreview />,
- [LOCAL_STORAGE_KEYS.UI_PREVIEW_NEW_STORAGE_UI]: <NewStorageUIPreview />,
[LOCAL_STORAGE_KEYS.UI_PREVIEW_SECURITY_NOTIFICATIONS]: <SecurityNotificationsPreview />,
}
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/NewStorageUIPreview.tsx b/apps/studio/components/interfaces/App/FeaturePreview/NewStorageUIPreview.tsx
deleted file mode 100644
index 6225b04d523..00000000000
--- a/apps/studio/components/interfaces/App/FeaturePreview/NewStorageUIPreview.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import Image from 'next/image'
-
-import { useParams } from 'common'
-import { InlineLink } from 'components/ui/InlineLink'
-import { BASE_PATH } from 'lib/constants'
-import { useIsNewStorageUIEnabled } from './FeaturePreviewContext'
-
-export const NewStorageUIPreview = () => {
- const { ref } = useParams()
- const isStorageV2 = useIsNewStorageUIEnabled()
-
- return (
- <div className="text-sm text-foreground-light">
- <p className=" mb-4">
- Experience our enhanced{' '}
- <InlineLink href={`/project/${ref ?? '_'}/storage/${isStorageV2 ? 'files' : 'buckets'}`}>
- Storage interface
- </InlineLink>{' '}
- with support for analytics and vector bucket types.
- </p>
- <Image
- alt="new-storage-preview"
- src={`${BASE_PATH}/img/previews/new-storage-preview.png`}
- width={1160}
- height={658}
- className="rounded border mb-4"
- />
- <div className="space-y-2 !mt-4">
- <p className="text-foreground">Enabling this preview will:</p>
- <ul className="list-disc pl-6 space-y-1">
- <li>Move Storage buckets from the sidebar into the main content area</li>
- <li>Change the role of the sidebar to a bucket type selector</li>
- <li>Nest settings and policies under their respective bucket types</li>
- </ul>
- <p>
- These changes are necessary to support incoming analytics and vector bucket types. File
- storage will remain the default, and be shown by default when entering Storage.
- </p>
- </div>
- </div>
- )
-}
diff --git a/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanelFields.tsx b/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanelFields.tsx
index 283c180190b..54f871f94b2 100644
--- a/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanelFields.tsx
+++ b/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanelFields.tsx
@@ -3,7 +3,6 @@ import { useMemo, useState } from 'react'
import type { UseFormReturn } from 'react-hook-form'
import { useParams } from 'common'
-import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { getCatalogURI } from 'components/interfaces/Storage/StorageSettings/StorageSettings.utils'
import { InlineLink } from 'components/ui/InlineLink'
import { getKeys, useAPIKeysQuery } from 'data/api-keys/api-keys-query'
@@ -124,7 +123,6 @@ export const AnalyticsBucketFields = ({
const [showSecretAccessKey, setShowSecretAccessKey] = useState(false)
const { ref: projectRef } = useParams()
- const isStorageV2 = useIsNewStorageUIEnabled()
const { data: project } = useSelectedProjectQuery()
const { data: apiKeys } = useAPIKeysQuery({ projectRef, reveal: true })
@@ -447,13 +445,7 @@ export const AnalyticsBucketFields = ({
<p className="!leading-normal">
Please select another key or create a new set, as this destination will not work
otherwise. S3 access keys can be managed in your{' '}
- <InlineLink
- href={
- isStorageV2
- ? `/project/${projectRef}/storage/files/settings`
- : `/project/${projectRef}/storage/settings`
- }
- >
+ <InlineLink href={`/project/${projectRef}/storage/files/settings`}>
storage settings
</InlineLink>
</p>
@@ -466,13 +458,7 @@ export const AnalyticsBucketFields = ({
<Admonition type="default" title="A new set of S3 access keys will be created">
<p className="!leading-normal">
S3 access keys can be managed in your{' '}
- <InlineLink
- href={
- isStorageV2
- ? `/project/${projectRef}/storage/files/settings`
- : `/project/${projectRef}/storage/settings`
- }
- >
+ <InlineLink href={`/project/${projectRef}/storage/files/settings`}>
storage settings
</InlineLink>
.
diff --git a/apps/studio/components/interfaces/Sidebar.tsx b/apps/studio/components/interfaces/Sidebar.tsx
index ab0edd298e8..b8ce158ee63 100644
--- a/apps/studio/components/interfaces/Sidebar.tsx
+++ b/apps/studio/components/interfaces/Sidebar.tsx
@@ -5,7 +5,7 @@ import Link from 'next/link'
import { useRouter } from 'next/router'
import { ComponentProps, ComponentPropsWithoutRef, FC, ReactNode, useEffect } from 'react'
-import { LOCAL_STORAGE_KEYS, useIsMFAEnabled, useParams } from 'common'
+import { LOCAL_STORAGE_KEYS, useFlag, useIsMFAEnabled, useParams } from 'common'
import {
generateOtherRoutes,
generateProductRoutes,
@@ -44,10 +44,8 @@ import {
} from 'ui'
import {
useIsAPIDocsSidePanelEnabled,
- useIsNewStorageUIEnabled,
useUnifiedLogsPreview,
} from './App/FeaturePreview/FeaturePreviewContext'
-import { useFlag } from 'common'
export const ICON_SIZE = 32
export const ICON_STROKE_WIDTH = 1.5
@@ -231,7 +229,6 @@ const ProjectLinks = () => {
const { mutate: sendEvent } = useSendEventMutation()
const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled()
- const isStorageV2 = useIsNewStorageUIEnabled()
const { isEnabled: isUnifiedLogsEnabled } = useUnifiedLogsPreview()
const activeRoute = router.pathname.split('/')[3]
@@ -257,7 +254,6 @@ const ProjectLinks = () => {
storage: storageEnabled,
realtime: realtimeEnabled,
authOverviewPage: authOverviewPageEnabled,
- isStorageV2,
})
const otherRoutes = generateOtherRoutes(ref, project, {
unifiedLogs: isUnifiedLogsEnabled,
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/index.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/index.tsx
index 5685cc1affe..de7b2a1d9c0 100644
--- a/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/index.tsx
+++ b/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/index.tsx
@@ -3,7 +3,6 @@ import { SquarePlus } from 'lucide-react'
import Link from 'next/link'
import { useMemo, useState } from 'react'
-import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { INTEGRATIONS } from 'components/interfaces/Integrations/Landing/Integrations.constants'
import { WrapperMeta } from 'components/interfaces/Integrations/Wrappers/Wrappers.types'
import {
@@ -31,17 +30,7 @@ import { useIcebergWrapperCreateMutation } from 'data/storage/iceberg-wrapper-cr
import { useVaultSecretDecryptedValueQuery } from 'data/vault/vault-secret-decrypted-value-query'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { DOCS_URL } from 'lib/constants'
-import {
- Button,
- Card,
- CardContent,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
-} from 'ui'
+import { Button, Card, CardContent } from 'ui'
import { Admonition } from 'ui-patterns/admonition'
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
import { DeleteBucketModal } from '../DeleteBucketModal'
@@ -49,7 +38,6 @@ import { ConnectTablesDialog } from './ConnectTablesDialog'
import { DESCRIPTIONS, LABELS, OPTION_ORDER } from './constants'
import { CopyEnvButton } from './CopyEnvButton'
import { DecryptedReadOnlyInput } from './DecryptedReadOnlyInput'
-import { NamespaceRow } from './NamespaceRow'
import { NamespaceWithTables } from './NamespaceWithTables'
import { SimpleConfigurationDetails } from './SimpleConfigurationDetails'
import { useAnalyticsBucketWrapperInstance } from './useAnalyticsBucketWrapperInstance'
@@ -58,7 +46,6 @@ import { useIcebergWrapperExtension } from './useIcebergWrapper'
export const AnalyticBucketDetails = ({ bucket }: { bucket: AnalyticsBucket }) => {
const config = BUCKET_TYPES.analytics
const [modal, setModal] = useState<'delete' | null>(null)
- const isStorageV2 = useIsNewStorageUIEnabled()
const { data: project } = useSelectedProjectQuery()
const { state: extensionState } = useIcebergWrapperExtension()
@@ -128,16 +115,12 @@ export const AnalyticBucketDetails = ({ bucket }: { bucket: AnalyticsBucket }) =
<>
<PageLayout
title={bucket.id}
- breadcrumbs={
- isStorageV2
- ? [
- {
- label: 'Analytics',
- href: `/project/${project?.ref}/storage/analytics`,
- },
- ]
- : []
- }
+ breadcrumbs={[
+ {
+ label: 'Analytics',
+ href: `/project/${project?.ref}/storage/analytics`,
+ },
+ ]}
secondaryActions={config?.docsUrl ? [<DocsButton key="docs" href={config.docsUrl} />] : []}
>
<ScaffoldContainer bottomPadding>
@@ -165,117 +148,49 @@ export const AnalyticBucketDetails = ({ bucket }: { bucket: AnalyticsBucket }) =
{state === 'added' && wrapperInstance && (
<>
- {isStorageV2 ? (
- <ScaffoldSection isFullWidth>
- <ScaffoldHeader className="pt-0 flex flex-row justify-between items-end gap-x-8">
- <div>
- <ScaffoldSectionTitle>Tables</ScaffoldSectionTitle>
- <ScaffoldSectionDescription>
- Analytics tables stored in this bucket
- </ScaffoldSectionDescription>
- </div>
- {namespaces.length > 0 && <ConnectTablesDialog bucket={bucket} />}
- </ScaffoldHeader>
-
- {isLoadingNamespaces || isLoading ? (
- <GenericSkeletonLoader />
- ) : namespaces.length === 0 ? (
- <aside className="border border-dashed w-full bg-surface-100 rounded-lg px-4 py-10 flex flex-col gap-y-3 items-center text-center gap-1 text-balance">
- <SquarePlus size={24} strokeWidth={1.5} className="text-foreground-muted" />
- <div className="flex flex-col items-center text-center">
- <h3>Connect database tables</h3>
- <p className="text-foreground-light text-sm">
- Stream data from tables for archival, backups, or analytical queries.
- </p>
- </div>
- <ConnectTablesDialog bucket={bucket} />
- </aside>
- ) : (
- <div className="flex flex-col gap-y-10">
- {namespaces.map(({ namespace, schema, tables }) => (
- <NamespaceWithTables
- key={namespace}
- bucketName={bucket.id}
- namespace={namespace}
- sourceType="direct"
- schema={schema}
- tables={tables as any}
- token={token!}
- wrapperInstance={wrapperInstance}
- wrapperValues={wrapperValues}
- wrapperMeta={wrapperMeta}
- />
- ))}
- </div>
- )}
- </ScaffoldSection>
- ) : (
- <ScaffoldSection isFullWidth>
- <ScaffoldHeader>
- <ScaffoldSectionTitle>Namespaces</ScaffoldSectionTitle>
+ <ScaffoldSection isFullWidth>
+ <ScaffoldHeader className="pt-0 flex flex-row justify-between items-end gap-x-8">
+ <div>
+ <ScaffoldSectionTitle>Tables</ScaffoldSectionTitle>
<ScaffoldSectionDescription>
- Connected namespaces and tables.
+ Analytics tables stored in this bucket
</ScaffoldSectionDescription>
- </ScaffoldHeader>
+ </div>
+ {namespaces.length > 0 && <ConnectTablesDialog bucket={bucket} />}
+ </ScaffoldHeader>
- {isLoadingNamespaces || isLoading ? (
- <GenericSkeletonLoader />
- ) : namespaces.length === 0 ? (
- <Card>
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead className="text-foreground-muted">Namespace</TableHead>
- <TableHead className="text-foreground-muted">Schema</TableHead>
- <TableHead className="text-foreground-muted">Tables</TableHead>
- <TableHead />
- </TableRow>
- </TableHeader>
- <TableBody>
- <TableRow>
- <TableCell colSpan={4}>
- <p className="text-sm text-foreground">
- No namespaces in this bucket
- </p>
- <p className="text-sm text-foreground-lighter">
- Create a namespace and add some data
- </p>
- </TableCell>
- </TableRow>
- </TableBody>
- </Table>
- </Card>
- ) : (
- <Card>
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Namespace</TableHead>
- <TableHead>Schema</TableHead>
- <TableHead>Tables</TableHead>
- <TableHead />
- </TableRow>
- </TableHeader>
- <TableBody>
- {namespaces.map(({ namespace, schema, tables }) => (
- <NamespaceRow
- key={namespace}
- bucketName={bucket.id}
- namespace={namespace}
- schema={schema}
- tables={tables as any}
- token={token!}
- wrapperInstance={wrapperInstance}
- wrapperValues={wrapperValues}
- wrapperMeta={wrapperMeta}
- />
- ))}
- </TableBody>
- </Table>
- </Card>
- )}
- </ScaffoldSection>
- )}
+ {isLoadingNamespaces || isLoading ? (
+ <GenericSkeletonLoader />
+ ) : namespaces.length === 0 ? (
+ <aside className="border border-dashed w-full bg-surface-100 rounded-lg px-4 py-10 flex flex-col gap-y-3 items-center text-center gap-1 text-balance">
+ <SquarePlus size={24} strokeWidth={1.5} className="text-foreground-muted" />
+ <div className="flex flex-col items-center text-center">
+ <h3>Connect database tables</h3>
+ <p className="text-foreground-light text-sm">
+ Stream data from tables for archival, backups, or analytical queries.
+ </p>
+ </div>
+ <ConnectTablesDialog bucket={bucket} />
+ </aside>
+ ) : (
+ <div className="flex flex-col gap-y-10">
+ {namespaces.map(({ namespace, schema, tables }) => (
+ <NamespaceWithTables
+ key={namespace}
+ bucketName={bucket.id}
+ namespace={namespace}
+ sourceType="direct"
+ schema={schema}
+ tables={tables as any}
+ token={token!}
+ wrapperInstance={wrapperInstance}
+ wrapperValues={wrapperValues}
+ wrapperMeta={wrapperMeta}
+ />
+ ))}
+ </div>
+ )}
+ </ScaffoldSection>
<ScaffoldSection isFullWidth>
<ScaffoldHeader className="flex flex-row justify-between items-end gap-x-8">
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx
index e75b00d6117..8aa21db79fb 100644
--- a/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx
+++ b/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx
@@ -1,6 +1,5 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
-import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { WrapperMeta } from 'components/interfaces/Integrations/Wrappers/Wrappers.types'
import { useFDWDeleteMutation } from 'data/fdw/fdw-delete-mutation'
import { FDW } from 'data/fdw/fdws-query'
@@ -26,10 +25,6 @@ export const useAnalyticsBucketAssociatedEntities = (
{ projectRef, bucketId }: { projectRef?: string; bucketId: string },
options: { enabled: boolean } = { enabled: true }
) => {
- // [Joshen] Opting to skip cleaning up ETL related entities within old UI
- // Also to prevent an unnecessary call to /sources for existing UI
- const isStorageV2 = useIsNewStorageUIEnabled()
-
const { can: canReadS3Credentials } = useAsyncCheckPermissions(
PermissionAction.STORAGE_ADMIN_READ,
'*'
@@ -50,7 +45,7 @@ export const useAnalyticsBucketAssociatedEntities = (
const { data: sourcesData } = useReplicationSourcesQuery(
{ projectRef },
- { enabled: isStorageV2 && options.enabled }
+ { enabled: options.enabled }
)
const sourceId = sourcesData?.sources.find((s) => s.name === projectRef)?.id
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBuckets.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets.tsx
index 84abf828ce6..b95c0daba94 100644
--- a/apps/studio/components/interfaces/Storage/AnalyticsBuckets.tsx
+++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets.tsx
@@ -1,6 +1,5 @@
-import { MoreVertical, Search, Trash2 } from 'lucide-react'
+import { ExternalLink, MoreVertical, Search, Trash2 } from 'lucide-react'
import Link from 'next/link'
-import { useRouter } from 'next/router'
import { useState } from 'react'
import { useParams } from 'common'
@@ -21,14 +20,13 @@ import {
TableHeader,
TableRow,
} from 'ui'
-import { TimestampInfo } from 'ui-patterns'
+import { Admonition, TimestampInfo } from 'ui-patterns'
import { Input } from 'ui-patterns/DataInputs/Input'
import { CreateSpecializedBucketModal } from './CreateSpecializedBucketModal'
import { DeleteBucketModal } from './DeleteBucketModal'
import { EmptyBucketState } from './EmptyBucketState'
export const AnalyticsBuckets = () => {
- const router = useRouter()
const { ref } = useParams()
const [filterString, setFilterString] = useState('')
@@ -44,14 +42,36 @@ export const AnalyticsBuckets = () => {
)
return (
- <>
+ <ScaffoldSection isFullWidth>
+ <Admonition
+ type="warning"
+ layout="horizontal"
+ className="mb-12 [&>div]:!translate-y-0 [&>svg]:!translate-y-1"
+ title="Analytics buckets are in alpha"
+ actions={
+ <Button asChild type="default" icon={<ExternalLink />}>
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ href="https://github.com/orgs/supabase/discussions/40116"
+ >
+ Leave feedback
+ </a>
+ </Button>
+ }
+ >
+ <p className="!leading-normal !mb-0">
+ Expect rapid changes, limited features, and possible breaking updates as we expand access.
+ </p>
+ <p className="!leading-normal !mb-0">Please share feedback as we refine the experience!</p>
+ </Admonition>
+
{!isLoadingBuckets &&
buckets.filter((bucket) => !('type' in bucket) || bucket.type === 'ANALYTICS').length ===
0 ? (
<EmptyBucketState bucketType="analytics" />
) : (
- // Override the default first:pt-12 to match other storage types
- <ScaffoldSection isFullWidth className="gap-y-4 first:pt-8">
+ <div className="flex flex-col gap-y-4">
<ScaffoldHeader className="py-0">
<ScaffoldSectionTitle>Buckets</ScaffoldSectionTitle>
</ScaffoldHeader>
@@ -143,7 +163,7 @@ export const AnalyticsBuckets = () => {
</Table>
</Card>
)}
- </ScaffoldSection>
+ </div>
)}
{selectedBucket && (
@@ -153,6 +173,6 @@ export const AnalyticsBuckets = () => {
onClose={() => setModal(null)}
/>
)}
- </>
+ </ScaffoldSection>
)
}
diff --git a/apps/studio/components/interfaces/Storage/BucketsComingSoon.tsx b/apps/studio/components/interfaces/Storage/BucketsComingSoon.tsx
new file mode 100644
index 00000000000..30416d60e81
--- /dev/null
+++ b/apps/studio/components/interfaces/Storage/BucketsComingSoon.tsx
@@ -0,0 +1,36 @@
+import { ScaffoldSection } from 'components/layouts/Scaffold'
+import { Bucket } from 'icons'
+import { ExternalLink } from 'lucide-react'
+import Link from 'next/link'
+import { Button } from 'ui'
+
+export const BucketsComingSoon = ({ type }: { type: 'analytics' | 'vector' }) => {
+ return (
+ <ScaffoldSection isFullWidth>
+ <aside className="border border-dashed w-full bg-surface-100 rounded-lg px-4 py-10 flex flex-col gap-y-3 items-center text-center gap-1 text-balance">
+ <Bucket size={24} strokeWidth={1.5} className="text-foreground-muted" />
+ <div className="flex flex-col items-center text-center">
+ <h3>Coming soon</h3>
+ <p className="text-foreground-light text-sm">
+ {type === 'analytics'
+ ? 'Store large datasets for analytics and reporting'
+ : type === 'vector'
+ ? 'Store, index, and query your vector embeddings at scale.'
+ : undefined}
+ </p>
+ </div>
+ {type === 'analytics' && (
+ <Button asChild type="default" icon={<ExternalLink />}>
+ <Link
+ target="_blank"
+ rel="noopener noreferrer"
+ href="https://forms.supabase.com/analytics-buckets"
+ >
+ Request access
+ </Link>
+ </Button>
+ )}
+ </aside>
+ </ScaffoldSection>
+ )
+}
diff --git a/apps/studio/components/interfaces/Storage/CreateBucketModal.tsx b/apps/studio/components/interfaces/Storage/CreateBucketModal.tsx
index c9579551809..f816ff02392 100644
--- a/apps/studio/components/interfaces/Storage/CreateBucketModal.tsx
+++ b/apps/studio/components/interfaces/Storage/CreateBucketModal.tsx
@@ -1,30 +1,22 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { PermissionAction } from '@supabase/shared-types/out/constants'
-import { snakeCase } from 'lodash'
import { Plus } from 'lucide-react'
-import { useRouter } from 'next/router'
import { useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import z from 'zod'
import { useParams } from 'common'
-import { useIcebergWrapperExtension } from 'components/interfaces/Storage/AnalyticsBucketDetails/useIcebergWrapper'
import { StorageSizeUnits } from 'components/interfaces/Storage/StorageSettings/StorageSettings.constants'
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import { InlineLink } from 'components/ui/InlineLink'
import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query'
-import { useAnalyticsBucketCreateMutation } from 'data/storage/analytics-bucket-create-mutation'
import { useBucketCreateMutation } from 'data/storage/bucket-create-mutation'
-import { useIcebergWrapperCreateMutation } from 'data/storage/iceberg-wrapper-create-mutation'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
-import { BASE_PATH, IS_PLATFORM } from 'lib/constants'
+import { IS_PLATFORM } from 'lib/constants'
import {
- Alert_Shadcn_,
- AlertDescription_Shadcn_,
- AlertTitle_Shadcn_,
Button,
Dialog,
DialogContent,
@@ -39,22 +31,16 @@ import {
FormField_Shadcn_,
FormMessage_Shadcn_,
Input_Shadcn_,
- Label_Shadcn_,
- RadioGroupStacked,
- RadioGroupStackedItem,
Select_Shadcn_,
SelectContent_Shadcn_,
SelectItem_Shadcn_,
SelectTrigger_Shadcn_,
SelectValue_Shadcn_,
Switch,
- WarningIcon,
} from 'ui'
import { Admonition } from 'ui-patterns/admonition'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
-import { useIsNewStorageUIEnabled } from '../App/FeaturePreview/FeaturePreviewContext'
import { inverseValidBucketNameRegex, validBucketNameRegex } from './CreateBucketModal.utils'
-import { BUCKET_TYPES } from './Storage.constants'
import { convertFromBytes, convertToBytes } from './StorageSettings/StorageSettings.utils'
const FormSchema = z
@@ -72,7 +58,6 @@ const FormSchema = z
(value) => value !== 'public',
'"public" is a reserved name. Please choose another name'
),
- type: z.enum(['STANDARD', 'ANALYTICS']).default('STANDARD'),
public: z.boolean().default(false),
has_file_size_limit: z.boolean().default(false),
formatted_size_limit: z.coerce
@@ -111,66 +96,42 @@ export const CreateBucketModal = ({
buttonClassName,
label = 'New bucket',
}: CreateBucketModalProps) => {
- const router = useRouter()
const { ref } = useParams()
const { data: org } = useSelectedOrganizationQuery()
- const isStorageV2 = useIsNewStorageUIEnabled()
const [visible, setVisible] = useState(false)
const [selectedUnit, setSelectedUnit] = useState<string>(StorageSizeUnits.MB)
+ const [hasAllowedMimeTypes, setHasAllowedMimeTypes] = useState(false)
const { can: canCreateBuckets } = useAsyncCheckPermissions(PermissionAction.STORAGE_WRITE, '*')
+ const { data } = useProjectStorageConfigQuery({ projectRef: ref }, { enabled: IS_PLATFORM })
+ const { value, unit } = convertFromBytes(data?.fileSizeLimit ?? 0)
+ const formattedGlobalUploadLimit = `${value} ${unit}`
+
const { mutate: sendEvent } = useSendEventMutation()
const { mutateAsync: createBucket, isLoading: isCreatingBucket } = useBucketCreateMutation({
// [Joshen] Silencing the error here as it's being handled in onSubmit
onError: () => {},
})
- const { mutateAsync: createAnalyticsBucket, isLoading: isCreatingAnalyticsBucket } =
- useAnalyticsBucketCreateMutation({
- // [Joshen] Silencing the error here as it's being handled in onSubmit
- onError: () => {},
- })
- const { mutateAsync: createIcebergWrapper, isLoading: isCreatingIcebergWrapper } =
- useIcebergWrapperCreateMutation()
-
- const { data } = useProjectStorageConfigQuery({ projectRef: ref }, { enabled: IS_PLATFORM })
- const { value, unit } = convertFromBytes(data?.fileSizeLimit ?? 0)
- const formattedGlobalUploadLimit = `${value} ${unit}`
-
- const config = BUCKET_TYPES['files']
- const isCreating = isCreatingBucket || isCreatingAnalyticsBucket
const form = useForm<CreateBucketForm>({
resolver: zodResolver(FormSchema),
defaultValues: {
name: '',
public: false,
- type: 'STANDARD',
has_file_size_limit: false,
formatted_size_limit: undefined,
allowed_mime_types: '',
},
})
const { formatted_size_limit: formattedSizeLimitError } = form.formState.errors
-
- const bucketName = snakeCase(form.watch('name'))
const isPublicBucket = form.watch('public')
- const isStandardBucket = form.watch('type') === 'STANDARD'
const hasFileSizeLimit = form.watch('has_file_size_limit')
- const [hasAllowedMimeTypes, setHasAllowedMimeTypes] = useState(false)
- const { state: icebergWrapperExtensionState } = useIcebergWrapperExtension()
- const icebergCatalogEnabled = data?.features?.icebergCatalog?.enabled
const onSubmit: SubmitHandler<CreateBucketForm> = async (values) => {
if (!ref) return console.error('Project ref is required')
- if (values.type === 'ANALYTICS' && !icebergCatalogEnabled) {
- return toast.error(
- 'The Analytics catalog feature is not enabled for your project. Please contact support to enable it.'
- )
- }
-
// [Joshen] Should shift this into superRefine in the form schema
try {
const fileSizeLimit =
@@ -190,37 +151,24 @@ export const CreateBucketModal = ({
})
}
- if (values.type === 'STANDARD') {
- await createBucket({
- projectRef: ref,
- id: values.name,
- type: 'STANDARD',
- isPublic: values.public,
- file_size_limit: fileSizeLimit,
- allowed_mime_types: allowedMimeTypes,
- })
- } else if (values.type === 'ANALYTICS') {
- await createAnalyticsBucket({
- projectRef: ref,
- bucketName: values.name,
- })
- if (icebergWrapperExtensionState === 'installed') {
- await createIcebergWrapper({ bucketName: values.name })
- }
- }
-
+ await createBucket({
+ projectRef: ref,
+ id: values.name,
+ type: 'STANDARD',
+ isPublic: values.public,
+ file_size_limit: fileSizeLimit,
+ allowed_mime_types: allowedMimeTypes,
+ })
sendEvent({
action: 'storage_bucket_created',
- properties: { bucketType: values.type },
+ properties: { bucketType: 'STANDARD' },
groups: { project: ref ?? 'Unknown', organization: org?.slug ?? 'Unknown' },
})
toast.success(`Successfully created bucket ${values.name}`)
form.reset()
-
setSelectedUnit(StorageSizeUnits.MB)
setVisible(false)
- if (!isStorageV2) router.push(`/project/${ref}/storage/buckets/${values.name}`)
} catch (error: any) {
// Handle specific error cases for inline display
const errorMessage = error.message?.toLowerCase() || ''
@@ -281,7 +229,7 @@ export const CreateBucketModal = ({
<DialogContent aria-describedby={undefined}>
<DialogHeader>
- <DialogTitle>Create a {isStorageV2 ? config.singularName : 'storage'} bucket</DialogTitle>
+ <DialogTitle>Create a storage bucket</DialogTitle>
</DialogHeader>
<DialogSectionSeparator />
@@ -313,344 +261,197 @@ export const CreateBucketModal = ({
</FormItemLayout>
)}
/>
+ </DialogSection>
- {!isStorageV2 && (
- <FormField_Shadcn_
- key="type"
- name="type"
- control={form.control}
- render={({ field }) => (
- <FormItemLayout label="Bucket type">
- <FormControl_Shadcn_>
- <RadioGroupStacked
- id="type"
- value={field.value}
- onValueChange={(v) => field.onChange(v)}
- >
- <RadioGroupStackedItem
- id="STANDARD"
- value="STANDARD"
- label="Standard bucket"
- description="Compatible with S3 buckets."
- showIndicator={false}
- />
- {IS_PLATFORM && (
- <RadioGroupStackedItem
- id="ANALYTICS"
- value="ANALYTICS"
- label="Analytics bucket"
- showIndicator={false}
- disabled={!icebergCatalogEnabled}
- >
- <>
- <p className="text-foreground-light text-left">
- Stores Iceberg files and is optimized for analytical workloads.
- </p>
-
- {icebergCatalogEnabled ? null : (
- <div className="w-full flex gap-x-2 py-2 items-center">
- <WarningIcon />
- <span className="text-xs text-left">
- This feature is currently in alpha and not yet enabled for
- your project. Sign up{' '}
- <InlineLink href="https://forms.supabase.com/analytics-buckets">
- here
- </InlineLink>
- .
- </span>
- </div>
- )}
- </>
- </RadioGroupStackedItem>
- )}
- </RadioGroupStacked>
- </FormControl_Shadcn_>
- </FormItemLayout>
- )}
+ <DialogSectionSeparator />
+
+ <DialogSection className="space-y-3">
+ <FormField_Shadcn_
+ key="public"
+ name="public"
+ control={form.control}
+ render={({ field }) => (
+ <FormItemLayout
+ hideMessage
+ name="public"
+ label="Public bucket"
+ description="Allow anyone to read objects without authorization"
+ layout="flex"
+ >
+ <FormControl_Shadcn_>
+ <Switch
+ id="public"
+ size="large"
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl_Shadcn_>
+ </FormItemLayout>
+ )}
+ />
+ {isPublicBucket && (
+ <Admonition
+ type="warning"
+ title="Public buckets are not protected"
+ description="Users can read objects in public buckets without any authorization. Row level security (RLS) policies are still required for other operations such as object uploads and deletes."
/>
)}
</DialogSection>
<DialogSectionSeparator />
- {isStandardBucket ? (
- <>
- <DialogSection className="space-y-3">
+ <DialogSection className="space-y-2">
+ <FormField_Shadcn_
+ key="has_file_size_limit"
+ name="has_file_size_limit"
+ control={form.control}
+ render={({ field }) => (
+ <FormItemLayout
+ name="has_file_size_limit"
+ label="Restrict file size"
+ description="Prevent uploading of files larger than a specified limit"
+ layout="flex"
+ >
+ <FormControl_Shadcn_>
+ <Switch
+ id="has_file_size_limit"
+ size="large"
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl_Shadcn_>
+ </FormItemLayout>
+ )}
+ />
+
+ {hasFileSizeLimit && (
+ <div>
<FormField_Shadcn_
- key="public"
- name="public"
+ key="formatted_size_limit"
+ name="formatted_size_limit"
control={form.control}
render={({ field }) => (
<FormItemLayout
hideMessage
- name="public"
- label="Public bucket"
- description="Allow anyone to read objects without authorization"
- layout="flex"
+ name="formatted_size_limit"
+ label="File size limit"
>
- <FormControl_Shadcn_>
- <Switch
- id="public"
- size="large"
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl_Shadcn_>
+ <div className="grid grid-cols-12 gap-x-2">
+ <div className="col-span-8">
+ <FormControl_Shadcn_>
+ <Input_Shadcn_
+ id="formatted_size_limit"
+ aria-label="File size limit"
+ type="number"
+ min={0}
+ placeholder="0"
+ {...field}
+ />
+ </FormControl_Shadcn_>
+ </div>
+ <div className="col-span-4">
+ <Select_Shadcn_ value={selectedUnit} onValueChange={setSelectedUnit}>
+ <SelectTrigger_Shadcn_ aria-label="File size limit unit" size="small">
+ <SelectValue_Shadcn_>{selectedUnit}</SelectValue_Shadcn_>
+ </SelectTrigger_Shadcn_>
+ <SelectContent_Shadcn_>
+ {Object.values(StorageSizeUnits).map((unit: string) => (
+ <SelectItem_Shadcn_ key={unit} value={unit} className="text-xs">
+ {unit}
+ </SelectItem_Shadcn_>
+ ))}
+ </SelectContent_Shadcn_>
+ </Select_Shadcn_>
+ </div>
+ </div>
</FormItemLayout>
)}
/>
- {isPublicBucket && (
- <Admonition
- type="warning"
- title="Public buckets are not protected"
- description="Users can read objects in public buckets without any authorization. Row level security (RLS) policies are still required for other operations such as object uploads and deletes."
- />
+ {formattedSizeLimitError?.message === 'exceed_global_limit' && (
+ <FormMessage_Shadcn_ className="mt-2">
+ Exceeds global limit of {formattedGlobalUploadLimit}. Increase limit in{' '}
+ <InlineLink
+ className="text-destructive decoration-destructive-500 hover:decoration-destructive"
+ href={`/project/${ref}/storage/settings`}
+ onClick={() => setVisible(false)}
+ >
+ Storage Settings
+ </InlineLink>{' '}
+ first.
+ </FormMessage_Shadcn_>
)}
- </DialogSection>
-
- <DialogSectionSeparator />
- <DialogSection className="space-y-2">
- <FormField_Shadcn_
- key="has_file_size_limit"
- name="has_file_size_limit"
- control={form.control}
- render={({ field }) => (
- <FormItemLayout
- name="has_file_size_limit"
- label="Restrict file size"
- description="Prevent uploading of files larger than a specified limit"
- layout="flex"
+ {IS_PLATFORM && (
+ <p className="text-sm text-foreground-lighter mt-2">
+ This project has a{' '}
+ <InlineLink
+ className="text-foreground-light hover:text-foreground"
+ href={`/project/${ref}/storage/settings`}
+ onClick={() => setVisible(false)}
>
- <FormControl_Shadcn_>
- <Switch
- id="has_file_size_limit"
- size="large"
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl_Shadcn_>
- </FormItemLayout>
- )}
- />
-
- {hasFileSizeLimit && (
- <div>
- <FormField_Shadcn_
- key="formatted_size_limit"
- name="formatted_size_limit"
- control={form.control}
- render={({ field }) => (
- <FormItemLayout
- hideMessage
- name="formatted_size_limit"
- label="File size limit"
- >
- <div className="grid grid-cols-12 gap-x-2">
- <div className="col-span-8">
- <FormControl_Shadcn_>
- <Input_Shadcn_
- id="formatted_size_limit"
- aria-label="File size limit"
- type="number"
- min={0}
- placeholder="0"
- {...field}
- />
- </FormControl_Shadcn_>
- </div>
- <div className="col-span-4">
- <Select_Shadcn_
- value={selectedUnit}
- onValueChange={setSelectedUnit}
- >
- <SelectTrigger_Shadcn_
- aria-label="File size limit unit"
- size="small"
- >
- <SelectValue_Shadcn_>{selectedUnit}</SelectValue_Shadcn_>
- </SelectTrigger_Shadcn_>
- <SelectContent_Shadcn_>
- {Object.values(StorageSizeUnits).map((unit: string) => (
- <SelectItem_Shadcn_
- key={unit}
- value={unit}
- className="text-xs"
- >
- {unit}
- </SelectItem_Shadcn_>
- ))}
- </SelectContent_Shadcn_>
- </Select_Shadcn_>
- </div>
- </div>
- </FormItemLayout>
- )}
- />
- {formattedSizeLimitError?.message === 'exceed_global_limit' && (
- <FormMessage_Shadcn_ className="mt-2">
- Exceeds global limit of {formattedGlobalUploadLimit}. Increase limit in{' '}
- <InlineLink
- className="text-destructive decoration-destructive-500 hover:decoration-destructive"
- href={`/project/${ref}/storage/settings`}
- onClick={() => setVisible(false)}
- >
- Storage Settings
- </InlineLink>{' '}
- first.
- </FormMessage_Shadcn_>
- )}
-
- {IS_PLATFORM && (
- <p className="text-sm text-foreground-lighter mt-2">
- This project has a{' '}
- <InlineLink
- className="text-foreground-light hover:text-foreground"
- href={`/project/${ref}/storage/settings`}
- onClick={() => setVisible(false)}
- >
- global file size limit
- </InlineLink>{' '}
- of {formattedGlobalUploadLimit}.
- </p>
- )}
- </div>
+ global file size limit
+ </InlineLink>{' '}
+ of {formattedGlobalUploadLimit}.
+ </p>
)}
- </DialogSection>
+ </div>
+ )}
+ </DialogSection>
- <DialogSectionSeparator />
+ <DialogSectionSeparator />
- <DialogSection className="space-y-2">
- <FormItemLayout
- name="has_allowed_mime_types"
- label="Restrict MIME types"
- description="Allow only certain types of files to be uploaded"
- layout="flex"
- >
- <FormControl_Shadcn_>
- <Switch
- id="has_allowed_mime_types"
- size="large"
- checked={hasAllowedMimeTypes}
- onCheckedChange={setHasAllowedMimeTypes}
- />
- </FormControl_Shadcn_>
- </FormItemLayout>
- {hasAllowedMimeTypes && (
- <FormField_Shadcn_
- key="allowed_mime_types"
+ <DialogSection className="space-y-2">
+ <FormItemLayout
+ name="has_allowed_mime_types"
+ label="Restrict MIME types"
+ description="Allow only certain types of files to be uploaded"
+ layout="flex"
+ >
+ <FormControl_Shadcn_>
+ <Switch
+ id="has_allowed_mime_types"
+ size="large"
+ checked={hasAllowedMimeTypes}
+ onCheckedChange={setHasAllowedMimeTypes}
+ />
+ </FormControl_Shadcn_>
+ </FormItemLayout>
+ {hasAllowedMimeTypes && (
+ <FormField_Shadcn_
+ key="allowed_mime_types"
+ name="allowed_mime_types"
+ control={form.control}
+ render={({ field }) => (
+ <FormItemLayout
name="allowed_mime_types"
- control={form.control}
- render={({ field }) => (
- <FormItemLayout
- name="allowed_mime_types"
- label="Allowed MIME types"
- labelOptional="Comma separated values"
- description="Wildcards are allowed, e.g. image/*."
- >
- <FormControl_Shadcn_>
- <Input_Shadcn_
- id="allowed_mime_types"
- {...field}
- placeholder="e.g image/jpeg, image/png, audio/mpeg, video/mp4, etc"
- />
- </FormControl_Shadcn_>
- </FormItemLayout>
- )}
- />
+ label="Allowed MIME types"
+ labelOptional="Comma separated values"
+ description="Wildcards are allowed, e.g. image/*."
+ >
+ <FormControl_Shadcn_>
+ <Input_Shadcn_
+ id="allowed_mime_types"
+ {...field}
+ placeholder="e.g image/jpeg, image/png, audio/mpeg, video/mp4, etc"
+ />
+ </FormControl_Shadcn_>
+ </FormItemLayout>
)}
- </DialogSection>
- </>
- ) : (
- <>
- {icebergWrapperExtensionState === 'installed' ? (
- <DialogSection>
- <Label_Shadcn_ className="text-foreground-lighter leading-1 flex flex-col gap-y-2">
- <p>
- <span>Supabase will setup a </span>
- <a
- href={`${BASE_PATH}/project/${ref}/integrations/iceberg_wrapper/overview`}
- target="_blank"
- className="underline text-foreground-light"
- >
- foreign data wrapper
- {bucketName && <span className="text-brand"> {`${bucketName}_fdw`}</span>}
- </a>
- <span>
- {' '}
- for easier access to the data. This action will also create{' '}
- <a
- href={`${BASE_PATH}/project/${ref}/storage/access-keys`}
- target="_blank"
- className="underline text-foreground-light"
- >
- S3 Access Keys
- {bucketName && (
- <>
- {' '}
- named <span className="text-brand"> {`${bucketName}_keys`}</span>
- </>
- )}
- </a>
- <span> and </span>
- <a
- href={`${BASE_PATH}/project/${ref}/integrations/vault/secrets`}
- target="_blank"
- className="underline text-foreground-light"
- >
- four Vault Secrets
- {bucketName && (
- <>
- {' '}
- prefixed with{' '}
- <span className="text-brand"> {`${bucketName}_vault_`}</span>
- </>
- )}
- </a>
- .
- </span>
- </p>
- <p>
- As a final step, you'll need to create an{' '}
- <span className="text-foreground-light">Iceberg namespace</span> before you
- connect the Iceberg data to your database.
- </p>
- </Label_Shadcn_>
- </DialogSection>
- ) : (
- <Alert_Shadcn_ variant="warning" className="rounded-none border-0">
- <WarningIcon />
- <AlertTitle_Shadcn_>
- You need to install the Iceberg wrapper extension to connect your Analytic
- bucket to your database.
- </AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_ className="flex flex-col gap-y-2">
- <p>
- You need to install the <span className="text-brand">wrappers</span>{' '}
- extension (with the minimum version of <span>0.5.3</span>) if you want to
- connect your Analytics bucket to your database.
- </p>
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
- )}
- </>
- )}
+ />
+ )}
+ </DialogSection>
</form>
</Form_Shadcn_>
<DialogFooter>
- <Button
- type="default"
- disabled={isCreating || isCreatingIcebergWrapper}
- onClick={() => setVisible(false)}
- >
+ <Button type="default" disabled={isCreatingBucket} onClick={() => setVisible(false)}>
Cancel
</Button>
<Button
form={formId}
htmlType="submit"
- loading={isCreating || isCreatingIcebergWrapper}
- disabled={isCreating || isCreatingIcebergWrapper}
+ loading={isCreatingBucket}
+ disabled={isCreatingBucket}
>
Create
</Button>
diff --git a/apps/studio/components/interfaces/Storage/CreateSpecializedBucketModal.tsx b/apps/studio/components/interfaces/Storage/CreateSpecializedBucketModal.tsx
index 3208dfedd62..184019ce0a3 100644
--- a/apps/studio/components/interfaces/Storage/CreateSpecializedBucketModal.tsx
+++ b/apps/studio/components/interfaces/Storage/CreateSpecializedBucketModal.tsx
@@ -108,6 +108,7 @@ export const CreateSpecializedBucketModal = ({
const { data } = useProjectStorageConfigQuery({ projectRef: ref }, { enabled: IS_PLATFORM })
const icebergCatalogEnabled = data?.features?.icebergCatalog?.enabled
+ const wrappersExtenstionNeedsUpgrading = wrappersExtensionState === 'needs-upgrade'
const { mutate: sendEvent } = useSendEventMutation()
@@ -136,21 +137,6 @@ export const CreateSpecializedBucketModal = ({
if (!project) return console.error('Project details is required')
if (!wrappersExtension) return console.error('Unable to find wrappers extension')
- if (wrappersExtensionState === 'needs-upgrade') {
- // [Joshen] Double check if this is the right CTA
- return toast.error(
- <p className="prose max-w-full text-sm">
- Wrappers extensions needs to be updated to create an Iceberg Wrapper. Update the extension
- by disabling and enabling the <code className="text-xs">wrappers</code> extension first in
- the{' '}
- <InlineLink href={`/project/${ref}/database/extensions?filter=wrappers`}>
- database extensions page
- </InlineLink>{' '}
- before creating an Analytics bucket.
- </p>
- )
- }
-
try {
if (bucketType === 'analytics') {
await createAnalyticsBucket({
@@ -227,7 +213,7 @@ export const CreateSpecializedBucketModal = ({
</ButtonTooltip>
</DialogTrigger>
- <DialogContent aria-describedby={undefined}>
+ <DialogContent size="large" aria-describedby={undefined}>
<DialogHeader>
<DialogTitle>Create {config.singularName} bucket</DialogTitle>
</DialogHeader>
@@ -264,17 +250,43 @@ export const CreateSpecializedBucketModal = ({
/>
{bucketType === 'analytics' && (
- <Admonition type="default">
- <p>
- Supabase will install the{' '}
- {wrappersExtensionState !== 'installed' ? 'Wrappers extension and ' : ''}
- Iceberg Wrapper integration on your behalf.{' '}
- <InlineLink href={`${DOCS_URL}/guides/database/extensions/wrappers/iceberg`}>
- Learn more
- </InlineLink>
- .
- </p>
- </Admonition>
+ <>
+ {wrappersExtenstionNeedsUpgrading ? (
+ <Admonition
+ type="warning"
+ title="Wrappers extension must be updated for Iceberg Wrapper support"
+ >
+ <p className="prose max-w-full text-sm !leading-normal">
+ Update the <code className="text-xs">wrappers</code> extension by disabling
+ and enabling it in{' '}
+ <InlineLink href={`/project/${ref}/database/extensions?filter=wrappers`}>
+ database extensions
+ </InlineLink>{' '}
+ before creating an Analytics bucket.{' '}
+ <InlineLink
+ href={`${DOCS_URL}/guides/database/extensions/wrappers/iceberg`}
+ >
+ Learn more
+ </InlineLink>
+ .
+ </p>
+ </Admonition>
+ ) : (
+ <Admonition type="default">
+ <p className="!leading-normal">
+ Supabase will install the{' '}
+ {wrappersExtensionState !== 'installed' ? 'Wrappers extension and ' : ''}
+ Iceberg Wrapper integration on your behalf.{' '}
+ <InlineLink
+ href={`${DOCS_URL}/guides/database/extensions/wrappers/iceberg`}
+ >
+ Learn more
+ </InlineLink>
+ .
+ </p>
+ </Admonition>
+ )}
+ </>
)}
</DialogSection>
</form>
@@ -284,8 +296,13 @@ export const CreateSpecializedBucketModal = ({
<Button type="default" disabled={isCreating} onClick={() => setVisible(false)}>
Cancel
</Button>
- <Button form={formId} htmlType="submit" loading={isCreating} disabled={isCreating}>
- Create
+ <Button
+ form={formId}
+ htmlType="submit"
+ loading={isCreating}
+ disabled={wrappersExtenstionNeedsUpgrading || isCreating}
+ >
+ Create bucket
</Button>
</DialogFooter>
</DialogContent>
diff --git a/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsx b/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsx
index 495981485df..d4a723180b7 100644
--- a/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsx
+++ b/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsx
@@ -29,7 +29,6 @@ import {
} from 'ui'
import { Admonition } from 'ui-patterns'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
-import { useIsNewStorageUIEnabled } from '../App/FeaturePreview/FeaturePreviewContext'
import {
useAnalyticsBucketAssociatedEntities,
useAnalyticsBucketDeleteCleanUp,
@@ -46,9 +45,8 @@ const formId = `delete-storage-bucket-form`
export const DeleteBucketModal = ({ visible, bucket, onClose }: DeleteBucketModalProps) => {
const router = useRouter()
- const { ref: projectRef } = useParams()
+ const { ref: projectRef, bucketId } = useParams()
const { data: project } = useSelectedProjectQuery()
- const isStorageV2 = useIsNewStorageUIEnabled()
const isStandardBucketSelected = 'type' in bucket && bucket.type === 'STANDARD'
@@ -107,11 +105,7 @@ export const DeleteBucketModal = ({ visible, bucket, onClose }: DeleteBucketModa
)
toast.success(`Successfully deleted bucket ${bucket.id}`)
- if (isStorageV2) {
- router.push(`/project/${projectRef}/storage/files`)
- } else {
- router.push(`/project/${projectRef}/storage/buckets`)
- }
+ if (!!bucketId) router.push(`/project/${projectRef}/storage/files`)
onClose()
} catch (error) {
toast.success(
@@ -139,11 +133,7 @@ export const DeleteBucketModal = ({ visible, bucket, onClose }: DeleteBucketModa
})
}
toast.success(`Successfully deleted analytics bucket ${bucket.id}`)
- if (isStorageV2) {
- router.push(`/project/${projectRef}/storage/analytics`)
- } else {
- router.push(`/project/${projectRef}/storage/buckets`)
- }
+ if (!!bucketId) router.push(`/project/${projectRef}/storage/analytics`)
onClose()
},
})
diff --git a/apps/studio/components/interfaces/Storage/EmptyBucketState.tsx b/apps/studio/components/interfaces/Storage/EmptyBucketState.tsx
index dde4c6e3166..56ca9f17592 100644
--- a/apps/studio/components/interfaces/Storage/EmptyBucketState.tsx
+++ b/apps/studio/components/interfaces/Storage/EmptyBucketState.tsx
@@ -1,18 +1,26 @@
import { BucketAdd } from 'icons'
+import { cn } from 'ui'
import { CreateBucketModal } from './CreateBucketModal'
import { CreateSpecializedBucketModal } from './CreateSpecializedBucketModal'
import { BUCKET_TYPES } from './Storage.constants'
interface EmptyBucketStateProps {
bucketType: keyof typeof BUCKET_TYPES
+ className?: string
}
-export const EmptyBucketState = ({ bucketType }: EmptyBucketStateProps) => {
+export const EmptyBucketState = ({ bucketType, className }: EmptyBucketStateProps) => {
const config = BUCKET_TYPES[bucketType]
return (
- <aside className="mt-12 border border-dashed w-full bg-surface-100 rounded-lg px-4 py-10 flex flex-col gap-y-3 items-center text-center gap-1 text-balance">
+ <aside
+ className={cn(
+ 'border border-dashed w-full bg-surface-100 rounded-lg px-4 py-10 flex flex-col gap-y-3 items-center text-center text-balance',
+ className
+ )}
+ >
<BucketAdd size={24} strokeWidth={1.5} className="text-foreground-muted" />
+
<div className="flex flex-col items-center text-center">
<h3>
Create {config.article} {config.singularName} bucket
diff --git a/apps/studio/components/interfaces/Storage/FilesBuckets/index.tsx b/apps/studio/components/interfaces/Storage/FilesBuckets/index.tsx
index df68851ee22..c73beac4c07 100644
--- a/apps/studio/components/interfaces/Storage/FilesBuckets/index.tsx
+++ b/apps/studio/components/interfaces/Storage/FilesBuckets/index.tsx
@@ -65,7 +65,7 @@ export const FilesBuckets = () => {
<>
{!isLoading &&
buckets.filter((bucket) => !('type' in bucket) || bucket.type === 'STANDARD').length === 0 ? (
- <EmptyBucketState bucketType="files" />
+ <EmptyBucketState bucketType="files" className="mt-12" />
) : (
// Add !pt-8 to override the default first:pt-12
<ScaffoldSection isFullWidth className="h-full gap-y-4">
diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx b/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx
index c42bde0e89c..abfc34bbbf4 100644
--- a/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx
@@ -16,16 +16,14 @@ import {
} from 'lucide-react'
import { useCallback, useEffect, useRef, useState } from 'react'
-import {
- useIsAPIDocsSidePanelEnabled,
- useIsNewStorageUIEnabled,
-} from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsAPIDocsSidePanelEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { APIDocsButton } from 'components/ui/APIDocsButton'
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useStorageExplorerStateSnapshot } from 'state/storage-explorer'
import {
Button,
+ cn,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
@@ -58,23 +56,23 @@ const SORT_ORDER_OPTIONS = [
const HeaderPathEdit = ({ loading, isSearching, breadcrumbs, togglePathEdit }: any) => {
return (
<div
- className={`group ${!loading ? 'cursor-pointer' : ''}`}
+ className={cn('group', !loading && 'cursor-pointer')}
onClick={() => (!loading.isLoading ? togglePathEdit() : {})}
>
{loading.isLoading ? (
- <div className="ml-2 flex items-center">
- <Loader size={16} strokeWidth={2} className="animate-spin" />
- <p className="ml-3 text-sm">{loading.message}</p>
+ <div className="ml-2 flex items-center gap-x-3">
+ <Loader size={14} strokeWidth={2} className="animate-spin" />
+ <p className="text-sm text-foreground-light">{loading.message}</p>
</div>
) : (
- <div className="flex cursor-pointer items-center">
- <p className="ml-3 text-sm truncate">{breadcrumbs[breadcrumbs.length - 1] || ''}</p>
+ <div className="flex cursor-pointer items-center gap-x-3">
+ {breadcrumbs.length > 1 && (
+ <p className="ml-2 text-sm truncate">{breadcrumbs[breadcrumbs.length - 1] || ''}</p>
+ )}
{!isSearching && (
- <div className="ml-3 flex items-center space-x-2 opacity-0 transition group-hover:opacity-100">
- <Button type="text" icon={<Edit2 />}>
- Navigate
- </Button>
- </div>
+ <Button type="text" icon={<Edit2 />} className="transition opacity-0 hover:opacity-100">
+ Navigate
+ </Button>
)}
</div>
)}
@@ -151,7 +149,6 @@ export const FileExplorerHeader = ({
const debounceDuration = 300
const snap = useStorageExplorerStateSnapshot()
const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled()
- const isNewStorageUIEnabled = useIsNewStorageUIEnabled()
const [pathString, setPathString] = useState('')
const [searchString, setSearchString] = useState('')
@@ -283,10 +280,11 @@ export const FileExplorerHeader = ({
return (
<div
- className="
- flex h-[40px] pl-2
- items-center justify-between
- rounded-t-md border-b border-overlay bg-surface-100"
+ className={cn(
+ 'flex h-[40px] pl-2',
+ 'items-center justify-between',
+ 'rounded-t-md border-b border-overlay bg-surface-100'
+ )}
>
{/* Navigation */}
<div className={`flex items-center ${isEditingPath ? 'w-1/2' : ''}`}>
@@ -334,29 +332,12 @@ export const FileExplorerHeader = ({
/>
</form>
) : snap.view === STORAGE_VIEWS.COLUMNS ? (
- breadcrumbs.length > 1 ? (
- <HeaderPathEdit
- loading={loading}
- isSearching={snap.isSearching}
- breadcrumbs={breadcrumbs}
- togglePathEdit={togglePathEdit}
- />
- ) : isNewStorageUIEnabled ? (
- <div className="flex items-center group">
- <div className="flex items-center space-x-2 opacity-0 transition group-hover:opacity-100">
- <Button type="text" icon={<Edit2 />} onClick={togglePathEdit}>
- Navigate
- </Button>
- </div>
- </div>
- ) : (
- <HeaderPathEdit
- loading={loading}
- isSearching={snap.isSearching}
- breadcrumbs={breadcrumbs}
- togglePathEdit={togglePathEdit}
- />
- )
+ <HeaderPathEdit
+ loading={loading}
+ isSearching={snap.isSearching}
+ breadcrumbs={breadcrumbs}
+ togglePathEdit={togglePathEdit}
+ />
) : breadcrumbs.length > 1 ? (
<HeaderBreadcrumbs
loading={loading}
diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/useSelectedBucket.ts b/apps/studio/components/interfaces/Storage/StorageExplorer/useSelectedBucket.ts
index ff4f1e0a83f..aae911f33b4 100644
--- a/apps/studio/components/interfaces/Storage/StorageExplorer/useSelectedBucket.ts
+++ b/apps/studio/components/interfaces/Storage/StorageExplorer/useSelectedBucket.ts
@@ -1,5 +1,5 @@
import { useParams } from 'common'
-import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query'
+import { useIsAnalyticsBucketsEnabled } from 'data/config/project-storage-config-query'
import { useAnalyticsBucketsQuery } from 'data/storage/analytics-buckets-query'
import { useBucketsQuery } from 'data/storage/buckets-query'
import { useStorageV2Page } from '../Storage.utils'
@@ -7,9 +7,7 @@ import { useStorageV2Page } from '../Storage.utils'
export const useSelectedBucket = () => {
const { ref, bucketId } = useParams()
const page = useStorageV2Page()
-
- const { data } = useProjectStorageConfigQuery({ projectRef: ref })
- const hasIcebergEnabled = data?.features.icebergCatalog?.enabled
+ const hasIcebergEnabled = useIsAnalyticsBucketsEnabled({ projectRef: ref })
const {
data: analyticsBuckets = [],
diff --git a/apps/studio/components/interfaces/Storage/StorageMenu.BucketList.tsx b/apps/studio/components/interfaces/Storage/StorageMenu.BucketList.tsx
deleted file mode 100644
index 8327d10876d..00000000000
--- a/apps/studio/components/interfaces/Storage/StorageMenu.BucketList.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import type { CSSProperties } from 'react'
-import { memo, useCallback, useMemo } from 'react'
-
-import { InfiniteListDefault } from 'components/ui/InfiniteList'
-import type { Bucket } from 'data/storage/buckets-query'
-import { cn } from 'ui'
-import { BucketRow } from './BucketRow'
-
-type VirtualizedBucketRowProps = {
- item: Bucket
- projectRef?: string
- selectedBucketId?: string
- style?: CSSProperties
-}
-
-const BUCKET_ROW_HEIGHT = 'h-7'
-
-const VirtualizedBucketRow = memo(
- ({ item, projectRef, selectedBucketId, style }: VirtualizedBucketRowProps) => {
- const isSelected = selectedBucketId === item.id
-
- return (
- <BucketRow
- bucket={item}
- isSelected={isSelected}
- projectRef={projectRef}
- style={style as CSSProperties}
- className={cn(BUCKET_ROW_HEIGHT)}
- />
- )
- }
-)
-VirtualizedBucketRow.displayName = 'VirtualizedBucketRow'
-
-const BucketListVirtualized = ({ buckets, selectedBucketId, projectRef = '' }: BucketListProps) => {
- const itemData = useMemo(
- () => ({
- projectRef,
- selectedBucketId,
- }),
- [projectRef, selectedBucketId]
- )
-
- const getItemKey = useCallback(
- (index: number) => {
- const item = buckets[index]
- return item?.id || `bucket-${index}`
- },
- [buckets]
- )
-
- return (
- <InfiniteListDefault
- items={buckets}
- itemProps={itemData}
- getItemKey={getItemKey}
- // Keep in tandem with BUCKET_ROW_HEIGHT
- getItemSize={() => 28}
- ItemComponent={VirtualizedBucketRow}
- // There is no loader because all buckets load from backend at once
- LoaderComponent={() => null}
- className="pb-3"
- />
- )
-}
-
-type BucketListProps = {
- buckets: Bucket[]
- selectedBucketId?: string
- projectRef?: string
-}
-
-export const BucketList = ({ buckets, selectedBucketId, projectRef = '' }: BucketListProps) => {
- const numBuckets = buckets.length
-
- if (numBuckets <= 50) {
- return buckets.map((bucket) => (
- <BucketRow
- key={bucket.id}
- bucket={bucket}
- isSelected={selectedBucketId === bucket.id}
- projectRef={projectRef}
- className={BUCKET_ROW_HEIGHT}
- />
- ))
- }
-
- return (
- <BucketListVirtualized
- buckets={buckets}
- selectedBucketId={selectedBucketId}
- projectRef={projectRef}
- />
- )
-}
diff --git a/apps/studio/components/interfaces/Storage/StorageMenu.tsx b/apps/studio/components/interfaces/Storage/StorageMenu.tsx
deleted file mode 100644
index 7b0c795f94d..00000000000
--- a/apps/studio/components/interfaces/Storage/StorageMenu.tsx
+++ /dev/null
@@ -1,203 +0,0 @@
-import Link from 'next/link'
-import { useRouter } from 'next/router'
-import { useMemo, useState } from 'react'
-
-import { useFlag, useParams } from 'common'
-import { CreateBucketModal } from 'components/interfaces/Storage/CreateBucketModal'
-import ShimmeringLoader from 'components/ui/ShimmeringLoader'
-import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query'
-import { useBucketsQuery } from 'data/storage/buckets-query'
-import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
-import { IS_PLATFORM } from 'lib/constants'
-import { useStorageExplorerStateSnapshot } from 'state/storage-explorer'
-import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, cn, Menu } from 'ui'
-import { InfoTooltip } from 'ui-patterns/info-tooltip'
-import {
- InnerSideBarEmptyPanel,
- InnerSideBarFilters,
- InnerSideBarFilterSearchInput,
- InnerSideBarFilterSortDropdown,
- InnerSideBarFilterSortDropdownItem,
-} from 'ui-patterns/InnerSideMenu'
-import { BucketList } from './StorageMenu.BucketList'
-
-export const StorageMenu = () => {
- const router = useRouter()
- const { ref, bucketId } = useParams()
- const { data: projectDetails } = useSelectedProjectQuery()
- const snap = useStorageExplorerStateSnapshot()
-
- const showMigrationCallout = useFlag('storageMigrationCallout')
- const { data: config } = useProjectStorageConfigQuery(
- { projectRef: ref },
- { enabled: showMigrationCallout }
- )
- const isListV2UpgradeAvailable =
- !!config && !config.capabilities.list_v2 && config.external.upstreamTarget === 'main'
-
- const isBranch = projectDetails?.parent_project_ref !== undefined
-
- const [searchText, setSearchText] = useState<string>('')
-
- const page = router.pathname.split('/')[4] as
- | undefined
- | 'policies'
- | 'settings'
- | 'usage'
- | 'logs'
-
- const {
- data: buckets = [],
- error,
- isLoading,
- isError,
- isSuccess,
- } = useBucketsQuery({ projectRef: ref })
- const sortedBuckets = useMemo(
- () =>
- snap.sortBucket === 'alphabetical'
- ? buckets.sort((a, b) =>
- a.name.toLowerCase().trim().localeCompare(b.name.toLowerCase().trim())
- )
- : buckets.sort((a, b) => (new Date(b.created_at) > new Date(a.created_at) ? -1 : 1)),
- [buckets, snap.sortBucket]
- )
- const filteredBuckets = useMemo(
- () =>
- searchText.length > 1
- ? sortedBuckets.filter((bucket) => bucket.name.includes(searchText.trim()))
- : sortedBuckets,
- [sortedBuckets, searchText]
- )
- const tempNotSupported = error?.message.includes('Tenant config') && isBranch
- const isVirtualized = buckets.length > 50
-
- return (
- <>
- <Menu
- type="pills"
- className="h-full flex flex-col"
- ulClassName="flex flex-col flex-grow min-h-0"
- >
- <div className="flex flex-col gap-y-1.5 px-5 pb-6 pt-6 sticky top-0 bg-sidebar">
- <CreateBucketModal />
-
- <InnerSideBarFilters className="px-0">
- <InnerSideBarFilterSearchInput
- name="search-buckets"
- aria-labelledby="Search buckets"
- placeholder="Search buckets..."
- value={searchText}
- onChange={(e) => {
- setSearchText(e.target.value)
- }}
- >
- <InnerSideBarFilterSortDropdown
- value={snap.sortBucket}
- onValueChange={(value: any) => snap.setSortBucket(value)}
- >
- <InnerSideBarFilterSortDropdownItem
- key="alphabetical"
- value="alphabetical"
- className="flex gap-2"
- >
- Alphabetical
- </InnerSideBarFilterSortDropdownItem>
- <InnerSideBarFilterSortDropdownItem key="created-at" value="created-at">
- Created at
- </InnerSideBarFilterSortDropdownItem>
- </InnerSideBarFilterSortDropdown>
- </InnerSideBarFilterSearchInput>
- </InnerSideBarFilters>
- </div>
-
- <div className={cn('flex flex-col', isVirtualized && 'flex-grow min-h-0')}>
- <div
- className={cn(
- 'flex flex-col mx-3',
- isVirtualized
- ? 'flex-grow min-h-0'
- : isSuccess && filteredBuckets.length > 0
- ? 'mb-3'
- : 'mb-5'
- )}
- >
- <Menu.Group title={<span className="uppercase font-mono">All buckets</span>} />
-
- {isLoading && (
- <div className="space-y-2 mx-2">
- <ShimmeringLoader className="!py-2.5" />
- <ShimmeringLoader className="!py-2.5" />
- <ShimmeringLoader className="!py-2.5" />
- </div>
- )}
-
- {isError && (
- <div className="px-2">
- <Alert_Shadcn_ variant={tempNotSupported ? 'default' : 'warning'}>
- <AlertTitle_Shadcn_ className="text-xs tracking-normal">
- {tempNotSupported
- ? 'Storage is not available on preview branches for now'
- : 'Failed to fetch buckets'}
- </AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_ className="text-xs">
- {tempNotSupported
- ? "We're actively looking into making this available on preview branches"
- : 'Please refresh to try again'}
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
- </div>
- )}
-
- {isSuccess && (
- <>
- {buckets.length === 0 && (
- <InnerSideBarEmptyPanel
- className="mx-2"
- title="No buckets available"
- description="Buckets that you create will appear here"
- />
- )}
- {searchText.length > 0 && filteredBuckets.length === 0 && (
- <InnerSideBarEmptyPanel
- className="mx-2"
- title="No results found"
- description={`Your search for "${searchText}" did not return any results`}
- />
- )}
- {filteredBuckets.length > 0 && (
- <BucketList
- buckets={filteredBuckets}
- selectedBucketId={bucketId}
- projectRef={ref}
- />
- )}
- </>
- )}
- </div>
- </div>
-
- <div className="w-full bg-dash-sidebar px-3 py-6 sticky bottom-0 border-t border-border">
- <Menu.Group title={<span className="uppercase font-mono">Configuration</span>} />
- <Link href={`/project/${ref}/storage/policies`}>
- <Menu.Item rounded active={page === 'policies'}>
- <p className="truncate">Policies</p>
- </Menu.Item>
- </Link>
- {IS_PLATFORM && (
- <Link href={`/project/${ref}/storage/settings`}>
- <Menu.Item rounded active={page === 'settings'}>
- <div className="flex items-center gap-x-2">
- <p className="truncate">Settings</p>
- {isListV2UpgradeAvailable && (
- <InfoTooltip side="right">Upgrade available</InfoTooltip>
- )}
- </div>
- </Menu.Item>
- </Link>
- )}
- </div>
- </Menu>
- </>
- )
-}
diff --git a/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx b/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx
index b3ef2cc665a..8a08b41ad70 100644
--- a/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx
@@ -1,7 +1,8 @@
import Link from 'next/link'
import { IS_PLATFORM, useParams } from 'common'
-import { Menu } from 'ui'
+import { useIsAnalyticsBucketsEnabled } from 'data/config/project-storage-config-query'
+import { Badge, Menu } from 'ui'
import { BUCKET_TYPES, BUCKET_TYPE_KEYS } from './Storage.constants'
import { useStorageV2Page } from './Storage.utils'
@@ -9,6 +10,8 @@ export const StorageMenuV2 = () => {
const { ref } = useParams()
const page = useStorageV2Page()
+ const isAnalyticsBucketsEnabled = useIsAnalyticsBucketsEnabled({ projectRef: ref })
+
return (
<Menu type="pills" className="my-6 flex flex-grow flex-col">
<div className="space-y-6">
@@ -22,7 +25,12 @@ export const StorageMenuV2 = () => {
return (
<Link key={bucketTypeKey} href={`/project/${ref}/storage/${bucketTypeKey}`}>
<Menu.Item rounded active={isSelected}>
- <p className="truncate">{config.displayName}</p>
+ <div className="flex items-center justify-between">
+ <p className="truncate">{config.displayName}</p>
+ {bucketTypeKey === 'analytics' && isAnalyticsBucketsEnabled && (
+ <Badge variant="warning">ALPHA</Badge>
+ )}
+ </div>
</Menu.Item>
</Link>
)
diff --git a/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx b/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx
index 5479ff4c010..02705cc6306 100644
--- a/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx
+++ b/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx
@@ -57,9 +57,6 @@ describe(`CreateBucketModal`, () => {
const nameInput = screen.getByLabelText(`Bucket name`)
await userEvent.type(nameInput, `test`)
- const standardOption = screen.getByLabelText(`Standard bucket`)
- await userEvent.click(standardOption)
-
const publicToggle = screen.getByLabelText(`Public bucket`)
expect(publicToggle).not.toBeChecked()
await userEvent.click(publicToggle)
@@ -93,9 +90,5 @@ describe(`CreateBucketModal`, () => {
const submitButton = screen.getByRole(`button`, { name: `Create` })
fireEvent.click(submitButton)
-
- await waitFor(() =>
- expect(routerMock.asPath).toStrictEqual(`/project/default/storage/buckets/test`)
- )
})
})
diff --git a/apps/studio/components/interfaces/Storage/__tests__/DeleteBucketModal.test.tsx b/apps/studio/components/interfaces/Storage/__tests__/DeleteBucketModal.test.tsx
index 33fe3db213a..a119c6a7558 100644
--- a/apps/studio/components/interfaces/Storage/__tests__/DeleteBucketModal.test.tsx
+++ b/apps/studio/components/interfaces/Storage/__tests__/DeleteBucketModal.test.tsx
@@ -46,7 +46,7 @@ const Page = ({ onClose }: { onClose: () => void }) => {
describe(`DeleteBucketModal`, () => {
beforeEach(() => {
// useParams
- routerMock.setCurrentUrl(`/project/default/storage/buckets/test`)
+ routerMock.setCurrentUrl(`/project/default/storage/files`)
// useProjectContext
addAPIMock({
method: `get`,
@@ -117,7 +117,7 @@ describe(`DeleteBucketModal`, () => {
fireEvent.click(confirmButton)
await waitFor(() => expect(onClose).toHaveBeenCalledOnce())
- expect(routerMock.asPath).toStrictEqual(`/project/default/storage/buckets`)
+ expect(routerMock.asPath).toStrictEqual(`/project/default/storage/files`)
})
it(`prevents submission when the input doesn't match the bucket name`, async () => {
diff --git a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
index e5059034da2..406279a34e2 100644
--- a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
@@ -51,7 +51,6 @@ export const generateProductRoutes = (
storage?: boolean
realtime?: boolean
authOverviewPage?: boolean
- isStorageV2?: boolean
}
): Route[] => {
const isProjectActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY
@@ -63,7 +62,6 @@ export const generateProductRoutes = (
const storageEnabled = features?.storage ?? true
const realtimeEnabled = features?.realtime ?? true
const authOverviewPageEnabled = features?.authOverviewPage ?? false
- const isStorageV2 = features?.isStorageV2 ?? false
const databaseMenu = generateDatabaseMenu(project)
const authMenu = generateAuthMenu(ref as string)
@@ -105,11 +103,7 @@ export const generateProductRoutes = (
key: 'storage',
label: 'Storage',
icon: <Storage size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,
- link:
- ref &&
- (isProjectBuilding
- ? buildingUrl
- : `/project/${ref}/storage/${isStorageV2 ? 'files' : 'buckets'}`),
+ link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/storage/files`),
},
]
: []),
diff --git a/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsx b/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsx
index d9595685b15..9b22d850b45 100644
--- a/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsx
+++ b/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsx
@@ -1,5 +1,5 @@
import { useRouter } from 'next/router'
-import { PropsWithChildren, useEffect } from 'react'
+import { PropsWithChildren } from 'react'
import { useParams } from 'common'
import { ProductMenu } from 'components/ui/ProductMenu'
@@ -7,7 +7,6 @@ import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { withAuth } from 'hooks/misc/withAuth'
-import { IS_PLATFORM } from 'lib/constants'
import { ProjectLayout } from '../ProjectLayout'
import { generateSettingsMenu } from './SettingsMenu.utils'
diff --git a/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx b/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx
index a74e4fef03c..3cc9602bed7 100644
--- a/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx
+++ b/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx
@@ -1,10 +1,5 @@
-import { useRouter } from 'next/router'
-import { ReactNode, useEffect } from 'react'
+import { ReactNode } from 'react'
-import { useParams } from 'common'
-import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
-import { useSelectedBucket } from 'components/interfaces/Storage/StorageExplorer/useSelectedBucket'
-import { StorageMenu } from 'components/interfaces/Storage/StorageMenu'
import { StorageMenuV2 } from 'components/interfaces/Storage/StorageMenuV2'
import { withAuth } from 'hooks/misc/withAuth'
import { ProjectLayout } from '../ProjectLayout'
@@ -15,60 +10,8 @@ export interface StorageLayoutProps {
}
const StorageLayout = ({ title, children }: StorageLayoutProps) => {
- const router = useRouter()
- const isStorageV2 = useIsNewStorageUIEnabled()
- const { ref, featurePreviewModal, bucketId } = useParams()
- const { bucket } = useSelectedBucket()
-
- // [Joshen] Handle redirects between existing UI and feature preview
- useEffect(() => {
- const { pathname } = router
- const suffix = !!featurePreviewModal ? `?featurePreviewModal=${featurePreviewModal}` : ''
-
- if (!ref) return
-
- if (isStorageV2) {
- // From old UI to new UI
- if (pathname.endsWith('/storage/settings')) {
- router.push(`/project/${ref}/storage/files/settings${suffix}`)
- } else if (pathname.endsWith('/storage/policies')) {
- router.push(`/project/${ref}/storage/files/policies${suffix}`)
- } else if (pathname.endsWith('/storage/buckets/[bucketId]')) {
- if (!!bucket && bucket.type === 'STANDARD') {
- router.push(`/project/${ref}/storage/files/buckets/${bucketId}${suffix}`)
- } else if (!!bucket && bucket.type === 'ANALYTICS') {
- router.push(`/project/${ref}/storage/analytics/buckets/${bucketId}${suffix}`)
- }
- }
- } else {
- // From new UI to old UI
- if (pathname.endsWith('/files/settings')) {
- router.push(`/project/${ref}/storage/settings${suffix}`)
- } else if (pathname.endsWith('/files/policies')) {
- router.push(`/project/${ref}/storage/policies${suffix}`)
- } else if (
- pathname.endsWith('/files/buckets/[bucketId]') ||
- pathname.endsWith('/analytics/buckets/[bucketId]')
- ) {
- router.push(`/project/${ref}/storage/buckets/${bucketId}${suffix}`)
- } else if (
- pathname.endsWith('/storage/files') ||
- pathname.endsWith('/storage/analytics') ||
- pathname.endsWith('/storage/vectors')
- ) {
- router.push(`/project/${ref}/storage/buckets`)
- }
- }
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [ref, isStorageV2])
-
return (
- <ProjectLayout
- stickySidebarBottom={isStorageV2 ? false : true}
- title={title || 'Storage'}
- product="Storage"
- productMenu={isStorageV2 ? <StorageMenuV2 /> : <StorageMenu />}
- >
+ <ProjectLayout title={title || 'Storage'} product="Storage" productMenu={<StorageMenuV2 />}>
{children}
</ProjectLayout>
)
diff --git a/apps/studio/data/config/project-storage-config-query.ts b/apps/studio/data/config/project-storage-config-query.ts
index 310d154e074..14ad4957764 100644
--- a/apps/studio/data/config/project-storage-config-query.ts
+++ b/apps/studio/data/config/project-storage-config-query.ts
@@ -51,3 +51,8 @@ export const useProjectStorageConfigQuery = <TData = ProjectStorageConfigData>(
enabled: enabled && IS_PLATFORM && typeof projectRef !== 'undefined',
...options,
})
+
+export const useIsAnalyticsBucketsEnabled = ({ projectRef }: { projectRef?: string }) => {
+ const { data } = useProjectStorageConfigQuery({ projectRef })
+ return !!data?.features.icebergCatalog
+}
diff --git a/apps/studio/data/storage/analytics-bucket-create-mutation.ts b/apps/studio/data/storage/analytics-bucket-create-mutation.ts
index df84aff7750..97d4ddc0f31 100644
--- a/apps/studio/data/storage/analytics-bucket-create-mutation.ts
+++ b/apps/studio/data/storage/analytics-bucket-create-mutation.ts
@@ -2,7 +2,6 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'
import { toast } from 'sonner'
import { components } from 'api-types'
-import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { handleError, post } from 'data/fetchers'
import type { ResponseError, UseCustomMutationOptions } from 'types'
import { storageKeys } from './keys'
@@ -41,17 +40,12 @@ export const useAnalyticsBucketCreateMutation = ({
'mutationFn'
> = {}) => {
const queryClient = useQueryClient()
- const isStorageV2 = useIsNewStorageUIEnabled()
return useMutation<AnalyticsBucketCreateData, ResponseError, AnalyticsBucketCreateVariables>({
mutationFn: (vars) => createAnalyticsBucket(vars),
async onSuccess(data, variables, context) {
const { projectRef } = variables
- if (isStorageV2) {
- await queryClient.invalidateQueries(storageKeys.analyticsBuckets(projectRef))
- } else {
- await queryClient.invalidateQueries(storageKeys.buckets(projectRef))
- }
+ await queryClient.invalidateQueries(storageKeys.analyticsBuckets(projectRef))
await onSuccess?.(data, variables, context)
},
async onError(data, variables, context) {
diff --git a/apps/studio/data/storage/analytics-bucket-delete-mutation.ts b/apps/studio/data/storage/analytics-bucket-delete-mutation.ts
index 877d3515207..05971d4bfdf 100644
--- a/apps/studio/data/storage/analytics-bucket-delete-mutation.ts
+++ b/apps/studio/data/storage/analytics-bucket-delete-mutation.ts
@@ -1,7 +1,6 @@
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { toast } from 'sonner'
-import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { del, handleError } from 'data/fetchers'
import type { ResponseError, UseCustomMutationOptions } from 'types'
import { storageKeys } from './keys'
@@ -38,17 +37,12 @@ export const useAnalyticsBucketDeleteMutation = ({
'mutationFn'
> = {}) => {
const queryClient = useQueryClient()
- const isStorageV2 = useIsNewStorageUIEnabled()
return useMutation<AnalyticsBucketDeleteData, ResponseError, AnalyticsBucketDeleteVariables>({
mutationFn: (vars) => deleteAnalyticsBucket(vars),
async onSuccess(data, variables, context) {
const { projectRef } = variables
- if (isStorageV2) {
- await queryClient.invalidateQueries(storageKeys.analyticsBuckets(projectRef))
- } else {
- await queryClient.invalidateQueries(storageKeys.buckets(projectRef))
- }
+ await queryClient.invalidateQueries(storageKeys.analyticsBuckets(projectRef))
await onSuccess?.(data, variables, context)
},
async onError(data, variables, context) {
diff --git a/apps/studio/data/storage/analytics-buckets-query.ts b/apps/studio/data/storage/analytics-buckets-query.ts
index 6e16bbad6e5..37b60fbe406 100644
--- a/apps/studio/data/storage/analytics-buckets-query.ts
+++ b/apps/studio/data/storage/analytics-buckets-query.ts
@@ -1,7 +1,7 @@
import { useQuery } from '@tanstack/react-query'
import { components } from 'api-types'
-import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query'
+import { useIsAnalyticsBucketsEnabled } from 'data/config/project-storage-config-query'
import { get, handleError } from 'data/fetchers'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { PROJECT_STATUS } from 'lib/constants'
@@ -39,9 +39,7 @@ export const useAnalyticsBucketsQuery = <TData = AnalyticsBucketsData>(
) => {
const { data: project } = useSelectedProjectQuery()
const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY
-
- const { data } = useProjectStorageConfigQuery({ projectRef: project?.ref })
- const hasIcebergEnabled = data?.features.icebergCatalog?.enabled
+ const hasIcebergEnabled = useIsAnalyticsBucketsEnabled({ projectRef: project?.ref })
return useQuery<AnalyticsBucketsData, AnalyticsBucketsError, TData>({
queryKey: storageKeys.analyticsBuckets(projectRef),
diff --git a/apps/studio/next.config.js b/apps/studio/next.config.js
index 051184142f1..8ee8cdbdf9e 100644
--- a/apps/studio/next.config.js
+++ b/apps/studio/next.config.js
@@ -141,7 +141,17 @@ const nextConfig = {
},
{
source: '/project/:ref/storage',
- destination: '/project/:ref/storage/buckets',
+ destination: '/project/:ref/storage/files',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/storage/buckets',
+ destination: '/project/:ref/storage/files',
+ permanent: true,
+ },
+ {
+ source: '/project/:ref/storage/buckets/:bucketId',
+ destination: '/project/:ref/storage/files/buckets/:bucketId',
permanent: true,
},
{
diff --git a/apps/studio/pages/project/[ref]/storage/analytics/buckets/[bucketId].tsx b/apps/studio/pages/project/[ref]/storage/analytics/buckets/[bucketId].tsx
index 7ea03e11ad7..8330211db67 100644
--- a/apps/studio/pages/project/[ref]/storage/analytics/buckets/[bucketId].tsx
+++ b/apps/studio/pages/project/[ref]/storage/analytics/buckets/[bucketId].tsx
@@ -34,7 +34,7 @@ const AnalyticsBucketPage: NextPageWithLayout = () => {
className="max-w-md"
type="default"
title="Unable to find bucket"
- description={`${bucketId ? `The template "${bucketId}"` : 'This template'} doesn’t seem to exist.`}
+ description={`${bucketId ? `The bucket "${bucketId}"` : 'This bucket'} doesn’t seem to exist.`}
>
<Button asChild type="default" className="mt-2">
<Link href={`/project/${projectRef}/storage/analytics`}>Head back</Link>
diff --git a/apps/studio/pages/project/[ref]/storage/analytics/index.tsx b/apps/studio/pages/project/[ref]/storage/analytics/index.tsx
index 180782e9a42..732e8d02bca 100644
--- a/apps/studio/pages/project/[ref]/storage/analytics/index.tsx
+++ b/apps/studio/pages/project/[ref]/storage/analytics/index.tsx
@@ -1,11 +1,16 @@
+import { useParams } from 'common'
import { AnalyticsBuckets } from 'components/interfaces/Storage/AnalyticsBuckets'
+import { BucketsComingSoon } from 'components/interfaces/Storage/BucketsComingSoon'
import DefaultLayout from 'components/layouts/DefaultLayout'
import { StorageBucketsLayout } from 'components/layouts/StorageLayout/StorageBucketsLayout'
import StorageLayout from 'components/layouts/StorageLayout/StorageLayout'
+import { useIsAnalyticsBucketsEnabled } from 'data/config/project-storage-config-query'
import type { NextPageWithLayout } from 'types'
const StorageAnalyticsPage: NextPageWithLayout = () => {
- return <AnalyticsBuckets />
+ const { ref: projectRef } = useParams()
+ const isAnalyticsBucketsEnabled = useIsAnalyticsBucketsEnabled({ projectRef })
+ return isAnalyticsBucketsEnabled ? <AnalyticsBuckets /> : <BucketsComingSoon type="analytics" />
}
StorageAnalyticsPage.getLayout = (page) => (
diff --git a/apps/studio/pages/project/[ref]/storage/buckets/[bucketId].tsx b/apps/studio/pages/project/[ref]/storage/buckets/[bucketId].tsx
deleted file mode 100644
index 7881db3345d..00000000000
--- a/apps/studio/pages/project/[ref]/storage/buckets/[bucketId].tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { useParams } from 'common'
-
-import { AnalyticBucketDetails } from 'components/interfaces/Storage/AnalyticsBucketDetails'
-import StorageBucketsError from 'components/interfaces/Storage/StorageBucketsError'
-import { StorageExplorer } from 'components/interfaces/Storage/StorageExplorer/StorageExplorer'
-import { useSelectedBucket } from 'components/interfaces/Storage/StorageExplorer/useSelectedBucket'
-import DefaultLayout from 'components/layouts/DefaultLayout'
-import StorageLayout from 'components/layouts/StorageLayout/StorageLayout'
-import { AnalyticsBucket } from 'data/storage/analytics-buckets-query'
-import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
-import { useStorageExplorerStateSnapshot } from 'state/storage-explorer'
-import type { NextPageWithLayout } from 'types'
-
-const PageLayout: NextPageWithLayout = () => {
- const { bucketId } = useParams()
- const { data: project } = useSelectedProjectQuery()
- const { projectRef } = useStorageExplorerStateSnapshot()
- const { bucket, error, isSuccess, isError } = useSelectedBucket()
-
- // [Joshen] Checking against projectRef from storage explorer to check if the store has initialized
- if (!project || !projectRef) return null
-
- return (
- <div className="storage-container flex flex-grow min-h-0 p-4">
- {isError && <StorageBucketsError error={error as any} />}
-
- {isSuccess ? (
- !bucket ? (
- <div className="flex h-full w-full items-center justify-center">
- <p className="text-sm text-foreground-light">Bucket {bucketId} cannot be found</p>
- </div>
- ) : bucket.type === 'ANALYTICS' ? (
- <AnalyticBucketDetails bucket={bucket as AnalyticsBucket} />
- ) : (
- <StorageExplorer bucket={bucket} />
- )
- ) : null}
- </div>
- )
-}
-
-PageLayout.getLayout = (page) => (
- <DefaultLayout>
- <StorageLayout title="Buckets">{page}</StorageLayout>
- </DefaultLayout>
-)
-
-export default PageLayout
diff --git a/apps/studio/pages/project/[ref]/storage/buckets/index.tsx b/apps/studio/pages/project/[ref]/storage/buckets/index.tsx
deleted file mode 100644
index 6cefe0c843d..00000000000
--- a/apps/studio/pages/project/[ref]/storage/buckets/index.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import { useParams } from 'common'
-import { useRouter } from 'next/router'
-import { useEffect } from 'react'
-
-import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
-import { DEFAULT_BUCKET_TYPE } from 'components/interfaces/Storage/Storage.constants'
-import StorageBucketsError from 'components/interfaces/Storage/StorageBucketsError'
-import DefaultLayout from 'components/layouts/DefaultLayout'
-import StorageLayout from 'components/layouts/StorageLayout/StorageLayout'
-import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'
-import { useBucketsQuery } from 'data/storage/buckets-query'
-import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
-import { DOCS_URL } from 'lib/constants'
-import type { NextPageWithLayout } from 'types'
-
-const PageLayout: NextPageWithLayout = () => {
- const { ref } = useParams()
- const router = useRouter()
- const isStorageV2 = useIsNewStorageUIEnabled()
- const { data: project } = useSelectedProjectQuery()
- const { error, isError } = useBucketsQuery({ projectRef: ref })
-
- useEffect(() => {
- if (isStorageV2) {
- router.replace(`/project/${ref}/storage/${DEFAULT_BUCKET_TYPE}`)
- }
- }, [isStorageV2, ref, router])
-
- if (!project) return null
-
- if (isError) return <StorageBucketsError error={error as any} />
-
- return (
- <div className="storage-container flex flex-grow">
- <ProductEmptyState
- title="Storage"
- infoButtonLabel="About storage"
- infoButtonUrl={`${DOCS_URL}/guides/storage`}
- >
- <p className="text-foreground-light text-sm">
- Create buckets to store and serve any type of digital content.
- </p>
- <p className="text-foreground-light text-sm">
- Make your buckets private or public depending on your security preference.
- </p>
- </ProductEmptyState>
- </div>
- )
-}
-
-PageLayout.getLayout = (page) => (
- <DefaultLayout>
- <StorageLayout title="Buckets">{page}</StorageLayout>
- </DefaultLayout>
-)
-
-export default PageLayout
diff --git a/apps/studio/pages/project/[ref]/storage/index.tsx b/apps/studio/pages/project/[ref]/storage/index.tsx
deleted file mode 100644
index 0b9672eb09d..00000000000
--- a/apps/studio/pages/project/[ref]/storage/index.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { useRouter } from 'next/router'
-import { useEffect } from 'react'
-
-import { useParams } from 'common'
-import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
-import { DEFAULT_BUCKET_TYPE } from 'components/interfaces/Storage/Storage.constants'
-import DefaultLayout from 'components/layouts/DefaultLayout'
-import StorageLayout from 'components/layouts/StorageLayout/StorageLayout'
-import type { NextPageWithLayout } from 'types'
-
-const Storage: NextPageWithLayout = () => {
- const { ref } = useParams()
- const router = useRouter()
- const isStorageV2 = useIsNewStorageUIEnabled()
-
- useEffect(() => {
- if (isStorageV2) {
- router.replace(`/project/${ref}/storage/${DEFAULT_BUCKET_TYPE}`)
- } else {
- router.replace(`/project/${ref}/storage/buckets`)
- }
- }, [isStorageV2, ref, router])
-
- return null
-}
-
-Storage.getLayout = (page) => (
- <DefaultLayout>
- <StorageLayout title="Storage">{page}</StorageLayout>
- </DefaultLayout>
-)
-
-export default Storage
diff --git a/apps/studio/pages/project/[ref]/storage/vectors/index.tsx b/apps/studio/pages/project/[ref]/storage/vectors/index.tsx
index edc9ae1886b..5064b24ef35 100644
--- a/apps/studio/pages/project/[ref]/storage/vectors/index.tsx
+++ b/apps/studio/pages/project/[ref]/storage/vectors/index.tsx
@@ -1,3 +1,4 @@
+import { BucketsComingSoon } from 'components/interfaces/Storage/BucketsComingSoon'
import { VectorsBuckets } from 'components/interfaces/Storage/VectorsBuckets'
import DefaultLayout from 'components/layouts/DefaultLayout'
import { StorageBucketsLayout } from 'components/layouts/StorageLayout/StorageBucketsLayout'
@@ -5,7 +6,8 @@ import StorageLayout from 'components/layouts/StorageLayout/StorageLayout'
import type { NextPageWithLayout } from 'types'
const StorageVectorsPage: NextPageWithLayout = () => {
- return <VectorsBuckets />
+ const isVectorBucketsEnabled = false
+ return isVectorBucketsEnabled ? <VectorsBuckets /> : <BucketsComingSoon type="vector" />
}
StorageVectorsPage.getLayout = (page) => (
diff --git a/packages/common/constants/local-storage.ts b/packages/common/constants/local-storage.ts
index b9b8bcf2947..af70e1874ac 100644
--- a/packages/common/constants/local-storage.ts
+++ b/packages/common/constants/local-storage.ts
@@ -17,7 +17,6 @@ export const LOCAL_STORAGE_KEYS = {
UI_ONBOARDING_NEW_PAGE_SHOWN: 'supabase-ui-onboarding-new-page-shown',
UI_PREVIEW_BRANCHING_2_0: 'supabase-ui-branching-2-0',
UI_PREVIEW_ADVISOR_RULES: 'supabase-ui-advisor-rules',
- UI_PREVIEW_NEW_STORAGE_UI: 'new-storage-ui',
UI_PREVIEW_SECURITY_NOTIFICATIONS: 'security-notifications',
NEW_LAYOUT_NOTICE_ACKNOWLEDGED: 'new-layout-notice-acknowledge',
diff --git a/packages/ui-patterns/src/admonition.tsx b/packages/ui-patterns/src/admonition.tsx
index 6c046091cc0..a04d8f99dc3 100644
--- a/packages/ui-patterns/src/admonition.tsx
+++ b/packages/ui-patterns/src/admonition.tsx
@@ -1,5 +1,5 @@
import { cva } from 'class-variance-authority'
-import { forwardRef } from 'react'
+import { forwardRef, ReactNode } from 'react'
import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, cn } from 'ui'
export interface AdmonitionProps {
@@ -20,6 +20,8 @@ export interface AdmonitionProps {
title?: React.ComponentProps<typeof AlertTitle_Shadcn_>
description?: React.ComponentProps<typeof AlertDescription_Shadcn_>
}
+ layout?: 'horizontal' | 'vertical'
+ actions?: ReactNode
}
const admonitionToAlertMapping: Record<
@@ -91,7 +93,18 @@ export const Admonition = forwardRef<
React.ComponentPropsWithoutRef<typeof Alert_Shadcn_> & AdmonitionProps
>(
(
- { type = 'note', variant, showIcon = true, label, title, description, children, ...props },
+ {
+ type = 'note',
+ variant,
+ showIcon = true,
+ label,
+ title,
+ description,
+ children,
+ layout = 'vertical',
+ actions,
+ ...props
+ },
ref
) => {
const typeMapped = variant ? admonitionToAlertMapping[variant] : admonitionToAlertMapping[type]
@@ -113,38 +126,49 @@ export const Admonition = forwardRef<
) : showIcon ? (
<InfoIcon />
) : null}
- {label || title ? (
- <>
- <AlertTitle_Shadcn_
- {...props.childProps?.title}
- className={cn(
- 'text mt-0.5 flex gap-3 text-sm [&_p]:mb-1.5 [&_p]:mt-0',
- !label && 'flex-col',
- props.childProps?.title?.className
- )}
- >
- {label || title}
- </AlertTitle_Shadcn_>
- {description && (
- <AlertDescription_Shadcn_ className={props.childProps?.description?.className}>
- {description}
- </AlertDescription_Shadcn_>
- )}
- {/* // children is to handle Docs and MDX issues with children and <p> elements */}
- {children && (
- <AlertDescription_Shadcn_
- {...props.childProps?.description}
- className={cn('[&_p]:mb-1.5 [&_p]:mt-0', props.childProps?.description?.className)}
+ <div
+ className={cn(
+ 'flex',
+ layout === 'vertical' ? 'flex-col' : 'flex-row items-center justify-between gap-x-6'
+ )}
+ >
+ {label || title ? (
+ <div>
+ <AlertTitle_Shadcn_
+ {...props.childProps?.title}
+ className={cn(
+ 'text mt-0.5 flex gap-3 text-sm [&_p]:mb-1.5 [&_p]:mt-0',
+ !label && 'flex-col',
+ props.childProps?.title?.className
+ )}
>
- {children}
- </AlertDescription_Shadcn_>
- )}
- </>
- ) : (
- <div className="text mt [&_p]:mb-1.5 [&_p]:mt-0 mt-0.5 [&_p:last-child]:mb-0">
- {children}
- </div>
- )}
+ {label || title}
+ </AlertTitle_Shadcn_>
+ {description && (
+ <AlertDescription_Shadcn_ className={props.childProps?.description?.className}>
+ {description}
+ </AlertDescription_Shadcn_>
+ )}
+ {/* // children is to handle Docs and MDX issues with children and <p> elements */}
+ {children && (
+ <AlertDescription_Shadcn_
+ {...props.childProps?.description}
+ className={cn(
+ '[&_p]:mb-1.5 [&_p]:mt-0',
+ props.childProps?.description?.className
+ )}
+ >
+ {children}
+ </AlertDescription_Shadcn_>
+ )}
+ </div>
+ ) : (
+ <div className="text mt [&_p]:mb-1.5 [&_p]:mt-0 mt-0.5 [&_p:last-child]:mb-0">
+ {children}
+ </div>
+ )}
+ {actions}
+ </div>
</Alert_Shadcn_>
)
}