Files
supabase/apps/studio/components/interfaces/Database/Replication/PipelineStatePill.tsx
T
Danny White 2e435986c9 feat(studio): polish the Replication pipelines list (#50252)
## 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 -->
2026-09-15 10:07:49 +10:00

83 lines
2.7 KiB
TypeScript

import { cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'
import { TOOLTIP_UNDERLINE_CLASS_NAME } from './DetailSubtext'
import { getPipelineDisplayState, getStatusName } from './Pipeline.utils'
import type { PipelineDisplayType } from './Pipeline.utils'
import { PipelineStatusName } from './Replication.constants'
import { StateDot, type StateDotVariant } from './StateDot'
import { ReplicationPipelineStatusData } from '@/data/replication/pipeline-status-query'
import { PipelineStatusRequestStatus } from '@/state/replication-pipeline-request-status'
import type { ResponseError } from '@/types'
const VARIANT_BY_TYPE: Record<PipelineDisplayType, StateDotVariant> = {
success: 'success',
failure: 'destructive',
loading: 'warning',
idle: 'default',
}
interface PipelineStatePillProps {
pipelineStatus: ReplicationPipelineStatusData['status'] | undefined
error: ResponseError | null
isLoading: boolean
isError: boolean
isSuccess: boolean
requestStatus?: PipelineStatusRequestStatus
projectRef?: string
pipelineId?: number
}
/**
* Status of a pipeline as a dot and label. The label carries a dotted underline because its
* explanation lives in the tooltip. Tooltips stay plain text (no links).
*/
export const PipelineStatePill = ({
pipelineStatus,
error,
isLoading,
isError,
isSuccess,
requestStatus,
}: PipelineStatePillProps) => {
const statusName = getStatusName(pipelineStatus)
const { type, message, label } = getPipelineDisplayState(requestStatus, statusName)
const showLogsHint =
isSuccess &&
[PipelineStatusName.UNKNOWN, PipelineStatusName.FAILED].includes(
statusName as PipelineStatusName
)
return (
<span className="inline-flex" aria-live="polite" aria-atomic="true">
{isLoading ? (
<>
<span className="sr-only">Loading pipeline status</span>
<ShimmeringLoader className="w-20" />
</>
) : (
<Tooltip>
<TooltipTrigger asChild>
<StateDot
tabIndex={0}
variant={isError ? 'default' : VARIANT_BY_TYPE[type]}
isPulsing={!isError && type === 'loading'}
labelClassName={cn('text-foreground-light', TOOLTIP_UNDERLINE_CLASS_NAME)}
>
{isError ? 'Unknown' : label}
</StateDot>
</TooltipTrigger>
<TooltipContent side="bottom" className="max-w-xs">
{isError
? `Unable to retrieve status: ${error?.message}`
: showLogsHint
? `${message}. Check the logs for more information.`
: message}
</TooltipContent>
</Tooltip>
)}
</span>
)
}