diff --git a/ui/app/mirrors/create/handlers.ts b/ui/app/mirrors/create/handlers.ts index da1daf4dca..31ff45a66b 100644 --- a/ui/app/mirrors/create/handlers.ts +++ b/ui/app/mirrors/create/handlers.ts @@ -135,7 +135,7 @@ export const handleCreateQRep = async ( query = config.query; config.initialCopyOnly = false; } - console.log('handle Qrep:', config); + if ( config.writeMode?.writeType == QRepWriteType.QREP_WRITE_MODE_UPSERT && !config.writeMode?.upsertKeyColumns @@ -210,7 +210,6 @@ export const fetchColumns = async ( setLoading: Dispatch> ) => { if (peerName?.length === 0) return []; - console.log(peerName, schemaName, tableName); setLoading(true); const columnsRes: UColumnsResponse = await fetch('/api/peers/columns', { method: 'POST', diff --git a/ui/app/mirrors/create/tablemapping.tsx b/ui/app/mirrors/create/tablemapping.tsx index ac1a18f79a..6ee40aaf22 100644 --- a/ui/app/mirrors/create/tablemapping.tsx +++ b/ui/app/mirrors/create/tablemapping.tsx @@ -116,7 +116,6 @@ const TableMapping = ({ const [searchQuery, setSearchQuery] = useState(''); useEffect(() => { - console.log('peertype and schema in useeffect:', peerType, schema); if (peerType != undefined && dBTypeToJSON(peerType) == 'BIGQUERY') { setRows((rows) => { const newRows = [...rows]; diff --git a/ui/app/mirrors/edit/[mirrorId]/cdc.tsx b/ui/app/mirrors/edit/[mirrorId]/cdc.tsx index 7ef56f193e..3554e9a9ab 100644 --- a/ui/app/mirrors/edit/[mirrorId]/cdc.tsx +++ b/ui/app/mirrors/edit/[mirrorId]/cdc.tsx @@ -2,22 +2,15 @@ import SearchBar from '@/components/Search'; import TimeLabel from '@/components/TimeComponent'; -import { - CDCMirrorStatus, - QRepMirrorStatus, - SnapshotStatus, -} from '@/grpc_generated/route'; +import { QRepMirrorStatus, SnapshotStatus } from '@/grpc_generated/route'; import { Button } from '@/lib/Button'; import { Icon } from '@/lib/Icon'; import { Label } from '@/lib/Label'; import { ProgressBar } from '@/lib/ProgressBar'; import { Table, TableCell, TableRow } from '@/lib/Table'; -import * as Tabs from '@radix-ui/react-tabs'; import moment, { Duration, Moment } from 'moment'; -import { useQueryState } from 'next-usequerystate'; import Link from 'next/link'; import { useState } from 'react'; -import styled from 'styled-components'; class TableCloneSummary { flowJobName: string; @@ -94,162 +87,92 @@ function summarizeTableClone(clone: QRepMirrorStatus): TableCloneSummary { type SnapshotStatusProps = { status: SnapshotStatus; }; -const SnapshotStatusTable = ({ status }: SnapshotStatusProps) => { +export const SnapshotStatusTable = ({ status }: SnapshotStatusProps) => { const [snapshotRows, setSnapshotRows] = useState( status.clones.map(summarizeTableClone) ); return ( - Initial Copy} - toolbar={{ - left: ( - <> - - - - - ), - right: ( - - status.clones.map(summarizeTableClone).filter((row: any) => { - return row.tableName - .toLowerCase() - .includes(query.toLowerCase()); - }) - } - /> - ), - }} - header={ - - Table Identifier - Start Time - Progress Partitions - Num Rows Synced - Avg Time Per Partition - - } - > - {snapshotRows.map((clone, index) => ( - - -
Initial Copy} + toolbar={{ + left: ( + <> + + + + + ), + right: ( + + status.clones.map(summarizeTableClone).filter((row: any) => { + return row.tableName + .toLowerCase() + .includes(query.toLowerCase()); + }) } - - - - - {clone.completedNumPartitions} / {clone.totalNumPartitions} - - {clone.completedNumRows} - - - - - ))} -
+ /> + ), + }} + header={ + + Table Identifier + Start Time + Progress Partitions + Num Rows Synced + Avg Time Per Partition + + } + > + {snapshotRows.map((clone, index) => ( + + + + + + + + + + {clone.completedNumPartitions} / {clone.totalNumPartitions} + + {clone.completedNumRows} + + + + + ))} + + ); }; - -const Trigger = styled( - ({ isActive, ...props }: { isActive?: boolean } & Tabs.TabsTriggerProps) => ( - - ) -)<{ isActive?: boolean }>` - background-color: ${({ theme, isActive }) => - isActive ? theme.colors.accent.surface.selected : 'white'}; - - font-weight: ${({ isActive }) => (isActive ? 'bold' : 'normal')}; - - &:hover { - color: ${({ theme }) => theme.colors.accent.text.highContrast}; - } -`; - -type CDCMirrorStatusProps = { - cdc: CDCMirrorStatus; - syncStatusChild?: React.ReactNode; -}; -export function CDCMirror({ cdc, syncStatusChild }: CDCMirrorStatusProps) { - const [selectedTab, setSelectedTab] = useQueryState('tab', { - history: 'push', - defaultValue: 'tab1', - }); - - let snapshot = <>; - if (cdc.snapshotStatus) { - snapshot = ; - } - - return ( - - - - Details - - - Sync Status - - - Initial Copy - - - - {/* */} - - - {syncStatusChild} - - - {snapshot} - - - ); -} diff --git a/ui/app/mirrors/edit/[mirrorId]/cdcGraph.tsx b/ui/app/mirrors/edit/[mirrorId]/cdcGraph.tsx index 8a8901a836..9c490f6549 100644 --- a/ui/app/mirrors/edit/[mirrorId]/cdcGraph.tsx +++ b/ui/app/mirrors/edit/[mirrorId]/cdcGraph.tsx @@ -23,17 +23,17 @@ function CdcGraph({ syncs }: { syncs: SyncStatusRow[] }) { const initialCount: [string, number][] = []; let [counts, setCounts] = useState(initialCount); - let rows = syncs.map((sync) => ({ - timestamp: sync.startTime, - count: sync.numRows, - })); - useEffect(() => { + let rows = syncs.map((sync) => ({ + timestamp: sync.startTime, + count: sync.numRows, + })); + let counts = aggregateCountsByInterval(rows, aggregateType); counts = counts.slice(0, 29); counts = counts.reverse(); setCounts(counts); - }, [aggregateType, rows]); + }, [aggregateType, syncs]); return (
diff --git a/ui/app/mirrors/edit/[mirrorId]/page.tsx b/ui/app/mirrors/edit/[mirrorId]/page.tsx index 0bd23dddb0..ccea9bb196 100644 --- a/ui/app/mirrors/edit/[mirrorId]/page.tsx +++ b/ui/app/mirrors/edit/[mirrorId]/page.tsx @@ -5,6 +5,7 @@ import { LayoutMain } from '@/lib/Layout'; import { GetFlowHttpAddressFromEnv } from '@/rpc/http'; import { redirect } from 'next/navigation'; import { Suspense } from 'react'; +import { SnapshotStatusTable } from './cdc'; import CdcDetails from './cdcDetails'; import SyncStatus from './syncStatus'; @@ -69,10 +70,17 @@ export default async function EditMirror({
{mirrorId}
}> {mirrorStatus.cdcStatus && ( - + <> + + {mirrorStatus.cdcStatus.snapshotStatus && ( + + )} + )}
{syncStatusChild}