From 0edb5a5ff42db80a036f93ee80570d4f9a083c6f Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Fri, 20 Oct 2023 10:00:47 -0400 Subject: [PATCH] do minor ui tweaks --- ui/app/mirrors/create/helpers/qrep.ts | 6 +-- ui/app/mirrors/create/page.tsx | 8 ++-- ui/app/mirrors/edit/[mirrorId]/cdc.tsx | 5 ++- ui/app/mirrors/edit/[mirrorId]/page.tsx | 3 ++ .../edit/[mirrorId]/syncStatusTable.tsx | 5 ++- ui/app/mirrors/page.tsx | 5 ++- .../mirrors/status/qrep/[mirrorId]/page.tsx | 4 ++ .../qrep/[mirrorId]/qrepConfigViewer.tsx | 43 +++++++++++++++++++ .../qrep/[mirrorId]/qrepStatusTable.tsx | 5 ++- ui/app/peers/edit/[connectorId]/page.tsx | 5 ++- ui/lib/Badge/Badge.styles.ts | 7 +++ ui/package.json | 1 + ui/yarn.lock | 15 +++++++ 13 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 ui/app/mirrors/status/qrep/[mirrorId]/qrepConfigViewer.tsx diff --git a/ui/app/mirrors/create/helpers/qrep.ts b/ui/app/mirrors/create/helpers/qrep.ts index cab1fbc081..acf1c0bf11 100644 --- a/ui/app/mirrors/create/helpers/qrep.ts +++ b/ui/app/mirrors/create/helpers/qrep.ts @@ -126,8 +126,8 @@ export const qrepSettings: MirrorSetting[] = [ writeMode: currWriteMode, }; }), - tips: `Specify whether you want the write mode to be via APPEND, UPSERT or OVERWRITE. - Append mode is for insert-only workloads. Upsert mode is append mode but also supports updates. + tips: `Specify whether you want the write mode to be via APPEND, UPSERT or OVERWRITE. + Append mode is for insert-only workloads. Upsert mode is append mode but also supports updates. Overwrite mode overwrites the destination table data every sync.`, type: 'select', }, @@ -163,7 +163,7 @@ export const qrepSettings: MirrorSetting[] = [ stateHandler: (value, setter) => setter((curr: QRepConfig) => ({ ...curr, - waitBetweenBatchesSeconds: parseInt(value as string, 10) || 0, + waitBetweenBatchesSeconds: parseInt(value as string, 10) || 30, })), tips: 'Time to wait (in seconds) between getting partitions to process.', default: '0', diff --git a/ui/app/mirrors/create/page.tsx b/ui/app/mirrors/create/page.tsx index 120b29b611..811f9114c8 100644 --- a/ui/app/mirrors/create/page.tsx +++ b/ui/app/mirrors/create/page.tsx @@ -62,8 +62,8 @@ export default function CreateMirrors() { } else setConfig(blankCDCSetting); }, [mirrorType]); - let listPeersPage = () => { - router.push('/peers'); + let listMirrorsPage = () => { + router.push('/mirrors'); }; return ( @@ -163,7 +163,7 @@ export default function CreateMirrors() { config as CDCConfig, setFormMessage, setLoading, - listPeersPage + listMirrorsPage ) : handleCreateQRep( mirrorName, @@ -171,7 +171,7 @@ export default function CreateMirrors() { config as QRepConfig, setFormMessage, setLoading, - listPeersPage, + listMirrorsPage, mirrorType === 'XMIN' // for handling xmin specific ) } diff --git a/ui/app/mirrors/edit/[mirrorId]/cdc.tsx b/ui/app/mirrors/edit/[mirrorId]/cdc.tsx index d70ba3b4fa..02202922cc 100644 --- a/ui/app/mirrors/edit/[mirrorId]/cdc.tsx +++ b/ui/app/mirrors/edit/[mirrorId]/cdc.tsx @@ -106,7 +106,10 @@ const SnapshotStatusTable = ({ status }: SnapshotStatusProps) => ( - diff --git a/ui/app/mirrors/edit/[mirrorId]/page.tsx b/ui/app/mirrors/edit/[mirrorId]/page.tsx index ce3ccab474..e2c5e6596a 100644 --- a/ui/app/mirrors/edit/[mirrorId]/page.tsx +++ b/ui/app/mirrors/edit/[mirrorId]/page.tsx @@ -2,6 +2,7 @@ import { MirrorStatusResponse } from '@/grpc_generated/route'; import { Header } from '@/lib/Header'; import { LayoutMain } from '@/lib/Layout'; import { GetFlowHttpAddressFromEnv } from '@/rpc/http'; +import { redirect } from 'next/navigation'; import { Suspense } from 'react'; import { CDCMirror } from './cdc'; import SyncStatus from './syncStatus'; @@ -39,6 +40,8 @@ export default async function EditMirror({ let syncStatusChild = <>; if (mirrorStatus.cdcStatus) { syncStatusChild = ; + } else { + redirect(`/mirrors/status/qrep/${mirrorId}`); } return ( diff --git a/ui/app/mirrors/edit/[mirrorId]/syncStatusTable.tsx b/ui/app/mirrors/edit/[mirrorId]/syncStatusTable.tsx index 06abcc67ce..d26ef70a6e 100644 --- a/ui/app/mirrors/edit/[mirrorId]/syncStatusTable.tsx +++ b/ui/app/mirrors/edit/[mirrorId]/syncStatusTable.tsx @@ -76,7 +76,10 @@ export const SyncStatusTable = ({ rows }: SyncStatusTableProps) => { - diff --git a/ui/app/mirrors/page.tsx b/ui/app/mirrors/page.tsx index 6c40108f07..9cbb00035b 100644 --- a/ui/app/mirrors/page.tsx +++ b/ui/app/mirrors/page.tsx @@ -170,7 +170,10 @@ async function QRepFlows() { - + + + Active + ))} diff --git a/ui/app/mirrors/status/qrep/[mirrorId]/page.tsx b/ui/app/mirrors/status/qrep/[mirrorId]/page.tsx index 131d788ee6..a3fed7e0e9 100644 --- a/ui/app/mirrors/status/qrep/[mirrorId]/page.tsx +++ b/ui/app/mirrors/status/qrep/[mirrorId]/page.tsx @@ -1,8 +1,11 @@ import prisma from '@/app/utils/prisma'; import { Header } from '@/lib/Header'; import { LayoutMain } from '@/lib/Layout'; +import QRepConfigViewer from './qrepConfigViewer'; import QRepStatusTable, { QRepPartitionStatus } from './qrepStatusTable'; +export const dynamic = 'force-dynamic'; + type QRepMirrorStatusProps = { params: { mirrorId: string }; }; @@ -37,6 +40,7 @@ export default async function QRepMirrorStatus({ return (
{mirrorId}
+
); diff --git a/ui/app/mirrors/status/qrep/[mirrorId]/qrepConfigViewer.tsx b/ui/app/mirrors/status/qrep/[mirrorId]/qrepConfigViewer.tsx new file mode 100644 index 0000000000..05fffd9570 --- /dev/null +++ b/ui/app/mirrors/status/qrep/[mirrorId]/qrepConfigViewer.tsx @@ -0,0 +1,43 @@ +import prisma from '@/app/utils/prisma'; +import { QRepConfig } from '@/grpc_generated/flow'; +import { Badge } from '@/lib/Badge'; +import { Icon } from '@/lib/Icon'; + +export const dynamic = 'force-dynamic'; + +type QRepConfigViewerProps = { + mirrorId: string; +}; + +export default async function QRepConfigViewer({ + mirrorId, +}: QRepConfigViewerProps) { + const configBuffer = await prisma.qrep_runs.findFirst({ + select: { + config_proto: true, + }, + where: { + flow_name: mirrorId, + config_proto: { + not: null, + }, + }, + }); + + if (!configBuffer?.config_proto) { + return
Config Unavailable
; + } + + let qrepConfig = QRepConfig.decode(configBuffer.config_proto); + + return ( +
+ + +
+ {qrepConfig.initialCopyOnly ? 'Initial Load' : 'Continuous Sync'} +
+
+
+ ); +} diff --git a/ui/app/mirrors/status/qrep/[mirrorId]/qrepStatusTable.tsx b/ui/app/mirrors/status/qrep/[mirrorId]/qrepStatusTable.tsx index c50c145de1..e90038d45c 100644 --- a/ui/app/mirrors/status/qrep/[mirrorId]/qrepStatusTable.tsx +++ b/ui/app/mirrors/status/qrep/[mirrorId]/qrepStatusTable.tsx @@ -117,7 +117,10 @@ export default function QRepStatusTable({ > - -