From c9bd38d505e95eee586923251bf1d1b921e8374a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Sat, 18 May 2024 18:15:17 +0000 Subject: [PATCH] move checked state calc to settings, doesn't belong in layout --- ui/app/mirrors/create/helpers/common.ts | 2 +- ui/app/mirrors/create/helpers/qrep.ts | 4 ++++ ui/app/mirrors/create/qrep/qrep.tsx | 8 +------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ui/app/mirrors/create/helpers/common.ts b/ui/app/mirrors/create/helpers/common.ts index c63278a4a9..38102c4441 100644 --- a/ui/app/mirrors/create/helpers/common.ts +++ b/ui/app/mirrors/create/helpers/common.ts @@ -9,6 +9,7 @@ export enum AdvancedSettingType { export interface MirrorSetting { label: string; stateHandler: (value: any, setter: any) => void; + checked?: (setting: any) => boolean; type?: string; required?: boolean; tips?: string; @@ -57,5 +58,4 @@ export const blankQRepSetting = { stagingPath: '', numRowsPerPartition: 100000, setupWatermarkTableOnDestination: false, - dstTableFullResync: false, }; diff --git a/ui/app/mirrors/create/helpers/qrep.ts b/ui/app/mirrors/create/helpers/qrep.ts index 6d01d28509..85652e48e8 100644 --- a/ui/app/mirrors/create/helpers/qrep.ts +++ b/ui/app/mirrors/create/helpers/qrep.ts @@ -37,6 +37,7 @@ export const qrepSettings: MirrorSetting[] = [ ...curr, setupWatermarkTableOnDestination: value as boolean, })), + checked: (state) => state.setupWatermarkTableOnDestination, tips: 'Specify if you want to create the watermark table on the destination as-is, can be used for some queries.', type: 'switch', default: false, @@ -48,6 +49,7 @@ export const qrepSettings: MirrorSetting[] = [ ...curr, destinationTableIdentifier: value as string, })), + checked: (state) => state.destinationTableIdentifier, tips: 'Name of the destination. For any destination peer apart from BigQuery, this must be schema-qualified. Example: public.users', required: true, }, @@ -116,6 +118,7 @@ export const qrepSettings: MirrorSetting[] = [ ...curr, initialCopyOnly: (value as boolean) || false, })), + checked: (state) => state.initialCopyOnly, tips: 'Specify if you want query replication to stop at initial load.', type: 'switch', }, @@ -144,6 +147,7 @@ export const qrepSettings: MirrorSetting[] = [ ...curr, system: value === true ? TypeSystem.PG : TypeSystem.Q, })), + checked: (state) => state.system === TypeSystem.PG, type: 'switch', default: false, tips: 'Decide if PeerDB should use native Postgres types directly', diff --git a/ui/app/mirrors/create/qrep/qrep.tsx b/ui/app/mirrors/create/qrep/qrep.tsx index 82812cf53a..8488b5a766 100644 --- a/ui/app/mirrors/create/qrep/qrep.tsx +++ b/ui/app/mirrors/create/qrep/qrep.tsx @@ -151,13 +151,7 @@ export default function QRepConfigForm({ }} > handleChange(state, setting) }