mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
Add support for connection string for warehouse. This PR gives the ability to enable warehouse on a project and also get the connection string to connect to. > This project is only available in staging for now and gated behind a feature flag <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a Warehouse connection option to the Connect dialog. - Select schemas and tables to replicate, with setup progress, error recovery, and retry support. - View copyable Warehouse connection details, credentials guidance, command-line instructions, and DuckLake setup scripts. - Warehouse availability is controlled by feature configuration. - **Tests** - Added coverage for Warehouse table selection, setup script generation, URL parsing, and connection configuration utilities. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com> Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import { useMemo } from 'react'
|
|
|
|
import type { ConnectMode } from './Connect.types'
|
|
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
|
|
import { useIsWarehouseEnabled } from '@/hooks/misc/useIsWarehouseEnabled'
|
|
|
|
export function useAvailableConnectModes(): ConnectMode[] {
|
|
const {
|
|
projectConnectionShowAppFrameworks: showAppFrameworks,
|
|
projectConnectionShowMobileFrameworks: showMobileFrameworks,
|
|
projectConnectionShowOrms: showOrms,
|
|
} = useIsFeatureEnabled([
|
|
'project_connection:show_app_frameworks',
|
|
'project_connection:show_mobile_frameworks',
|
|
'project_connection:show_orms',
|
|
])
|
|
const isWarehouseEnabled = useIsWarehouseEnabled()
|
|
|
|
return useMemo(() => {
|
|
const allModes: { id: ConnectMode; enabled: boolean }[] = [
|
|
{ id: 'framework', enabled: showAppFrameworks || showMobileFrameworks },
|
|
{ id: 'server', enabled: true },
|
|
{ id: 'direct', enabled: true },
|
|
{ id: 'orm', enabled: showOrms },
|
|
{ id: 'mcp', enabled: true },
|
|
{ id: 'warehouse', enabled: isWarehouseEnabled },
|
|
]
|
|
return allModes.filter((m) => m.enabled).map((m) => m.id)
|
|
}, [showAppFrameworks, showMobileFrameworks, showOrms, isWarehouseEnabled])
|
|
}
|