mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 00:19:08 +00:00
keep table recovery near its context and balance diagram spacing
This commit is contained in:
1 parent
f8a40cdae4
commit
ae13d251ce
6 files changed
+16
-29
No files matched your search
@@ -1,5 +1,3 @@
|
||||
import { createContext } from 'react'
|
||||
|
||||
export const PipelineNoticeContext = createContext(false)
|
||||
|
||||
export const PipelineTableNoticeContext = createContext<HTMLDivElement | null>(null)
|
||||
@@ -107,7 +107,7 @@ export const ReplicationDiagram = ({
|
||||
)
|
||||
).values(),
|
||||
]
|
||||
const regionHeights = regions.map(({ entries }) => (isCompact ? 88 : 60 + entries.length * 56))
|
||||
const regionHeights = regions.map(({ entries }) => (isCompact ? 88 : 48 + entries.length * 64))
|
||||
const regionsHeight = regionHeights.reduce((total, height) => total + height + 32, -32)
|
||||
const destinationsHeight = (destinations.length - 1) * 112 + 64
|
||||
const contentHeight = Math.max(regionsHeight, destinationsHeight)
|
||||
@@ -150,7 +150,7 @@ export const ReplicationDiagram = ({
|
||||
? undefined
|
||||
: entries.map(({ pipeline }, index) => ({
|
||||
id: pipeline.id,
|
||||
top: pipelineId ? 32 : 77 + index * 56,
|
||||
top: pipelineId ? 32 : 77 + index * 64,
|
||||
})),
|
||||
content: (
|
||||
<>
|
||||
@@ -158,11 +158,11 @@ export const ReplicationDiagram = ({
|
||||
{isCompact ? (
|
||||
<p className="border-t border-muted px-1 pt-3 pb-1 text-foreground-light">{`${entries.length} ${entries.length === 1 ? 'pipeline' : 'pipelines'}`}</p>
|
||||
) : (
|
||||
<div className="border-t border-muted pt-1">
|
||||
<div className="border-t border-muted">
|
||||
{entries.map(({ pipeline }) => (
|
||||
<div
|
||||
key={pipeline.id}
|
||||
className="flex h-14 flex-col justify-center border-b border-muted last:border-b-0"
|
||||
className="flex h-16 flex-col justify-center border-b border-muted border-dotted last:h-14 last:justify-end last:border-b-0"
|
||||
>
|
||||
{pipelineId ? (
|
||||
<div className="flex h-12 flex-col justify-center gap-0.25 px-2">
|
||||
|
||||
+2
-11
@@ -62,7 +62,7 @@ import {
|
||||
getRestartRequestStatus,
|
||||
getStatusName,
|
||||
} from './Pipeline.utils'
|
||||
import { PipelineNoticeContext, PipelineTableNoticeContext } from './PipelineNoticeContext'
|
||||
import { PipelineNoticeContext } from './PipelineNoticeContext'
|
||||
import { PipelineStatePill } from './PipelineStatePill'
|
||||
import { PipelineStatusName } from './Replication.constants'
|
||||
import { ReplicationDiagram } from './ReplicationDiagram'
|
||||
@@ -130,7 +130,6 @@ export const ReplicationPipelineLayout = ({ children }: PropsWithChildren) => {
|
||||
const [showUpdateVersionModal, setShowUpdateVersionModal] = useState(false)
|
||||
const [showDeleteDestination, setShowDeleteDestination] = useState(false)
|
||||
const [isDeleting, setIsDeleting] = useState(false)
|
||||
const [tableNoticeTarget, setTableNoticeTarget] = useState<HTMLDivElement | null>(null)
|
||||
const [, setEdit] = useQueryState(
|
||||
'edit',
|
||||
parseAsInteger.withOptions({ history: 'push', clearOnDefault: true })
|
||||
@@ -189,8 +188,6 @@ export const ReplicationPipelineLayout = ({ children }: PropsWithChildren) => {
|
||||
{ projectRef, pipelineId },
|
||||
{ enabled: !!pipelineId }
|
||||
)
|
||||
const hasTableErrors =
|
||||
replicationStatusData?.table_statuses.some(({ state }) => state.name === 'error') === true
|
||||
const lag = getFormattedLagValue(
|
||||
'bytes',
|
||||
replicationStatusData?.apply_lag?.confirmed_flush_lsn_bytes
|
||||
@@ -598,10 +595,6 @@ export const ReplicationPipelineLayout = ({ children }: PropsWithChildren) => {
|
||||
description="We can’t reach this pipeline right now. We’re retrying automatically."
|
||||
/>
|
||||
)}
|
||||
{hasTableErrors &&
|
||||
statusName === PipelineStatusName.STARTED &&
|
||||
!isTransitioning &&
|
||||
!isLagError && <div ref={setTableNoticeTarget} />}
|
||||
<ReplicationDiagram pipelineId={pipeline.id} clusterId={clusterId} />
|
||||
<PageSection className="pt-6 last:pb-0">
|
||||
<PageSectionMeta>
|
||||
@@ -670,9 +663,7 @@ export const ReplicationPipelineLayout = ({ children }: PropsWithChildren) => {
|
||||
)}
|
||||
|
||||
<PipelineNoticeContext.Provider value={true}>
|
||||
<PipelineTableNoticeContext.Provider value={tableNoticeTarget}>
|
||||
{!isUnknownDestination && (canModify || pipelineError) && children}
|
||||
</PipelineTableNoticeContext.Provider>
|
||||
{!isUnknownDestination && (canModify || pipelineError) && children}
|
||||
</PipelineNoticeContext.Provider>
|
||||
|
||||
<DestinationPanel />
|
||||
|
||||
+2
-8
@@ -3,7 +3,6 @@ import { ActivityIcon, ChevronDownIcon, RotateCcwIcon, SearchIcon, XIcon } from
|
||||
import Link from 'next/link'
|
||||
import { parseAsString, useQueryState } from 'nuqs'
|
||||
import { useContext, useMemo, useState } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
@@ -40,7 +39,7 @@ import {
|
||||
getPipelineUnifiedLogsUrl,
|
||||
getStatusName,
|
||||
} from '../Pipeline.utils'
|
||||
import { PipelineNoticeContext, PipelineTableNoticeContext } from '../PipelineNoticeContext'
|
||||
import { PipelineNoticeContext } from '../PipelineNoticeContext'
|
||||
import { PipelineStatusName } from '../Replication.constants'
|
||||
import { RestartTableDialog } from '../RestartTableDialog'
|
||||
import { PipelineHealthSection } from './PipelineHealthSection'
|
||||
@@ -232,7 +231,6 @@ export const ReplicationPipelineStatus = () => {
|
||||
const showDisabledState = isPipelineBusy || !isPipelineActionable
|
||||
const canResetErroredTables = hasErroredTables && !showDisabledState
|
||||
const isNoticeAboveOverview = useContext(PipelineNoticeContext)
|
||||
const tableNoticeTarget = useContext(PipelineTableNoticeContext)
|
||||
const stateNotice = getPipelineStateNotice({ requestStatus, statusName, tableStatuses })
|
||||
const isSlotDisconnected =
|
||||
!isStatusError && statusName === PipelineStatusName.STARTED && applyLagMetrics?.active === false
|
||||
@@ -277,9 +275,6 @@ export const ReplicationPipelineStatus = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{isNoticeAboveOverview &&
|
||||
tableNoticeTarget &&
|
||||
createPortal(tableErrorNotice, tableNoticeTarget)}
|
||||
<PageContainer size="large">
|
||||
<p className="sr-only" role="status" aria-live="polite">
|
||||
{isLoading ? 'Loading pipeline details' : ''}
|
||||
@@ -313,8 +308,6 @@ export const ReplicationPipelineStatus = () => {
|
||||
/>
|
||||
)}
|
||||
|
||||
{!isNoticeAboveOverview && tableErrorNotice}
|
||||
|
||||
{!isNoticeAboveOverview && isSlotDisconnected && (
|
||||
<Admonition
|
||||
type="warning"
|
||||
@@ -341,6 +334,7 @@ export const ReplicationPipelineStatus = () => {
|
||||
</PageSectionSummary>
|
||||
</PageSectionMeta>
|
||||
<PageSectionContent className="flex flex-col gap-y-4">
|
||||
{tableErrorNotice}
|
||||
{hasTableData && (
|
||||
<div className="flex flex-col gap-y-3">
|
||||
<div className="flex items-center justify-between">
|
||||
|
||||
@@ -84,8 +84,10 @@ export function getPipelinesMockResponse(
|
||||
request: Request,
|
||||
scenario = 'busy'
|
||||
): Response | undefined {
|
||||
const counts: Record<string, number> = { one: 1, two: 2, small: 3, uneven: 5, busy: 8 }
|
||||
const pipelines = allPipelines.slice(0, counts[scenario] ?? counts.busy)
|
||||
const counts: Record<string, number> = { one: 1, two: 2, small: 3, four: 4, uneven: 5, busy: 8 }
|
||||
const pipelines = allPipelines
|
||||
.slice(0, counts[scenario] ?? counts.busy)
|
||||
.map((pipeline) => (scenario === 'four' ? { ...pipeline, cluster_id: '1' } : pipeline))
|
||||
const url = new URL(request.url)
|
||||
const path = url.pathname.replace(/^\/api\/platform\//, '/')
|
||||
if (
|
||||
|
||||
@@ -6,10 +6,12 @@ import { tmpdir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const scenarios = { one: 1, two: 2, small: 3, uneven: 5, busy: 8 }
|
||||
const scenarios = { one: 1, two: 2, small: 3, four: 4, uneven: 5, busy: 8 }
|
||||
const scenario = process.argv[2]
|
||||
if (!Object.hasOwn(scenarios, scenario)) {
|
||||
console.error('Usage: node apps/studio/scripts/pipelines-mock.mjs <one|two|small|uneven|busy>')
|
||||
console.error(
|
||||
'Usage: node apps/studio/scripts/pipelines-mock.mjs <one|two|small|four|uneven|busy>'
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user