Skip to content

Commit

Permalink
quote watermark table and fix default dst tablename
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Nov 27, 2023
1 parent 1d350b3 commit 95aba75
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions ui/app/mirrors/create/qrep/qrep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,17 @@ export default function QRepConfigForm({
) => {
if (val) {
if (setting.label === 'Table') {
setter((curr) => ({ ...curr, destinationTableIdentifier: val }));
if (mirrorConfig.destinationPeer?.type === DBType.BIGQUERY) {
setter((curr) => ({
...curr,
destinationTableIdentifier: val.split('.')[1],
}));
} else {
setter((curr) => ({
...curr,
destinationTableIdentifier: val,
}));
}
loadColumnOptions(val);
}
handleChange(val, setting);
Expand All @@ -127,6 +137,20 @@ 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 @@ -255,12 +279,7 @@ export default function QRepConfigForm({
type={setting.type}
defaultValue={
setting.label === 'Destination Table Name'
? mirrorConfig.destinationPeer?.type ===
DBType.BIGQUERY
? mirrorConfig.destinationTableIdentifier?.split(
'.'
)[1]
: mirrorConfig.destinationTableIdentifier
? mirrorConfig.destinationTableIdentifier
: setting.default
}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
Expand Down

0 comments on commit 95aba75

Please sign in to comment.