From 11ca60b12b85267024f7f0fb5f9df3eee25afad9 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/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 +++++++ 11 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 ui/app/mirrors/status/qrep/[mirrorId]/qrepConfigViewer.tsx 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({ > - -