Files
supabase/apps/studio/components/interfaces/Database/Replication/PipelineStatePill.tsx
Danny White 5951fb6c47 fix(studio): polish Pipelines loading and update cues (#50963)
## Problem

Pipelines loading causes layout shifts, and the update cue is hard to
connect to its menu action.

- Resolves
[PIPE-1078](https://linear.app/supabase/issue/PIPE-1078/show-destination-rows-while-details-are-loading)
- Resolves
[DEPR-688](https://linear.app/supabase/issue/DEPR-688/widen-the-update-available-modal)
- Resolves
[DEPR-691](https://linear.app/supabase/issue/DEPR-691/clarify-the-update-available-indicator-in-pipeline-actions)

## Solution

Reserve space for the graph and list while loading, show destination
rows before their details arrive, align the detail header, and stack
version values in the update dialog. Match the primary-colour dot on the
options button and its Update available menu item. Give the status
tooltip more room.

| Before | After |
| --- | --- |
| <img width="408" height="346" alt="8294"
src="https://github.com/user-attachments/assets/9a44dfe0-5473-4809-b705-fd6077efe44b"
/> | <img width="844" height="738" alt="CleanShot 2026-09-28 at 17 10
34@2x"
src="https://github.com/user-attachments/assets/4eba3f16-6dc4-4c02-83b4-9689203859bd"
/> |


| After |
| --- |
| <img width="426" height="472" alt="CleanShot 2026-09-28 at 17 11
27@2x"
src="https://github.com/user-attachments/assets/8b3c181c-b48e-4803-a24a-fb7dce3957d4"
/> |
| _Links ambiguous dot to dropdown menu item_  |
| <img width="1942" height="262" alt="CleanShot 2026-09-28 at 17 29
18@2x"
src="https://github.com/user-attachments/assets/efc047bb-a8ea-4041-bd0d-fa2cb15f4414"
/> |
| _Better alignment with nav bar above it_ |

## Review instructions

1. Reload Database > Pipelines and check the loading layout and
destination rows.
2. Open a pipeline detail page and check its header, update dialog, and
matching update dots.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Destination rows now appear while pipeline details are loading, with
controls becoming available when the details finish loading.

* **Style**
* Loading states on the replication page now use diagram and
table-shaped placeholders.
* Updated replication page spacing, version-status tooltips, update
indicators, and the version comparison layout.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-29 11:42:58 +10:00

92 lines
3.1 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 '@/components/ui/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 isRequestPending = requestStatus !== PipelineStatusRequestStatus.None
const shouldShowError = isError && !isRequestPending
const shouldShowLogsHint =
isSuccess &&
!isRequestPending &&
[PipelineStatusName.UNKNOWN, PipelineStatusName.FAILED].includes(
statusName as PipelineStatusName
)
if (isLoading && !isRequestPending) {
return (
<span className="inline-flex" aria-live="polite" aria-atomic="true">
<span className="sr-only">Loading pipeline status</span>
<ShimmeringLoader className="w-20" />
</span>
)
}
let tooltipMessage = message
if (shouldShowError) {
tooltipMessage = `Unable to retrieve status: ${error?.message}`
} else if (shouldShowLogsHint) {
tooltipMessage = `${message}. Check the logs for more information.`
}
return (
<span className="inline-flex" aria-live="polite" aria-atomic="true">
<Tooltip>
<TooltipTrigger asChild>
<StateDot
tabIndex={0}
variant={shouldShowError ? 'default' : VARIANT_BY_TYPE[type]}
isPulsing={!shouldShowError && type === 'loading'}
labelClassName={cn('text-foreground-light', TOOLTIP_UNDERLINE_CLASS_NAME)}
>
{shouldShowError ? 'Unknown' : label}
</StateDot>
</TooltipTrigger>
<TooltipContent side="bottom" className="max-w-64">
{tooltipMessage}
{isError && isRequestPending && ` Unable to refresh status: ${error?.message}.`}
</TooltipContent>
</Tooltip>
</span>
)
}