Skip to content

Commit 3f0c084

Browse files
committed
fix:resolved the bug [CMG-634]
1 parent b984a4c commit 3f0c084

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

ui/src/components/ContentMapper/index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,7 @@ div .table-row {
311311
font-size: $size-font-large;
312312
font-weight: $font-weight-semi-bold;
313313
}
314+
.filtetButton-color{
315+
color: $color-brand-primary-base;
316+
font-weight: $font-weight-bold;
317+
}

ui/src/components/ContentMapper/index.tsx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { updateMigrationData, updateNewMigrationData } from '../../store/slice/m
3535

3636
// Utilities
3737
import { CS_ENTRIES, CONTENT_MAPPING_STATUS, STATUS_ICON_Mapping } from '../../utilities/constants';
38-
import { validateArray } from '../../utilities/functions';
38+
import { isEmptyString, validateArray } from '../../utilities/functions';
3939
import useBlockNavigation from '../../hooks/userNavigation';
4040

4141
// Interface
@@ -291,6 +291,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
291291
const [isContentDeleted, setIsContentDeleted] = useState<boolean>(false);
292292
const [isCsCTypeUpdated, setsCsCTypeUpdated] = useState<boolean>(false);
293293
const [isLoadingSaveButton, setisLoadingSaveButton] = useState<boolean>(false);
294+
const [activeFilter, setActiveFilter] = useState<string>('');
294295

295296

296297
/** ALL HOOKS Here */
@@ -1240,7 +1241,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
12401241

12411242
//utility function to map the source cms field type to content type field type
12421243
function checkConditions(fieldTypeToMatch: string | string[], value: ContentTypesSchema, data: FieldMapType) {
1243-
const fieldTypes = new Set(['number', 'isodate', 'file', 'reference', 'boolean', 'group', 'link','global_field','json','blocks']);
1244+
const fieldTypes = new Set(['number', 'isodate', 'file', 'reference', 'boolean', 'group', 'link','global_field','json','blocks','taxonomy']);
12441245
switch (fieldTypeToMatch) {
12451246
case 'text':
12461247
return (
@@ -1373,7 +1374,6 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
13731374

13741375
return OptionsForRow;
13751376
};
1376-
13771377
const SelectAccessorOfColumn = (data: FieldMapType) => {
13781378
// Fetch options for the current row from Fields based on backupFieldType( empty stack options)
13791379
const OptionsForEachRow = Fields?.[data?.backupFieldType]?.options;
@@ -1424,7 +1424,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
14241424
const fieldTypeToMatch = Fields[data?.backupFieldType as keyof Mapping]?.type;
14251425
//check if UID of souce field is matching to exsting content type field UID
14261426
for (const value of contentTypeSchema) {
1427-
if (data?.uid === value?.uid || (data?.uid === value?.uid && data?.otherCmsType === value?.data_type)) {
1427+
if (data?.uid === value?.uid && data?.contentstackFieldType === value?.data_type) {
14281428
OptionsForRow.push({ label: value?.display_name, value, isDisabled: false });
14291429
break;
14301430
}
@@ -1821,10 +1821,23 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
18211821
};
18221822
dispatch(updateNewMigrationData(newMigrationDataObj));
18231823
const resetCT = filteredContentTypes?.map?.(ct =>
1824+
ct?.id === selectedContentType?.id ? { ...ct, status: data?.data?.status } : ct
1825+
)
1826+
1827+
let filteredCT = resetCT;
1828+
if (!isEmptyString(activeFilter)) {
1829+
filteredCT = resetCT?.filter((ct) =>
1830+
CONTENT_MAPPING_STATUS?.[ct?.status] === activeFilter
1831+
);
1832+
}
1833+
1834+
const resetContentTypes = contentTypes?.map?.(ct =>
18241835
ct?.id === selectedContentType?.id ? { ...ct, status: data?.data?.status } : ct
18251836
);
1826-
setFilteredContentTypes(resetCT);
1827-
setContentTypes(resetCT);
1837+
setFilteredContentTypes(filteredCT);
1838+
setContentTypes(resetContentTypes);
1839+
setCount(filteredCT?.length);
1840+
18281841
Notification({
18291842
notificationContent: { text: data?.message },
18301843
notificationProps: {
@@ -2138,6 +2151,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
21382151

21392152
// Function to filter content types as per the status
21402153
const handleContentTypeFilter = (value: string, e: MouseOrKeyboardEvent) => {
2154+
setActiveFilter(value);
21412155
const li_list = document.querySelectorAll('.filter-wrapper li');
21422156
if(li_list) {
21432157
li_list?.forEach((ele) => {
@@ -2240,7 +2254,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
22402254
}
22412255
}}
22422256
>
2243-
{CONTENT_MAPPING_STATUS[key] && <span className='filter-status'>{CONTENT_MAPPING_STATUS[key]}</span> }
2257+
{CONTENT_MAPPING_STATUS[key] && <span className={`${activeFilter === CONTENT_MAPPING_STATUS[key] ? 'filter-status filtetButton-color' :'filter-status' }`}>{CONTENT_MAPPING_STATUS[key]}</span> }
22442258
{STATUS_ICON_Mapping[key] && <Icon size="small" icon={STATUS_ICON_Mapping[key]} className={STATUS_ICON_Mapping[key] === 'CheckedCircle' ? 'mapped-icon' : ''} />}
22452259
</button>
22462260
</li>

0 commit comments

Comments
 (0)