mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
## What kind of change does this PR introduce? Studio UI and interaction polish. This is the second PR in the Pipelines review stack and depends on #50251. ## What is the current behaviour? Pipeline rows require a separate view action, cannot be sorted, and present lifecycle, lag, and destination terminology inconsistently. ## What is the new behaviour? Makes rows navigable with link-like mouse and keyboard behaviour, adds Name and Status sorting, reuses cached status queries, and moves row actions into the overflow menu. It also clarifies pipeline terminology, adds Docs and feedback actions, and standardises state, error, lag, and loading presentation with accessible announcements. | Before | After | | --- | --- | | <img width="1280" height="1323" alt="Replication Database ETL BigTable ETL Team Supabase" src="https://github.com/user-attachments/assets/53a62283-0e58-4408-8409-2b87a38af159" /> | <img width="1280" height="1323" alt="Replication Database Agua Basket Supabase" src="https://github.com/user-attachments/assets/ba4de1e0-4a84-43b4-8975-ca05a3056bcf" /> | ## To test 1. Open `/project/<ref>/database/replication`. 2. Sort by Name and Status, then confirm failed and stopped pipelines surface first when Status is ascending. 3. Click a row, use Enter or Space, and modifier-click or middle-click to verify link behaviour. 4. Open the row overflow menu and confirm it does not navigate. 5. Check loading, initial sync, caught up, numeric lag, unavailable lag, and table-error states where available. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added sortable pipeline lists with clearer loading, empty, and error states. - Pipeline rows now support direct navigation, detail viewing, status indicators, lag progress, and table error summaries. - Added initial-sync progress indicators and accessible status announcements. - Added documentation and feedback links. - Improved pipeline version update and enable/disable dialogs. - **Bug Fixes** - Prevented right-clicks from triggering navigation. - Improved unavailable lag and initial-sync handling. - **Style** - Standardized replication terminology and confirmation messaging around pipelines. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
142 lines
4.7 KiB
TypeScript
142 lines
4.7 KiB
TypeScript
import { useParams } from 'common'
|
||
import { useState } from 'react'
|
||
import { toast } from 'sonner'
|
||
import {
|
||
Button,
|
||
cn,
|
||
Dialog,
|
||
DialogContent,
|
||
DialogDescription,
|
||
DialogFooter,
|
||
DialogHeader,
|
||
DialogSection,
|
||
DialogSectionSeparator,
|
||
DialogTitle,
|
||
DialogTrigger,
|
||
} from 'ui'
|
||
|
||
import { DestinationType } from './DestinationPanel/DestinationPanel.types'
|
||
import { DocsButton } from '@/components/ui/DocsButton'
|
||
import { InlineLink } from '@/components/ui/InlineLink'
|
||
import { UpgradePlanButton } from '@/components/ui/UpgradePlanButton'
|
||
import { useCreateTenantSourceMutation } from '@/data/replication/create-tenant-source-mutation'
|
||
import { useCheckEntitlements } from '@/hooks/misc/useCheckEntitlements'
|
||
import { DOCS_URL } from '@/lib/constants'
|
||
|
||
type EnablePipelinesModalProps =
|
||
| { open: boolean; onOpenChange: (open: boolean) => void }
|
||
| { open?: never; onOpenChange?: never }
|
||
|
||
export const EnablePipelinesModal = ({
|
||
open: extOpen,
|
||
onOpenChange,
|
||
}: EnablePipelinesModalProps) => {
|
||
const { ref: projectRef } = useParams()
|
||
const [_open, _setOpen] = useState(false)
|
||
|
||
const open = extOpen ?? _open
|
||
const setOpen = onOpenChange ?? _setOpen
|
||
const hideTrigger = extOpen !== undefined && onOpenChange !== undefined
|
||
|
||
const { hasAccess } = useCheckEntitlements('replication.etl')
|
||
|
||
const { mutate: createTenantSource, isPending: creatingTenantSource } =
|
||
useCreateTenantSourceMutation({
|
||
onSuccess: () => {
|
||
toast.success('Pipelines has been successfully enabled!')
|
||
setOpen(false)
|
||
},
|
||
onError: (error) => {
|
||
toast.error(`Failed to enable Pipelines: ${error.message}`)
|
||
},
|
||
})
|
||
|
||
const onEnablePipelines = async () => {
|
||
if (!projectRef) return console.error('Project ref is required')
|
||
createTenantSource({ projectRef })
|
||
}
|
||
|
||
return (
|
||
<Dialog open={open} onOpenChange={setOpen}>
|
||
{!hideTrigger && (
|
||
<DialogTrigger asChild>
|
||
<Button variant="primary" className="w-min">
|
||
Enable Pipelines
|
||
</Button>
|
||
</DialogTrigger>
|
||
)}
|
||
<DialogContent size="small">
|
||
<DialogHeader>
|
||
<DialogTitle>Enable Pipelines</DialogTitle>
|
||
<DialogDescription>
|
||
{hasAccess
|
||
? 'Enabling creates Pipelines resources for this project.'
|
||
: 'Upgrade to the Pro plan to replicate database changes to data warehouses and analytics platforms.'}
|
||
</DialogDescription>
|
||
</DialogHeader>
|
||
{hasAccess && (
|
||
<>
|
||
<DialogSectionSeparator />
|
||
<DialogSection className="flex flex-col gap-y-3">
|
||
<p className="text-sm text-foreground-light">
|
||
Pipelines is in public alpha and may change as we refine it.
|
||
</p>
|
||
<p className="text-sm text-foreground-light">
|
||
You’ll be billed for configured pipeline hours and for Postgres row data processed
|
||
during initial sync and ongoing replication. Review{' '}
|
||
<InlineLink href={`${DOCS_URL}/guides/platform/manage-your-usage/pipelines`}>
|
||
Pipelines pricing
|
||
</InlineLink>{' '}
|
||
before enabling.
|
||
</p>
|
||
</DialogSection>
|
||
</>
|
||
)}
|
||
<DialogFooter>
|
||
<Button disabled={creatingTenantSource} onClick={() => setOpen(false)}>
|
||
Cancel
|
||
</Button>
|
||
{hasAccess ? (
|
||
<Button variant="primary" loading={creatingTenantSource} onClick={onEnablePipelines}>
|
||
Enable Pipelines
|
||
</Button>
|
||
) : (
|
||
<UpgradePlanButton source="replication" featureProposition="use replication" />
|
||
)}
|
||
</DialogFooter>
|
||
</DialogContent>
|
||
</Dialog>
|
||
)
|
||
}
|
||
|
||
export const EnablePipelinesCallout = ({
|
||
type,
|
||
className,
|
||
}: {
|
||
type?: DestinationType | null
|
||
className?: string
|
||
}) => {
|
||
const { hasAccess } = useCheckEntitlements('replication.etl')
|
||
|
||
return (
|
||
<div className={cn('border rounded-md p-4 md:p-12 flex flex-col gap-y-4', className)}>
|
||
<div className="flex flex-col gap-y-1">
|
||
<h4>Enable Pipelines</h4>
|
||
<p className="text-sm text-foreground-light">
|
||
Supabase Pipelines replicates database changes to supported destination systems.{' '}
|
||
{hasAccess ? 'Enable Pipelines for your project' : 'Upgrade to the Pro plan'} to replicate
|
||
database changes to {type ?? 'data warehouses and analytics platforms'}.
|
||
</p>
|
||
</div>
|
||
<div className="flex gap-x-2">
|
||
{hasAccess ? (
|
||
<EnablePipelinesModal />
|
||
) : (
|
||
<UpgradePlanButton source="replication" featureProposition="use replication" />
|
||
)}
|
||
<DocsButton href={`${DOCS_URL}/guides/database/replication#pipelines`} />
|
||
</div>
|
||
</div>
|
||
)
|
||
}
|