Files
Danny White c856de8fda fix(studio): polish pipeline creation copy and actions (#50956)
## Problem

The current pipeline creation sheet describes destination type with two
disconnected sentences. The enablement callout repeats itself, while
three Pipelines action menus have undersized triggers.

## Solution

Use a complete destination-specific description for each release stage.
Present the Enable Pipelines callout as a note with an action title, a
short explanation, and one button. Clarify the enablement dialog copy
and align the three action-menu triggers with a consistent button width
and hit area.

| Before | After |
| --- | --- |
| <img width="1024" height="759" alt="Pipelines Database Sandals Field
Lab Supabase"
src="https://github.com/user-attachments/assets/fac744dd-2701-40ae-a65d-0801a1a86e6f"
/> | <img width="1024" height="759" alt="Pipelines Database Sandals
Field Lab Supabase"
src="https://github.com/user-attachments/assets/075bf609-5b65-40ca-8aaf-d27335d48838"
/> |
| <img width="1024" height="759" alt="18436"
src="https://github.com/user-attachments/assets/92f8c63b-f9b9-4dd6-b9b6-26ede932c172"
/> | <img width="1076" height="759" alt="93893"
src="https://github.com/user-attachments/assets/3c6f26b0-130c-4508-bf6b-d2c641805426"
/> |
| <img width="1024" height="759" alt="16935"
src="https://github.com/user-attachments/assets/63e75045-412a-4bcc-9cf9-20245ac60871"
/> | <img width="1024" height="759" alt="75021"
src="https://github.com/user-attachments/assets/09771e1e-2e89-466d-8f60-22c5bacc9956"
/> |

## Review instructions

1. Open [Database > Pipelines in the Studio
preview](https://studio-staging-git-dnywh-fixpipelines-creation-polish-supabase.vercel.app/dashboard/project/_/database/pipelines),
click **Add pipeline**, and select BigQuery or Snowflake. Confirm the
Type description reads as a complete sentence.
2. On a project where Pipelines is not enabled, open the creation sheet.
Confirm the note has no extra padding or Docs link, then click
**Enable** and check the dialog copy. The list menu's **Enable
Pipelines** action opens the same dialog.
3. Check the action-menu triggers on the Pipelines list, pipeline detail
page, and table row for consistent sizing and click targets.

## 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

* **User Experience**
* Replication setup now displays a loading state while access and
organization details are checked, then shows the appropriate access
request, enablement notice, or destination form.
* Access notices use clearer, responsive messaging with a primary
“Request access” link.
* Enablement messaging now reflects whether your plan includes access,
and the success notification is shorter.
* Destination-type notices now identify the selected type and clarify
that it cannot be changed after creation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-28 17:34:10 +10:00

241 lines
7.7 KiB
TypeScript

import { useParams } from 'common'
import {
ArrowUpCircle,
CircleStop,
Edit,
Eye,
MoreVertical,
Play,
RotateCcw,
Trash,
} from 'lucide-react'
import Link from 'next/link'
import { parseAsInteger, useQueryState } from 'nuqs'
import { toast } from 'sonner'
import {
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
Tooltip,
TooltipContent,
TooltipTrigger,
WarningIcon,
} from 'ui'
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'
import { getStatusName } from './Pipeline.utils'
import { PipelineStatusName } from './Replication.constants'
import { ReplicationPipelineStatusData } from '@/data/replication/pipeline-status-query'
import { Pipeline } from '@/data/replication/pipelines-query'
import { useRestartPipelineMutation } from '@/data/replication/restart-pipeline-mutation'
import { useStartPipelineMutation } from '@/data/replication/start-pipeline-mutation'
import { useStopPipelineMutation } from '@/data/replication/stop-pipeline-mutation'
import {
PipelineStatusRequestStatus,
usePipelineRequestStatus,
} from '@/state/replication-pipeline-request-status'
import type { ResponseError } from '@/types'
interface RowMenuProps {
destinationId: number
pipeline: Pipeline | undefined
pipelineStatus?: ReplicationPipelineStatusData['status']
error: ResponseError | null
isLoading: boolean
isError: boolean
hasUpdate?: boolean
onDeleteClick: () => void
onUpdateClick?: () => void
}
export const RowMenu = ({
destinationId,
pipeline,
pipelineStatus,
error,
isLoading,
isError,
hasUpdate = false,
onDeleteClick,
onUpdateClick,
}: RowMenuProps) => {
const { ref: projectRef } = useParams()
const statusName = getStatusName(pipelineStatus)
const [, setEdit] = useQueryState(
'edit',
parseAsInteger.withOptions({ history: 'push', clearOnDefault: true })
)
const { mutateAsync: startPipeline } = useStartPipelineMutation({ onError: () => {} })
const { mutateAsync: stopPipeline } = useStopPipelineMutation({ onError: () => {} })
const { mutateAsync: restartPipeline } = useRestartPipelineMutation()
const { getRequestStatus, isRequestPending, runWithRequestStatus } = usePipelineRequestStatus()
const requestStatus = pipeline?.id
? getRequestStatus(pipeline.id)
: PipelineStatusRequestStatus.None
const isPipelineRequestPending = !!pipeline && isRequestPending(pipeline.id)
// Show actions when not in a transitional state
const canPerformActions =
!isError &&
!!pipeline &&
!isPipelineRequestPending &&
requestStatus === PipelineStatusRequestStatus.None &&
statusName !== PipelineStatusName.STARTING &&
[PipelineStatusName.STOPPED, PipelineStatusName.STARTED, PipelineStatusName.FAILED].includes(
statusName as PipelineStatusName
)
// Show both stop and restart for started/failed states
const showStopAndRestart =
canPerformActions &&
(statusName === PipelineStatusName.STARTED || statusName === PipelineStatusName.FAILED)
// Show only start for stopped state
const showStart = canPerformActions && statusName === PipelineStatusName.STOPPED
const onEnablePipeline = async () => {
if (!projectRef) return console.error('Project ref is required')
if (!pipeline) return toast.error('No pipeline found')
try {
await runWithRequestStatus(pipeline.id, PipelineStatusRequestStatus.StartRequested, () =>
startPipeline({ projectRef, pipelineId: pipeline.id })
)
} catch (error) {
toast.error(`Failed to start pipeline: ${(error as ResponseError).message}`)
}
}
const onDisablePipeline = async () => {
if (!projectRef) return console.error('Project ref is required')
if (!pipeline) return toast.error('No pipeline found')
try {
await runWithRequestStatus(pipeline.id, PipelineStatusRequestStatus.StopRequested, () =>
stopPipeline({ projectRef, pipelineId: pipeline.id })
)
} catch (error) {
toast.error(`Failed to stop pipeline: ${(error as ResponseError).message}`)
}
}
const onRestartPipeline = async () => {
if (!projectRef) return console.error('Project ref is required')
if (!pipeline) return toast.error('No pipeline found')
try {
await runWithRequestStatus(pipeline.id, PipelineStatusRequestStatus.StopRequested, () =>
restartPipeline({ projectRef, pipelineId: pipeline.id })
)
} catch (error) {
toast.error(`Failed to restart pipeline: ${(error as ResponseError).message}`)
}
}
return (
<div className="flex justify-end items-center space-x-2">
{isLoading && <ShimmeringLoader />}
{isError && (
<Tooltip>
<TooltipTrigger asChild>
<span className="flex items-center" tabIndex={0}>
<WarningIcon />
</span>
</TooltipTrigger>
<TooltipContent side="bottom" className="max-w-xs">
Couldn't load status{error?.message ? `: ${error.message}` : '.'}
</TooltipContent>
</Tooltip>
)}
<DropdownMenu>
<DropdownMenuTrigger asChild>
<div className="relative">
<Button
variant="default"
className="w-6.5 hit-area-1"
aria-label={hasUpdate ? 'Pipeline options, update available' : 'Pipeline options'}
icon={<MoreVertical />}
/>
{hasUpdate && (
<span
className="absolute -top-0.5 -right-0.5 h-2 w-2 bg-primary-bright rounded-full"
aria-hidden
/>
)}
</div>
</DropdownMenuTrigger>
<DropdownMenuContent side="bottom" align="end" className="w-44">
<DropdownMenuItem className="space-x-2" asChild disabled={!pipeline}>
<Link href={`/project/${projectRef}/database/pipelines/${pipeline?.id}`}>
<Eye size={14} />
<p>View details</p>
</Link>
</DropdownMenuItem>
<DropdownMenuSeparator />
{hasUpdate && (
<>
<DropdownMenuItem
className="space-x-2"
onClick={() => onUpdateClick?.()}
disabled={isPipelineRequestPending}
>
<ArrowUpCircle size={14} />
<p>Update available</p>
</DropdownMenuItem>
<DropdownMenuSeparator />
</>
)}
{showStart && (
<>
<DropdownMenuItem className="space-x-2" onClick={onEnablePipeline}>
<Play size={14} />
<p>Start pipeline</p>
</DropdownMenuItem>
<DropdownMenuSeparator />
</>
)}
{showStopAndRestart && (
<>
<DropdownMenuItem className="space-x-2" onClick={onRestartPipeline}>
<RotateCcw size={14} />
<p>Restart pipeline</p>
</DropdownMenuItem>
<DropdownMenuItem className="space-x-2" onClick={onDisablePipeline}>
<CircleStop size={14} />
<p>Stop pipeline</p>
</DropdownMenuItem>
<DropdownMenuSeparator />
</>
)}
<DropdownMenuItem
className="space-x-2"
onClick={() => setEdit(destinationId)}
disabled={isPipelineRequestPending}
>
<Edit size={14} />
<p>Edit pipeline</p>
</DropdownMenuItem>
<DropdownMenuItem
className="space-x-2"
onClick={onDeleteClick}
disabled={isPipelineRequestPending}
>
<Trash size={14} />
<p>Delete pipeline</p>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
)
}