mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
## What kind of change does this PR introduce? Bug fix and UI polish. ## What is the current behavior? The Warehouse Connect option repeats its own name, and a configured Warehouse has no direct route back to its management page. Warehouse table states also use badges instead of the status-dot pattern used by Replication, and a backfilling table can misleadingly appear as “Caught up”. ## What is the new behavior? - Describes Warehouse as an analytical endpoint and adds a low-emphasis “Manage Warehouse” link from the Connect sheet. - Shares Replication’s status-dot presentation with Warehouse while keeping feature-specific state mapping separate. - Shows replication lag only for live tables, so backfilling and “Caught up” are never presented together. | Before | After | | --- | --- | | <img width="1244" height="1156" alt="CleanShot 2026-09-18 at 14 03 49@2x" src="https://github.com/user-attachments/assets/60aa3496-6930-491a-af9e-9ffcfb035a0f" /> | <img width="1216" height="1214" alt="CleanShot 2026-09-18 at 14 04 33@2x" src="https://github.com/user-attachments/assets/84a8c80e-d8d1-4ee5-9cce-352d1f6477c2" /> | | <img width="1314" height="1414" alt="CleanShot 2026-09-18 at 14 02 50@2x" src="https://github.com/user-attachments/assets/8871a4a5-0543-4290-91a7-9da949ec4c49" /> | <img width="1308" height="1498" alt="CleanShot 2026-09-18 at 14 02 43@2x" src="https://github.com/user-attachments/assets/ac3fc6d1-5b4d-4a3a-8ab7-bb54025e2145" /> | ## To test 1. Open `/project/<ref>?showConnect=true&connectTab=warehouse` for a project with Warehouse configured. Confirm the mode subtitle says “Analytical endpoint”. Confirm the new “Manage Warehouse” button opens `/project/<ref>/integrations/warehouse/overview`. 2. Open `/project/<ref>/integrations/warehouse/overview` while a table is backfilling. Confirm it has a pulsing amber status dot and does not show “Caught up”. 3. Once the table is live, confirm it has a green “Live” status dot and its lag appears normally. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added clearer Warehouse setup progress messaging with a “View progress” action while setup is running. - Connection details are shown once the Warehouse is provisioned or has live tables. - Added a Cancel action when editing changed Warehouse table selections. - Updated table statuses with live, syncing, and warning indicators, including animated syncing states. - Lag details are displayed for live tables when available. - Renamed the Warehouse connection option to “Analytical endpoint.” - **Style** - Improved Warehouse management controls and table name readability. - Removed the table Size column from the Warehouse overview. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
132 lines
4.4 KiB
TypeScript
132 lines
4.4 KiB
TypeScript
import { useParams } from 'common'
|
|
import Link from 'next/link'
|
|
import { Button } from 'ui'
|
|
import { Admonition } from 'ui-patterns/Admonition'
|
|
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
|
|
|
|
import {
|
|
isWarehouseProvisioned,
|
|
isWarehouseSettingUp,
|
|
type WarehouseSetupStatus,
|
|
} from '../Integrations/Warehouse/Warehouse.utils'
|
|
import { WarehouseConnectionCard } from '../Integrations/Warehouse/WarehouseConnectSection'
|
|
import { AlertError } from '@/components/ui/AlertError'
|
|
import { checkLocalETLNotSetUp } from '@/data/replication/utils'
|
|
import { useWarehouseSetupStatusQuery } from '@/data/warehouse/warehouse-setup-status-query'
|
|
|
|
const getNotProvisionedContent = (setupStatus?: WarehouseSetupStatus) => {
|
|
if (isWarehouseSettingUp(setupStatus)) {
|
|
return {
|
|
type: 'default' as const,
|
|
title: 'Warehouse is being set up',
|
|
description: 'Connection details appear here once the first backfill finishes.',
|
|
action: 'View progress',
|
|
}
|
|
}
|
|
|
|
if (setupStatus === 'error') {
|
|
return {
|
|
type: 'warning' as const,
|
|
title: 'Warehouse setup failed',
|
|
description: 'Review the error and retry setup to get connection details.',
|
|
action: 'View Warehouse',
|
|
}
|
|
}
|
|
|
|
return {
|
|
type: 'default' as const,
|
|
title: 'Warehouse is not set up',
|
|
description: 'Choose which schemas or tables to replicate in order to connect to Warehouse.',
|
|
action: 'Choose tables',
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Read-only view of the Warehouse connection details. Setting Warehouse up, changing which tables
|
|
* replicate, and disabling it all live on the Warehouse integration instead.
|
|
*/
|
|
export const WarehouseTab = () => {
|
|
const { ref: projectRef } = useParams()
|
|
const { data, isPending, isFetching, isError, error, refetch } = useWarehouseSetupStatusQuery({
|
|
projectRef,
|
|
})
|
|
const hasLiveTables = data?.tables.some((table) => table.state === 'live') ?? false
|
|
const canShowConnectionDetails =
|
|
data?.setup_status !== 'error' && (isWarehouseProvisioned(data?.setup_status) || hasLiveTables)
|
|
|
|
let content: React.ReactNode
|
|
|
|
if (isPending) content = <GenericSkeletonLoader />
|
|
// Warehouse rides on the replication API, which isn't wired up in local development. Same
|
|
// treatment Pipelines gives it, so a local dev doesn't read this as a broken build.
|
|
else if (isError && checkLocalETLNotSetUp(error)) {
|
|
content = (
|
|
<Admonition
|
|
type="default"
|
|
title="Warehouse is unavailable locally"
|
|
description="Configure the replication API to set up Warehouse in local development."
|
|
/>
|
|
)
|
|
} else if (isError) {
|
|
content = (
|
|
<AlertError
|
|
subject="Failed to load Warehouse status"
|
|
error={error}
|
|
additionalActions={
|
|
<Button variant="default" loading={isFetching} onClick={() => refetch()}>
|
|
Retry
|
|
</Button>
|
|
}
|
|
/>
|
|
)
|
|
} else if (!canShowConnectionDetails) {
|
|
const { type, title, description, action } = getNotProvisionedContent(data?.setup_status)
|
|
|
|
content = (
|
|
<Admonition
|
|
type={type}
|
|
layout="responsive"
|
|
title={title}
|
|
description={description}
|
|
actions={[
|
|
<Button key="open-warehouse" asChild variant="default">
|
|
<Link href={`/project/${projectRef}/integrations/warehouse/overview`}>{action}</Link>
|
|
</Button>,
|
|
]}
|
|
/>
|
|
)
|
|
} else {
|
|
return (
|
|
<div>
|
|
{isWarehouseSettingUp(data?.setup_status) && (
|
|
<div className="px-8 pt-8">
|
|
<Admonition
|
|
type="default"
|
|
layout="responsive"
|
|
title="Warehouse setup is still running"
|
|
description="Some tables are ready to query. The remaining tables will become available as their backfills finish."
|
|
actions={[
|
|
<Button key="view-progress" asChild variant="default">
|
|
<Link href={`/project/${projectRef}/integrations/warehouse/overview`}>
|
|
View progress
|
|
</Link>
|
|
</Button>,
|
|
]}
|
|
/>
|
|
</div>
|
|
)}
|
|
<WarehouseConnectionCard variant="sheet" />
|
|
<div className="border-t px-8 py-4">
|
|
<Button asChild variant="default" size="tiny">
|
|
<Link href={`/project/${projectRef}/integrations/warehouse/overview`}>
|
|
Manage Warehouse
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return <div className="p-8">{content}</div>
|
|
}
|