mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
## What kind of change does this PR introduce? Feature and information architecture change. Builds on #50246. ## What is the current behaviour? Warehouse setup, progress, errors, table selection, and connection details all live in the transient Connect sheet. Closing the sheet hides the current replication state, and the integration is absent from the Integrations page. ## What is the new behaviour? Warehouse now has a persistent Overview page at `/project/{ref}/integrations/warehouse/overview`: - Before setup, the existing schema and table picker enables Warehouse. - During setup, the page shows the current phase and per-table backfill state where available. - Setup and status failures remain visible on the page with retry actions where possible. - Once complete, the page shows Status, Tables, then Connect. - The Connect sheet becomes read-only. Before Warehouse is ready, it links directly to the Overview page for setup, progress, or recovery. | Before | After | | --- | --- | | <img width="1200" height="907" alt="Chives Pantry Supabase" src="https://github.com/user-attachments/assets/82dc7fb0-3859-499e-96ab-56f70a5c7325" /> | <img width="1200" height="907" alt="Chives Pantry Supabase" src="https://github.com/user-attachments/assets/7428e301-27f8-48fe-91e0-6880b132920d" /> | | <img width="1200" height="907" alt="Chives Pantry Supabase" src="https://github.com/user-attachments/assets/82dc7fb0-3859-499e-96ab-56f70a5c7325" /> | <img width="1200" height="907" alt="54709" src="https://github.com/user-attachments/assets/0c589e5b-e13c-4554-a6ee-6730d0e95c07" /> | | <img width="1200" height="907" alt="ETL BigTable ETL Team Supabase" src="https://github.com/user-attachments/assets/18ec9f6c-3724-453f-bbbb-c7149758246e" /> | <img width="1200" height="907" alt="Regular AWS Teamer Supabase" src="https://github.com/user-attachments/assets/3819c9fe-e56d-4cec-988d-5e724f8d990a" /> | ## To test Use a project whose organisation is included in the Warehouse allow-list. 1. Open `/project/{ref}/integrations`, filter by **Data platform**, and open Warehouse. 2. Before setup, confirm the existing schema and table picker appears and starts with no tables selected. 3. Start setup and confirm the Status section polls through setup and table backfill phases. 4. Confirm setup failures remain visible and expose Retry when the API returns affected tables. 5. After setup, confirm the section order is Status, Tables, Connect. 6. Confirm existing replicated tables are selected and locked, while additional tables can be added. 7. Open `/project/{ref}?showConnect=true&connectTab=warehouse` and confirm it links to the Overview page before setup, during setup, and after a setup failure. 8. Once setup is complete, confirm the Connect sheet shows the FlightSQL and DuckDB connection controls from #50246. 9. Repeat the Overview checks with **One-Click Integrations** turned off. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added Supabase Warehouse to the integrations catalog, with overview documentation and availability-aware display. * Added Warehouse setup and management flows, including schema and table selection, replication progress, status details, connection options, and retry actions. * Added DuckDB and FlightSQL engine selection with Connect sheet URL and preference synchronization. * Added table replication status, lag, timestamps, and size information. * **Bug Fixes** * Warehouse setup status requests no longer retry automatically after failures. * Improved recovery messaging and retry behavior for setup and connection errors. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
122 lines
4.3 KiB
TypeScript
122 lines
4.3 KiB
TypeScript
import type { ConnectMode } from './Connect.types'
|
|
import { CONNECT_MODES } from './Connect.types'
|
|
import type { ConnectSheetPrefs } from './useConnectSheetParams'
|
|
|
|
export type ConnectSheetQueryParams = {
|
|
connectTab: string | null
|
|
framework: string | null
|
|
using: string | null
|
|
method: string | null
|
|
type: string | null
|
|
mcpClient: string | null
|
|
warehouseQueryEngine: string | null
|
|
}
|
|
|
|
export type ConnectSheetUrlUpdates = Partial<Record<keyof ConnectSheetQueryParams, string | null>>
|
|
|
|
export type ConnectSheetFieldUpdate = { fieldId: string; value: string }
|
|
|
|
export type ConnectSheetHydration = {
|
|
mode: ConnectMode | null
|
|
fieldUpdates: ConnectSheetFieldUpdate[]
|
|
urlUpdates: ConnectSheetUrlUpdates
|
|
}
|
|
|
|
export const CLEARED_CONNECT_SHEET_QUERY_PARAMS = {
|
|
connectTab: null,
|
|
framework: null,
|
|
using: null,
|
|
method: null,
|
|
type: null,
|
|
mcpClient: null,
|
|
warehouseQueryEngine: null,
|
|
}
|
|
|
|
function isConnectMode(value: string): value is ConnectMode {
|
|
return CONNECT_MODES.some((mode) => mode === value)
|
|
}
|
|
|
|
export function mapConnectTabToMode(tab: string | null): ConnectMode | null {
|
|
if (!tab) return null
|
|
switch (tab) {
|
|
case 'frameworks':
|
|
case 'mobiles':
|
|
return 'framework'
|
|
case 'orms':
|
|
return 'orm'
|
|
default:
|
|
return isConnectMode(tab) ? tab : null
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Computes what should happen when the Connect sheet is opened: which mode/fields
|
|
* to hydrate from storedPrefs (falling back for whatever isn't already in the URL),
|
|
* and which URL params to backfill so the URL reflects the restored state.
|
|
*
|
|
* Field/URL updates are driven by `mappedMode` regardless of whether that mode is
|
|
* currently available — only the `mode` result (used to call `setMode`) is gated on
|
|
* `availableModeIds`, matching the sheet's pre-extraction behavior.
|
|
*/
|
|
export function resolveConnectSheetHydration(
|
|
query: ConnectSheetQueryParams,
|
|
storedPrefs: ConnectSheetPrefs,
|
|
availableModeIds: ConnectMode[]
|
|
): ConnectSheetHydration {
|
|
const effectiveTab = query.connectTab ?? storedPrefs.connectTab ?? null
|
|
const effectiveFramework = query.framework ?? storedPrefs.framework ?? null
|
|
const effectiveUsing = query.using ?? storedPrefs.using ?? null
|
|
const effectiveMethod = query.method ?? storedPrefs.method ?? null
|
|
const effectiveType = query.type ?? storedPrefs.type ?? null
|
|
const effectiveMcpClient = query.mcpClient ?? storedPrefs.mcpClient ?? null
|
|
const effectiveWarehouseQueryEngine =
|
|
query.warehouseQueryEngine ?? storedPrefs.warehouseQueryEngine ?? null
|
|
|
|
const mappedMode = mapConnectTabToMode(effectiveTab)
|
|
const mode = mappedMode && availableModeIds.includes(mappedMode) ? mappedMode : null
|
|
|
|
const fieldUpdates: ConnectSheetFieldUpdate[] = []
|
|
const urlUpdates: ConnectSheetUrlUpdates = {}
|
|
|
|
if (query.connectTab === null && effectiveTab) urlUpdates.connectTab = effectiveTab
|
|
|
|
if (mappedMode === 'framework') {
|
|
if (effectiveFramework) {
|
|
fieldUpdates.push({ fieldId: 'framework', value: effectiveFramework })
|
|
if (query.framework === null) urlUpdates.framework = effectiveFramework
|
|
if (effectiveUsing) {
|
|
fieldUpdates.push({ fieldId: 'frameworkVariant', value: effectiveUsing })
|
|
if (query.using === null) urlUpdates.using = effectiveUsing
|
|
}
|
|
}
|
|
} else if (mappedMode === 'orm') {
|
|
if (effectiveFramework) {
|
|
fieldUpdates.push({ fieldId: 'orm', value: effectiveFramework })
|
|
if (query.framework === null) urlUpdates.framework = effectiveFramework
|
|
}
|
|
} else if (mappedMode === 'direct') {
|
|
if (effectiveMethod) {
|
|
fieldUpdates.push({ fieldId: 'connectionMethod', value: effectiveMethod })
|
|
if (query.method === null) urlUpdates.method = effectiveMethod
|
|
}
|
|
if (effectiveType) {
|
|
fieldUpdates.push({ fieldId: 'connectionType', value: effectiveType })
|
|
if (query.type === null) urlUpdates.type = effectiveType
|
|
}
|
|
} else if (mappedMode === 'mcp') {
|
|
if (effectiveMcpClient) {
|
|
fieldUpdates.push({ fieldId: 'mcpClient', value: effectiveMcpClient })
|
|
if (query.mcpClient === null) urlUpdates.mcpClient = effectiveMcpClient
|
|
}
|
|
} else if (
|
|
mappedMode === 'warehouse' &&
|
|
(effectiveWarehouseQueryEngine === 'flightsql' || effectiveWarehouseQueryEngine === 'duckdb')
|
|
) {
|
|
if (query.warehouseQueryEngine === null) {
|
|
urlUpdates.warehouseQueryEngine = effectiveWarehouseQueryEngine
|
|
}
|
|
}
|
|
|
|
return { mode, fieldUpdates, urlUpdates }
|
|
}
|