Skip to content

Commit

Permalink
do minor ui tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik committed Oct 20, 2023
1 parent 3480ee5 commit 11ca60b
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 5 deletions.
5 changes: 4 additions & 1 deletion ui/app/mirrors/edit/[mirrorId]/cdc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ const SnapshotStatusTable = ({ status }: SnapshotStatusProps) => (
<Button variant='normalBorderless'>
<Icon name='chevron_right' />
</Button>
<Button variant='normalBorderless'>
<Button
variant='normalBorderless'
onClick={() => window.location.reload()}
>
<Icon name='refresh' />
</Button>
</>
Expand Down
3 changes: 3 additions & 0 deletions ui/app/mirrors/edit/[mirrorId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -39,6 +40,8 @@ export default async function EditMirror({
let syncStatusChild = <></>;
if (mirrorStatus.cdcStatus) {
syncStatusChild = <SyncStatus flowJobName={mirrorId} />;
} else {
redirect(`/mirrors/status/qrep/${mirrorId}`);
}

return (
Expand Down
5 changes: 4 additions & 1 deletion ui/app/mirrors/edit/[mirrorId]/syncStatusTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ export const SyncStatusTable = ({ rows }: SyncStatusTableProps) => {
<Icon name='chevron_right' />
</Button>
<Label>{`${currentPage} of ${totalPages}`}</Label>
<Button variant='normalBorderless'>
<Button
variant='normalBorderless'
onClick={() => window.location.reload()}
>
<Icon name='refresh' />
</Button>
</>
Expand Down
5 changes: 4 additions & 1 deletion ui/app/mirrors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ async function QRepFlows() {
</Label>
</TableCell>
<TableCell>
<Label>Status TBD</Label>
<Badge variant='positive' key={1}>
<Icon name='play_circle' />
Active
</Badge>
</TableCell>
</TableRow>
))}
Expand Down
4 changes: 4 additions & 0 deletions ui/app/mirrors/status/qrep/[mirrorId]/page.tsx
Original file line number Diff line number Diff line change
@@ -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 };
};
Expand Down Expand Up @@ -37,6 +40,7 @@ export default async function QRepMirrorStatus({
return (
<LayoutMain alignSelf='flex-start' justifySelf='flex-start' width='full'>
<Header variant='title2'>{mirrorId}</Header>
<QRepConfigViewer mirrorId={mirrorId} />
<QRepStatusTable flowJobName={mirrorId} partitions={partitions} />
</LayoutMain>
);
Expand Down
43 changes: 43 additions & 0 deletions ui/app/mirrors/status/qrep/[mirrorId]/qrepConfigViewer.tsx
Original file line number Diff line number Diff line change
@@ -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 <div>Config Unavailable</div>;
}

let qrepConfig = QRepConfig.decode(configBuffer.config_proto);

return (
<div className='my-4'>
<Badge variant='warning' type='longText'>
<Icon name={qrepConfig.initialCopyOnly ? 'double_arrow' : 'sync'} />
<div className='font-bold'>
{qrepConfig.initialCopyOnly ? 'Initial Load' : 'Continuous Sync'}
</div>
</Badge>
</div>
);
}
5 changes: 4 additions & 1 deletion ui/app/mirrors/status/qrep/[mirrorId]/qrepStatusTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ export default function QRepStatusTable({
>
<Icon name='chevron_right' />
</Button>
<Button variant='normalBorderless'>
<Button
variant='normalBorderless'
onClick={() => window.location.reload()}
>
<Icon name='refresh' />
</Button>
<Button variant='normalBorderless'>
Expand Down
5 changes: 4 additions & 1 deletion ui/app/peers/edit/[connectorId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ const ExampleTable = ({ title }: { title: string }) => (
<Button variant='normalBorderless'>
<Icon name='chevron_right' />
</Button>
<Button variant='normalBorderless'>
<Button
variant='normalBorderless'
onClick={() => window.location.reload()}
>
<Icon name='refresh' />
</Button>
<Button variant='normalBorderless'>
Expand Down
7 changes: 7 additions & 0 deletions ui/lib/Badge/Badge.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,16 @@ const singleDigitTypeStyle = css`
height: 24px;
justify-content: center;
`;
const longTextTypeStyle = css`
padding: 10;
width: max-content;
height: 32px;
justify-content: center;
`;
const types = {
default: defaultTypeStyle,
singleDigit: singleDigitTypeStyle,
longText: longTextTypeStyle,
};

const baseStyle = css`
Expand Down
1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@monaco-editor/react": "^4.6.0",
"@prisma/client": "^5.4.2",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-form": "^0.0.3",
"@radix-ui/react-icons": "^1.3.0",
Expand Down
15 changes: 15 additions & 0 deletions ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,21 @@
"@radix-ui/react-use-previous" "1.0.1"
"@radix-ui/react-use-size" "1.0.1"

"@radix-ui/react-collapsible@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@radix-ui/react-collapsible/-/react-collapsible-1.0.3.tgz#df0e22e7a025439f13f62d4e4a9e92c4a0df5b81"
integrity sha512-UBmVDkmR6IvDsloHVN+3rtx4Mi5TFvylYXpluuv0f37dtaz3H99bp8No0LGXRigVpl3UAT4l9j6bIchh42S/Gg==
dependencies:
"@babel/runtime" "^7.13.10"
"@radix-ui/primitive" "1.0.1"
"@radix-ui/react-compose-refs" "1.0.1"
"@radix-ui/react-context" "1.0.1"
"@radix-ui/react-id" "1.0.1"
"@radix-ui/react-presence" "1.0.1"
"@radix-ui/react-primitive" "1.0.3"
"@radix-ui/react-use-controllable-state" "1.0.1"
"@radix-ui/react-use-layout-effect" "1.0.1"

"@radix-ui/[email protected]":
version "1.0.3"
resolved "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.0.3.tgz"
Expand Down

0 comments on commit 11ca60b

Please sign in to comment.