diff --git a/ui/app/dto/MirrorsDTO.ts b/ui/app/dto/MirrorsDTO.ts index f76904b08d..33234a557d 100644 --- a/ui/app/dto/MirrorsDTO.ts +++ b/ui/app/dto/MirrorsDTO.ts @@ -23,7 +23,7 @@ export type TableMapRow = { source: string; destination: string; partitionKey: string; - exclude: string[]; + exclude: Set; selected: boolean; canMirror: boolean; }; diff --git a/ui/app/mirrors/create/cdc/columnbox.tsx b/ui/app/mirrors/create/cdc/columnbox.tsx index b68560419f..f017edfa8c 100644 --- a/ui/app/mirrors/create/cdc/columnbox.tsx +++ b/ui/app/mirrors/create/cdc/columnbox.tsx @@ -23,18 +23,21 @@ export default function ColumnBox({ include: boolean ) => { const currRows = [...rows]; - const rowOfSource = currRows.find((row) => row.source === source); - if (rowOfSource) { + const rowIndex = currRows.findIndex((row) => row.source === source); + if (rowIndex !== -1) { + const sourceRow = currRows[rowIndex], + newExclude = new Set(sourceRow.exclude); if (include) { - const updatedExclude = rowOfSource.exclude.filter( - (col) => col !== column - ); - rowOfSource.exclude = updatedExclude; + newExclude.delete(column); } else { - rowOfSource.exclude.push(column); + newExclude.add(column); } + currRows[rowIndex] = { + ...sourceRow, + exclude: newExclude, + }; + setRows(currRows); } - setRows(currRows); }; const columnExclusion = new Set(tableRow.exclude); diff --git a/ui/app/mirrors/create/cdc/schemabox.tsx b/ui/app/mirrors/create/cdc/schemabox.tsx index 34c49c0b16..6962ac4aa7 100644 --- a/ui/app/mirrors/create/cdc/schemabox.tsx +++ b/ui/app/mirrors/create/cdc/schemabox.tsx @@ -50,8 +50,6 @@ const SchemaBox = ({ const [expandedSchemas, setExpandedSchemas] = useState([]); const [tableQuery, setTableQuery] = useState(''); - const [handlingAll, setHandlingAll] = useState(false); - const searchedTables = useMemo(() => { const tableQueryLower = tableQuery.toLowerCase(); return rows @@ -125,17 +123,16 @@ const SchemaBox = ({ e: React.MouseEvent, schemaName: string ) => { - setHandlingAll(true); const newRows = [...rows]; - for (const row of newRows) { + for (let i = 0; i < newRows.length; i++) { + const row = newRows[i]; if (row.schema === schemaName) { - row.selected = e.currentTarget.checked; + newRows[i] = { ...row, selected: e.currentTarget.checked }; if (e.currentTarget.checked) addTableColumns(row.source); else removeTableColumns(row.source); } } setRows(newRows); - setHandlingAll(false); }; const rowsDoNotHaveSchemaTables = (schema: string) => { @@ -199,8 +196,7 @@ const SchemaBox = ({ {/* TABLE BOX */} - {handlingAll && } - {!handlingAll && schemaIsExpanded(schema) && ( + {schemaIsExpanded(schema) && (
{searchedTables.length ? ( searchedTables.map((row) => { diff --git a/ui/app/mirrors/create/handlers.ts b/ui/app/mirrors/create/handlers.ts index a3fdab3178..8087d9b37a 100644 --- a/ui/app/mirrors/create/handlers.ts +++ b/ui/app/mirrors/create/handlers.ts @@ -120,17 +120,13 @@ interface TableMapping { } const reformattedTableMapping = (tableMapping: TableMapRow[]) => { const mapping = tableMapping - .map((row) => { - if (row?.selected === true) { - return { - sourceTableIdentifier: row.source, - destinationTableIdentifier: row.destination, - partitionKey: row.partitionKey, - exclude: row.exclude, - }; - } - }) - .filter(Boolean); + .filter((row) => row?.selected === true) + .map((row) => ({ + sourceTableIdentifier: row.source, + destinationTableIdentifier: row.destination, + partitionKey: row.partitionKey, + exclude: Array.from(row.exclude), + })); return mapping; }; @@ -277,7 +273,7 @@ export const fetchTables = async ( source: `${schemaName}.${tableObject.tableName}`, destination: dstName, partitionKey: '', - exclude: [], + exclude: new Set(), selected: false, canMirror: tableObject.canMirror, }); diff --git a/ui/app/mirrors/create/mirrorcards.tsx b/ui/app/mirrors/create/mirrorcards.tsx index 9e781324f1..207f4be3b4 100644 --- a/ui/app/mirrors/create/mirrorcards.tsx +++ b/ui/app/mirrors/create/mirrorcards.tsx @@ -41,7 +41,7 @@ const MirrorCards = ({ > {cards.map((card, index) => { return ( -
Learn more -
+ ); })}
diff --git a/ui/app/mirrors/errors/[mirrorName]/page.tsx b/ui/app/mirrors/errors/[mirrorName]/page.tsx index d0148b6b7b..e2fad6b8b5 100644 --- a/ui/app/mirrors/errors/[mirrorName]/page.tsx +++ b/ui/app/mirrors/errors/[mirrorName]/page.tsx @@ -86,7 +86,11 @@ export default function MirrorError() { - +