Skip to content

Commit

Permalink
fixing misc UI issues (#1814)
Browse files Browse the repository at this point in the history
1. soft delete toggle is only available for BQ, SF and PG destinations
since other peers have issues.
2. Resync is only enabled when mirror is running or paused.
3. Watermark column dropdown only displays supported types (currently 5)
4. Publication name is now visible in CDC mirrors status page, if empty
in config filling using default publication name

Closes #1778, #1777 and #1767
  • Loading branch information
heavycrystal committed Jun 21, 2024
1 parent 5525dc7 commit 7dc047d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
6 changes: 6 additions & 0 deletions ui/app/mirrors/[mirrorId]/configValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const MirrorValues = (mirrorConfig: FlowConnectionConfigs | undefined) => {
value: mirrorConfig?.script,
label: 'Script',
},
{
value:
mirrorConfig?.publicationName ||
`peerflow_pub_${mirrorConfig?.flowJobName}`,
label: 'Publication Name',
},
];
};
export default MirrorValues;
8 changes: 5 additions & 3 deletions ui/app/mirrors/[mirrorId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ export default async function ViewMirror({
);

const dbType = mirrorConfig.destination!.type;
const canResync =
dbType.valueOf() === DBType.BIGQUERY.valueOf() ||
dbType.valueOf() === DBType.SNOWFLAKE.valueOf();

const isNotPaused =
mirrorStatus.currentFlowState.toString() !==
FlowStatus[FlowStatus.STATUS_PAUSED];
const canResync =
mirrorStatus.currentFlowState.toString() !==
FlowStatus[FlowStatus.STATUS_SETUP] &&
(dbType.valueOf() === DBType.BIGQUERY.valueOf() ||
dbType.valueOf() === DBType.SNOWFLAKE.valueOf());

actionsDropdown = (
<MirrorActions
Expand Down
8 changes: 7 additions & 1 deletion ui/app/mirrors/create/cdc/cdc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ export default function CDCConfigForm({
label.includes('snapshot'))) ||
((mirrorConfig.source?.type !== DBType.POSTGRES ||
mirrorConfig.destination?.type !== DBType.POSTGRES) &&
label.includes('type system'))
label.includes('type system')) ||
(mirrorConfig.destination?.type !== DBType.BIGQUERY &&
label.includes('column name')) ||
(label.includes('soft delete') &&
![DBType.BIGQUERY, DBType.POSTGRES, DBType.SNOWFLAKE].includes(
mirrorConfig.destination?.type ?? DBType.UNRECOGNIZED
))
) {
return false;
}
Expand Down
18 changes: 14 additions & 4 deletions ui/app/mirrors/create/qrep/qrep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ const WriteModes = ['Append', 'Upsert', 'Overwrite'].map((value) => ({
label: value,
value,
}));
const allowedTypesForWatermarkColumn = [
'smallint',
'integer',
'bigint',
'timestamp without time zone',
'timestamp with time zone',
];

export default function QRepConfigForm({
settings,
Expand Down Expand Up @@ -95,14 +102,17 @@ export default function QRepConfigForm({
schema,
table,
setLoading
).then((cols) =>
).then((cols) => {
const filteredCols = cols?.filter((col) =>
allowedTypesForWatermarkColumn.includes(col.split(':')[1])
);
setWatermarkColumns(
cols?.map((col) => ({
filteredCols.map((col) => ({
value: col.split(':')[0],
label: `${col.split(':')[0]} (${col.split(':')[1]})`,
}))
)
);
);
});
};

const handleSourceChange = (
Expand Down

0 comments on commit 7dc047d

Please sign in to comment.