mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem Pipeline review shows validation failures below the cost estimate, far from the settings that need changes. Publication-loading failures also appear in several places with conflicting retry instructions. ## Solution Attach full-width errors and warnings to their Connection or Data sections. Keep the current scroll position and show description-only guidance above the footer. Consolidate publication-loading failures into one Data-step error with Continue to retry, preserving the existing sheet behaviour. _The main fix, spreading out the error and warnings to their respective sections:_ | Before | After | | --- | --- | | <img width="1280" height="1522" alt="New Pipeline Supabase" src="https://github.com/user-attachments/assets/36df1814-e73f-4440-b338-79b672431c60" /> | <img width="1280" height="1522" alt="15619" src="https://github.com/user-attachments/assets/08e39cdd-0e69-4318-b992-dfa81ad8a6c2" /> | | _All at bottom_ | _Attached to each section_ | _Misc fixes for API blocks:_ | Before | After | | --- | --- | | <img width="1516" height="1350" alt="CleanShot 2026-10-21 at 15 19 24@2x" src="https://github.com/user-attachments/assets/56ac9cf7-9c30-4129-8fbc-2708f35a51b9" /> | <img width="1520" height="1232" alt="CleanShot 2026-10-21 at 15 22 56@2x" src="https://github.com/user-attachments/assets/c4f4b039-38de-4af0-9bb9-b487ff6ddb63" /> | ## To test 1. Enable **Pipeline creation wizard** in Feature Previews and open `/project/<ref>/database/pipelines/new`. Complete Connection and Data to reach Review. 2. In Chrome DevTools → Network, right-click a captured POST ending `/replication/<ref>/destinations/validate` (Connection) or `/replication/<ref>/pipelines/validate` (Data), then select **Override content**. Reach Review before enabling the destination override. Keep HTTP status **200** and save: ```json {"validation_failures":[{"name":"Test validation issue","reason":"Test failure for the review screen.","failure_type":"critical"}]} ``` 3. Click **Start pipeline**. Expect a flush Admonition at the bottom of the matching section and danger guidance above the footer, without automatic scrolling. Change `critical` to `warning` to check warning guidance and **Start pipeline anyway**. Edit and retry to confirm values persist. 4. On Data, block the GET ending `/replication/v2/<ref>/sources/<id>/publications/<name>`. Expect one flush publication-loading failure above the footer, including with Advanced settings open. **Continue** retries; remove the block and retry to recover. 5. Check desktop and phone widths. Stop before confirming creation, then remove overrides and request blocks.
184 lines
6.5 KiB
TypeScript
184 lines
6.5 KiB
TypeScript
import { EditIcon } from 'lucide-react'
|
|
import { useWatch, type Control } from 'react-hook-form'
|
|
import { Button, Input } from 'ui'
|
|
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
|
|
|
|
import * as defaults from '../DestinationPanel/DestinationForm/DestinationForm.constants'
|
|
import type { DestinationPanelSchemaType } from '../DestinationPanel/DestinationForm/DestinationForm.schema'
|
|
import {
|
|
INITIAL_SYNC_FIELD_COPY,
|
|
INITIAL_SYNC_LABELS,
|
|
PUBLICATION_FIELD_COPY,
|
|
} from '../DestinationPanel/DestinationForm/DestinationFormFieldCopy'
|
|
import type { DestinationType } from '../DestinationPanel/DestinationPanel.types'
|
|
import { describeBigQueryTableLayout } from './PipelineReviewSummary.utils'
|
|
import { DATA_VALIDATION_HINT, PipelineValidationAdmonition } from './PipelineValidationAdmonition'
|
|
import type { ReplicationPublicationData } from '@/data/replication/publication-query'
|
|
import type { ValidationFailure } from '@/data/replication/validate-destination-mutation'
|
|
|
|
export const PipelineDataReview = ({
|
|
type,
|
|
control,
|
|
publication,
|
|
onEdit,
|
|
validationFailures = [],
|
|
}: {
|
|
type: DestinationType
|
|
control: Control<DestinationPanelSchemaType>
|
|
publication?: ReplicationPublicationData
|
|
onEdit?: () => void
|
|
validationFailures?: ValidationFailure[]
|
|
}) => {
|
|
const [publicationName, mode, ids, workers, copies, slot, batch, options] = useWatch({
|
|
control,
|
|
name: [
|
|
'publicationName',
|
|
'tableSyncCopyMode',
|
|
'tableSyncCopyTableIds',
|
|
'maxTableSyncWorkers',
|
|
'maxCopyConnectionsPerTable',
|
|
'invalidatedSlotBehavior',
|
|
'maxFillMs',
|
|
'tableOptions',
|
|
],
|
|
})
|
|
const tables = publication?.name === publicationName ? publication.tables : undefined
|
|
const rows: { label: string; value: string; description: string }[] = [
|
|
{ ...PUBLICATION_FIELD_COPY, value: publicationName || 'None selected' },
|
|
{
|
|
label: 'Publication tables',
|
|
description: 'Tables whose ongoing changes will be replicated to this destination.',
|
|
value: tables
|
|
? `${tables.length} ${tables.length === 1 ? 'table' : 'tables'}`
|
|
: 'Unavailable',
|
|
},
|
|
{
|
|
...INITIAL_SYNC_FIELD_COPY,
|
|
description:
|
|
'Controls which publication tables copy their existing rows. Ongoing replication includes new changes from every publication table, even when initial sync is skipped.',
|
|
value: INITIAL_SYNC_LABELS[mode] ?? 'Not set',
|
|
},
|
|
]
|
|
if (mode === 'include_tables' || mode === 'skip_tables') {
|
|
const selected = tables?.filter((table) => ids?.includes(String(table.id)))
|
|
rows.push({
|
|
label: mode === 'include_tables' ? 'Tables to include' : 'Tables to exclude',
|
|
description:
|
|
mode === 'include_tables'
|
|
? 'Only these tables copy their existing rows during initial sync. Ongoing changes from every publication table are replicated.'
|
|
: 'These tables skip copying existing rows during initial sync. Ongoing changes from every publication table are replicated.',
|
|
value: tables
|
|
? selected?.map(({ schema, name }) => `${schema}.${name}`).join(', ') || 'None selected'
|
|
: 'Unavailable',
|
|
})
|
|
}
|
|
const addNumber = (
|
|
label: string,
|
|
value: number | '' | undefined,
|
|
defaultValue: number,
|
|
description: string,
|
|
unit = ''
|
|
) => {
|
|
if (typeof value === 'number' && value !== defaultValue)
|
|
rows.push({ label, value: `${value}${unit}`, description })
|
|
}
|
|
addNumber(
|
|
'Batch wait time',
|
|
batch,
|
|
defaults.DEFAULT_MAX_FILL_MS,
|
|
'Maximum time before sending a partially filled batch.',
|
|
' milliseconds'
|
|
)
|
|
addNumber(
|
|
'Table sync workers',
|
|
workers,
|
|
defaults.DEFAULT_MAX_TABLE_SYNC_WORKERS,
|
|
'Maximum number of tables synced at the same time.'
|
|
)
|
|
addNumber(
|
|
'Initial sync connections per table',
|
|
copies,
|
|
defaults.DEFAULT_MAX_COPY_CONNECTIONS_PER_TABLE,
|
|
'Maximum number of source connections used to sync existing rows for each table.'
|
|
)
|
|
if (slot === 'recreate')
|
|
rows.push({
|
|
label: 'Invalidated slot behavior',
|
|
value: 'Recreate slot',
|
|
description:
|
|
'If the replication slot becomes invalid, the pipeline replaces destination tables and runs a new, billable initial sync.',
|
|
})
|
|
const layouts =
|
|
type === 'BigQuery'
|
|
? (options ?? []).filter(
|
|
(option) =>
|
|
tables?.some(({ id }) => id === option.tableId) &&
|
|
(option.partitionBy || option.clusterBy?.length)
|
|
)
|
|
: []
|
|
return (
|
|
<section aria-label="Data review">
|
|
<div className="space-y-6 p-5">
|
|
<div className="flex items-center justify-between gap-2">
|
|
<h3 className="text-sm font-medium text-foreground">Data</h3>
|
|
{onEdit && (
|
|
<Button
|
|
type="button"
|
|
icon={<EditIcon />}
|
|
size="tiny"
|
|
aria-label="Edit data"
|
|
onClick={onEdit}
|
|
>
|
|
Edit
|
|
</Button>
|
|
)}
|
|
</div>
|
|
{rows.map((row) => (
|
|
<ReviewField key={row.label} {...row} />
|
|
))}
|
|
{layouts.length > 0 && (
|
|
<FormItemLayout
|
|
isReactForm={false}
|
|
layout="horizontal"
|
|
label="Table layout"
|
|
description="Partitioning and clustering applied when destination tables are first created or reset."
|
|
>
|
|
<div className="min-w-0 space-y-3">
|
|
{layouts.map((option) => {
|
|
const table = tables?.find(({ id }) => id === option.tableId)
|
|
const name = table ? `${table.schema}.${table.name}` : `Table ${option.tableId}`
|
|
return (
|
|
<div
|
|
key={option.tableId}
|
|
className="min-w-0 rounded-md border bg-surface-200 p-3"
|
|
>
|
|
<p className="break-all text-sm text-foreground">{name}</p>
|
|
<p className="mt-1 break-words text-sm text-foreground-light">
|
|
{describeBigQueryTableLayout(option)}
|
|
</p>
|
|
</div>
|
|
)
|
|
})}
|
|
</div>
|
|
</FormItemLayout>
|
|
)}
|
|
</div>
|
|
<PipelineValidationAdmonition failures={validationFailures} hint={DATA_VALIDATION_HINT} />
|
|
</section>
|
|
)
|
|
}
|
|
|
|
const ReviewField = ({
|
|
label,
|
|
value,
|
|
description,
|
|
}: {
|
|
label: string
|
|
value: string
|
|
description: string
|
|
}) => (
|
|
<FormItemLayout isReactForm={false} layout="horizontal" label={label} description={description}>
|
|
<Input readOnly aria-label={label} value={value} />
|
|
</FormItemLayout>
|
|
)
|