diff --git a/ui/app/mirrors/create/cdc/cdc.tsx b/ui/app/mirrors/create/cdc/cdc.tsx index 589382aedb..dc34c1dfd9 100644 --- a/ui/app/mirrors/create/cdc/cdc.tsx +++ b/ui/app/mirrors/create/cdc/cdc.tsx @@ -67,7 +67,10 @@ export default function CDCConfigForm({ (label.includes('initial copy') || label.includes('initial load') || label.includes('soft delete') || - label.includes('snapshot'))) + label.includes('snapshot'))) || + ((mirrorConfig.source?.type !== DBType.POSTGRES || + mirrorConfig.destination?.type !== DBType.POSTGRES) && + label.includes('type system')) ) { return false; } @@ -97,7 +100,7 @@ export default function CDCConfigForm({ ? publications : undefined } - publicationsLoading={pubLoading} + optionsLoading={pubLoading} /> ) ); diff --git a/ui/app/mirrors/create/cdc/fields.tsx b/ui/app/mirrors/create/cdc/fields.tsx index 7d8842e89a..3a1f8064b2 100644 --- a/ui/app/mirrors/create/cdc/fields.tsx +++ b/ui/app/mirrors/create/cdc/fields.tsx @@ -13,14 +13,14 @@ interface FieldProps { setting: MirrorSetting; handleChange: (val: string | boolean, setting: MirrorSetting) => void; options?: string[]; - publicationsLoading?: boolean; + optionsLoading?: boolean; } const CDCField = ({ setting, handleChange, options, - publicationsLoading, + optionsLoading, }: FieldProps) => { return setting.type === 'switch' ? (
val && handleChange(val.option, setting) } @@ -78,7 +77,7 @@ const CDCField = ({ getOptionLabel={(option) => option.label} getOptionValue={(option) => option.option} theme={SelectTheme} - isLoading={publicationsLoading} + isLoading={optionsLoading} />
{setting.tips && ( diff --git a/ui/app/mirrors/create/helpers/cdc.ts b/ui/app/mirrors/create/helpers/cdc.ts index 5d63cdd69a..c18f483f30 100644 --- a/ui/app/mirrors/create/helpers/cdc.ts +++ b/ui/app/mirrors/create/helpers/cdc.ts @@ -1,3 +1,4 @@ +import { TypeSystem } from '@/grpc_generated/flow'; import { CDCConfig } from '../../../dto/MirrorsDTO'; import { MirrorSetting } from './common'; export const cdcSettings: MirrorSetting[] = [ @@ -149,4 +150,16 @@ export const cdcSettings: MirrorSetting[] = [ tips: 'Associate PeerDB script with this mirror.', advanced: true, }, + { + label: 'Use Postgres type system', + stateHandler: (value, setter) => + setter((curr: CDCConfig) => ({ + ...curr, + system: value === true ? TypeSystem.PG : TypeSystem.Q, + })), + type: 'switch', + default: false, + tips: 'Decide if PeerDB should use native Postgres types directly', + advanced: true, + }, ]; diff --git a/ui/app/mirrors/create/helpers/common.ts b/ui/app/mirrors/create/helpers/common.ts index 71c3c1d233..4237bc2176 100644 --- a/ui/app/mirrors/create/helpers/common.ts +++ b/ui/app/mirrors/create/helpers/common.ts @@ -1,16 +1,8 @@ -import { - FlowConnectionConfigs, - QRepWriteType, - TypeSystem, -} from '@/grpc_generated/flow'; -import { Peer } from '@/grpc_generated/peers'; +import { FlowConnectionConfigs, TypeSystem } from '@/grpc_generated/flow'; export interface MirrorSetting { label: string; - stateHandler: ( - value: string | string[] | Peer | boolean | QRepWriteType, - setter: any - ) => void; + stateHandler: (value: any, setter: any) => void; type?: string; required?: boolean; tips?: string;