Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b9f8d52
solved bugs
snehalsankhe Aug 28, 2024
e48781b
solved bugs
snehalsankhe Aug 28, 2024
c81f4a5
merged from dev
snehalsankhe Aug 28, 2024
1c887a1
Merge pull request #252 from contentstack/bugsDest
RohitKini Aug 28, 2024
1db0093
refactor:resolved checkbox and advance propertise bugs of content mapper
AishDani Aug 29, 2024
b64b061
Merge branch 'dev' of github.com:contentstack/migration-v2-node-serve…
AishDani Aug 29, 2024
47ea753
Merge pull request #253 from contentstack/bugfix/legacy-cms
RohitKini Aug 29, 2024
a4a9359
refactor:resolved advanced propertise bugs
AishDani Aug 29, 2024
2d3b6e6
refactor:removed log
AishDani Aug 29, 2024
1388b66
Merge pull request #254 from contentstack/bugfix/legacy-cms
RohitKini Aug 29, 2024
ae74707
solved bugs
snehalsankhe Aug 29, 2024
60a7438
merged from dev
snehalsankhe Aug 29, 2024
123073f
optimised code
snehalsankhe Aug 29, 2024
eb7a099
Merge pull request #255 from contentstack/bugsDest
RohitKini Aug 30, 2024
b5426c7
[CMG-254]
sayalijoshi27 Sep 2, 2024
b75c511
region fixes
sayalijoshi27 Sep 2, 2024
02011ae
Merge pull request #257 from contentstack/bugfix/content-mapper
RohitKini Sep 2, 2024
2098bd6
Merge branch 'dev' of github.com:contentstack/migration-v2-node-serve…
AishDani Sep 2, 2024
4b7102c
refactor:refactored the legacy cms redux with the new redux setup me…
AishDani Sep 2, 2024
a1e193f
refactor:legacy cms redux logic
AishDani Sep 2, 2024
dfe412e
refactor:removed projectdata prop from legacy cms
AishDani Sep 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ui/src/cmsData/region_login.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"_metadata": { "uid": "cs77a3bf15c456afbb" }
},
{
"region": "EU",
"region": "GCP_NA",
"service_icon": {
"uid": "blt57dafa9c1472b46f",
"created_at": "2024-07-29T10:57:59.058Z",
Expand Down Expand Up @@ -82,7 +82,7 @@
}
},
{
"region": "AZURE_EU",
"region": "EU",
"service_icon": {
"uid": "bltbe45879eac0025d8",
"created_at": "2023-10-31T06:59:22.783Z",
Expand All @@ -106,7 +106,7 @@
"_metadata": { "uid": "csf578f8fbea1ae0c0" }
},
{
"region": "GCP_NA",
"region": "AZURE_EU",
"service_icon": {
"uid": "blt85d2a7024c613199",
"created_at": "2023-10-31T07:00:56.567Z",
Expand Down
76 changes: 48 additions & 28 deletions ui/src/components/ContentMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,52 @@ const ContentMapper = forwardRef(({projectData}: ContentMapperComponentProps, re
}, [contentTypeMapped, otherCmsTitle]);

useEffect(() => {
const updatedExstingField: ExistingFieldType = {};
const checkKey = Object.keys(contentTypeMapped).find(key => contentTypeMapped[key] === contentTypeMapped[otherCmsTitle]);

if (checkKey === otherCmsTitle) {
// if (checkKey === otherCmsTitle) {
tableData?.forEach((row) => {
if (row?.contentstackField) {
updatedExstingField[row?.uid] = {
label: row?.contentstackField,
value: row?.contentstackField
};
}
contentTypeSchema?.forEach((schema) => {

if (row?.contentstackField === schema?.display_name) {
updatedExstingField[row?.uid] = {
label: schema?.display_name,
value: schema
};
}

if(schema?.schema) {
schema?.schema?.forEach((childSchema) => {
if(row?.contentstackField === `${schema?.display_name} > ${childSchema?.display_name}`){

updatedExstingField[row?.uid] = {
label: `${schema?.display_name} > ${childSchema?.display_name}`,
value: childSchema
}
}
})
}
});
});
//setExistingField(updatedExstingField);
}

setExistingField(updatedExstingField);
// }
}, [tableData, otherCmsTitle]);

useEffect(() => {
if (isUpdated) {
setTableData(updatedRows);
setExistingField(updatedExstingField);
setSelectedOptions(updatedSelectedOptions);
setSelectedEntries(updatedRows);
setIsUpdated(false);
}
else{
setExistingField({});
setSelectedOptions([]);

}
}, [isUpdated, otherContentType]);

// To make all the fields checked
useEffect(() => {
const selectedId = tableData.reduce<UidMap>((acc, item) => {
Expand Down Expand Up @@ -834,7 +864,7 @@ const ContentMapper = forwardRef(({projectData}: ContentMapperComponentProps, re
}


setExistingField((prevOptions) => ({
setExistingField((prevOptions: any) => ({
...prevOptions,
[rowIndex]: { label: selectedValue?.label, value: selectedValue?.value }
}));
Expand Down Expand Up @@ -871,15 +901,15 @@ const ContentMapper = forwardRef(({projectData}: ContentMapperComponentProps, re
return {
...row,
contentstackField: selectedValue?.label,
contentstackFieldUid: selectedValue?.value?.uid,
advanced: {
validationRegex: selectedValue?.value?.format,
Mandatory: selectedValue?.value?.mandatory,
Multiple: selectedValue?.value?.multiple,
Unique: selectedValue?.value?.unique,
NonLocalizable: selectedValue?.value?.non_localizable,
MinChars: selectedValue?.value?.max,
MaxChars: selectedValue?.value?.min,

MaxChars: selectedValue?.value?.min
}
};
}
Expand Down Expand Up @@ -1130,6 +1160,7 @@ const ContentMapper = forwardRef(({projectData}: ContentMapperComponentProps, re
return {
...row,
contentstackField: OptionsForRow[0]?.value?.display_name ?? '',
contentstackFieldUid: OptionsForRow[0]?.value?.uid ?? '',
advanced: {
validationRegex: OptionsForRow[0]?.value?.format ?? '',
Mandatory: OptionsForRow[0]?.value?.mandatory,
Expand All @@ -1151,7 +1182,9 @@ const ContentMapper = forwardRef(({projectData}: ContentMapperComponentProps, re

// Check if there's already a matching entry in updatedExstingField
const hasMatchingEntry = Object.values(updatedExstingField).some(
(entry) =>{ return entry?.label === newLabel }
(entry) =>{
return entry?.label === newLabel
}
);

if (!hasMatchingEntry) {
Expand Down Expand Up @@ -1269,20 +1302,7 @@ const ContentMapper = forwardRef(({projectData}: ContentMapperComponentProps, re
};


useEffect(() => {
if (isUpdated) {
setTableData(updatedRows);
setExistingField(updatedExstingField);
setSelectedOptions(updatedSelectedOptions);
setSelectedEntries(updatedRows);
setIsUpdated(false);
}
else{
setExistingField({});
setSelectedOptions([]);

}
}, [isUpdated, otherContentType]);


const handleSaveContentType = async () => {
const orgId = selectedOrganisation?.uid;
Expand Down