Skip to content

Commit

Permalink
UI: Fix QRep related crashes (#1181)
Browse files Browse the repository at this point in the history
- Fixes access to specific qrep mirror page
- Fixes bug with destination table in create qrep mirror
  • Loading branch information
Amogh-Bharadwaj authored Jan 30, 2024
1 parent c3a753d commit edf5c7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
20 changes: 1 addition & 19 deletions ui/app/mirrors/create/qrep/qrep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,6 @@ export default function QRepConfigForm({
);
}, [mirrorConfig.sourcePeer]);

useEffect(() => {
if (mirrorConfig.destinationPeer?.type === DBType.BIGQUERY) {
setter((curr) => ({
...curr,
destinationTableIdentifier: mirrorConfig.watermarkTable?.split('.')[1],
}));
} else {
setter((curr) => ({
...curr,
destinationTableIdentifier: mirrorConfig.watermarkTable,
}));
}
}, [mirrorConfig.destinationPeer, mirrorConfig.watermarkTable, setter]);

useEffect(() => {
// set defaults
setter((curr) => ({ ...curr, ...blankQRepSetting }));
Expand Down Expand Up @@ -281,11 +267,7 @@ export default function QRepConfigForm({
<TextField
variant='simple'
type={setting.type}
defaultValue={
setting.label === 'Destination Table Name'
? mirrorConfig.destinationTableIdentifier
: (setting.default as string)
}
defaultValue={setting.default as string}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
handleChange(e.target.value, setting)
}
Expand Down
15 changes: 10 additions & 5 deletions ui/app/mirrors/edit/[mirrorId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,23 @@ export default async function ViewMirror({
if (!mirrorInfo) {
return <div>No mirror info found</div>;
}
const mirrorConfig = FlowConnectionConfigs.decode(mirrorInfo.config_proto!);

let syncStatusChild = <></>;
let resyncComponent = <></>;
if (mirrorStatus.cdcStatus) {
let rowsSynced = syncs.reduce((acc, sync) => {
if (sync.end_time !== null) {
return acc + sync.rows_in_batch;
}
return acc;
}, 0);
const mirrorConfig = FlowConnectionConfigs.decode(mirrorInfo.config_proto!);
resyncComponent = (
<ResyncDialog
mirrorConfig={mirrorConfig}
workflowId={mirrorInfo.workflow_id || ''}
/>
);
syncStatusChild = (
<SyncStatus rowsSynced={rowsSynced} rows={rows} flowJobName={mirrorId} />
);
Expand All @@ -102,10 +110,7 @@ export default async function ViewMirror({
<div style={{ display: 'flex', alignItems: 'center' }}>
<Header variant='title2'>{mirrorId}</Header>
</div>
<ResyncDialog
mirrorConfig={mirrorConfig}
workflowId={mirrorInfo.workflow_id || ''}
/>
{resyncComponent}
</div>
<CDCMirror
rows={rows}
Expand Down

0 comments on commit edf5c7b

Please sign in to comment.