From 54e74abbd2e3a04bdfbf067970926fa518b4208a Mon Sep 17 00:00:00 2001 From: sumitd94 Date: Wed, 17 Apr 2024 00:05:26 +0530 Subject: [PATCH] feat: update edit sync for cursor field --- ui/src/views/Activate/Syncs/EditSync/EditSync.tsx | 5 +++++ .../Syncs/SyncForm/ConfigureSyncs/ConfigureSyncs.tsx | 7 +++++-- .../Syncs/SyncForm/ConfigureSyncs/SelectStreams.tsx | 5 ++--- ui/src/views/Activate/Syncs/SyncForm/SyncForm.tsx | 3 +++ ui/src/views/Activate/Syncs/types.ts | 4 +++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ui/src/views/Activate/Syncs/EditSync/EditSync.tsx b/ui/src/views/Activate/Syncs/EditSync/EditSync.tsx index b2890ec3..6f552dfa 100644 --- a/ui/src/views/Activate/Syncs/EditSync/EditSync.tsx +++ b/ui/src/views/Activate/Syncs/EditSync/EditSync.tsx @@ -29,6 +29,7 @@ const EditSync = (): JSX.Element | null => { const [isEditLoading, setIsEditLoading] = useState(false); const [configuration, setConfiguration] = useState(null); const [selectedSyncMode, setSelectedSyncMode] = useState(''); + const [cursorField, setCursorField] = useState(''); const { syncId } = useParams(); const showToast = useCustomToast(); @@ -92,6 +93,7 @@ const EditSync = (): JSX.Element | null => { sync_interval: data.sync_interval, sync_interval_unit: data.sync_interval_unit, sync_mode: selectedSyncMode, + cursor_field: cursorField, }, }; @@ -163,6 +165,7 @@ const EditSync = (): JSX.Element | null => { setConfiguration(transformedConfigs); } setSelectedSyncMode(syncData?.sync_mode ?? 'full_refresh'); + setCursorField(syncData?.cursor_field || ''); } }, [syncFetchResponse]); @@ -193,6 +196,8 @@ const EditSync = (): JSX.Element | null => { setSelectedSyncMode={setSelectedSyncMode} selectedSyncMode={selectedSyncMode} selectedStreamName={syncData?.stream_name} + selectedCursorField={cursorField} + setCursorField={setCursorField} /> {catalogData?.data.attributes.catalog.schema_mode === SchemaMode.schemaless ? ( >; setConfiguration: Dispatch>; setSchemaMode: Dispatch>; setSelectedSyncMode: Dispatch>; + setCursorField: Dispatch>; }; const ConfigureSyncs = ({ selectedStream, configuration, selectedSyncMode, + cursorField, setSelectedStream, setConfiguration, setSchemaMode, setSelectedSyncMode, + setCursorField, }: ConfigureSyncsProps): JSX.Element | null => { const { state, stepInfo, handleMoveForward } = useContext(SteppedFormContext); - const [cursorField, setCursorField] = useState(''); const { forms } = state; diff --git a/ui/src/views/Activate/Syncs/SyncForm/ConfigureSyncs/SelectStreams.tsx b/ui/src/views/Activate/Syncs/SyncForm/ConfigureSyncs/SelectStreams.tsx index 581f22af..8aae9136 100644 --- a/ui/src/views/Activate/Syncs/SyncForm/ConfigureSyncs/SelectStreams.tsx +++ b/ui/src/views/Activate/Syncs/SyncForm/ConfigureSyncs/SelectStreams.tsx @@ -100,8 +100,7 @@ const SelectStreams = ({ }) : []; - const sourceDefinedCursor = - selectedStreamIndex !== -1 ? streams?.[selectedStreamIndex]?.source_defined_cursor : false; + const sourceDefinedCursor = modelDiscoverData?.data?.attributes?.catalog?.source_defined_cursor; return ( {modelColumns?.map((modelColumn) => (