Skip to content

Commit 39733b1

Browse files
committed
fix:resolved selection and deselection for duplicate title and uid fields [CMG-640]
1 parent a19cc41 commit 39733b1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ui/src/components/ContentMapper/contentMapper.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,5 @@ export interface ModifiedField {
206206
backupFieldType: string;
207207
parentId: string;
208208
uid: string;
209+
_canSelect?: boolean;
209210
}

ui/src/components/ContentMapper/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -828,17 +828,18 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
828828
}, [tableData]);
829829

830830
const getParentId = (uid: string) => {
831-
return tableData?.find(i => i?.uid?.toLowerCase() === uid?.toLowerCase())?.id ?? ''
831+
return tableData?.find((i) => i?.uid?.toLowerCase() === uid?.toLowerCase() && i?.backupFieldType?.toLowerCase() === 'group')?.id ?? ''
832832
}
833833

834834
const modifiedObj = (obj: FieldMapType) => {
835-
const {backupFieldType, uid, id} = obj ?? {}
835+
const {backupFieldType, uid, id, _canSelect} = obj ?? {}
836836
const excludeArr = ["group"]
837837
return {
838838
id,
839839
backupFieldType,
840840
uid,
841-
parentId : excludeArr?.includes?.(backupFieldType?.toLowerCase()) ? '' : getParentId(uid?.split('.')[0]?.toLowerCase())
841+
parentId : excludeArr?.includes?.(backupFieldType?.toLowerCase()) ? '' : getParentId(uid?.split('.')[0]?.toLowerCase()),
842+
_canSelect,
842843
}
843844
}
844845

@@ -940,7 +941,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
940941
})
941942
}
942943
}
943-
} else if(latestRow?.parentId && !["title", "url"]?.includes?.(latestRow?.uid?.toLowerCase())){
944+
} else if(latestRow?.parentId && latestRow?._canSelect === true){
944945
// Extract the group UID if item is child of any group
945946
const uidBeforeDot = latestRow?.uid?.split?.('.')?.[0]?.toLowerCase();
946947
const groupItem = tableData?.find((entry) => entry?.uid?.toLowerCase() === uidBeforeDot);

0 commit comments

Comments
 (0)