diff --git a/ui/src/cmsData/legacyCms.json b/ui/src/cmsData/legacyCms.json
index 85f1c00e9..ad07c4b3c 100644
--- a/ui/src/cmsData/legacyCms.json
+++ b/ui/src/cmsData/legacyCms.json
@@ -269,4 +269,4 @@
"restricted_keyword_checkbox_text": "Please acknowledge that you have referred to the Contentstack restricted keywords",
"affix_cta": "Continue",
"file_format_cta": "Continue"
-}
\ No newline at end of file
+}
diff --git a/ui/src/components/AdvancePropertise/index.tsx b/ui/src/components/AdvancePropertise/index.tsx
index 1b60299b4..87dd78ec7 100644
--- a/ui/src/components/AdvancePropertise/index.tsx
+++ b/ui/src/components/AdvancePropertise/index.tsx
@@ -1,9 +1,6 @@
import {
ModalBody,
- ModalFooter,
ModalHeader,
- Button,
- ButtonGroup,
FieldLabel,
TextInput,
ToggleSwitch
@@ -13,6 +10,8 @@ import './index.scss';
export interface SchemaProps {
fieldtype: string;
+ value: any;
+ rowId: string;
closeModal: () => void;
}
const AdvancePropertise = (props: SchemaProps) => {
@@ -33,24 +32,36 @@ const AdvancePropertise = (props: SchemaProps) => {
Options
-
-
-
-
+
+
+
+
If enabled, editing this field is restricted in localized entries. The field will use
the value of the master-language entry in all localized entries.
- {/*
-
-
-
-
- */}
>
);
};
diff --git a/ui/src/components/Card/card.scss b/ui/src/components/Card/card.scss
index 39baf969b..a1f21cbe2 100644
--- a/ui/src/components/Card/card.scss
+++ b/ui/src/components/Card/card.scss
@@ -68,8 +68,8 @@
}
.ProjectCard__modified-date {
color: $color-font-base;
- display:block;
- font-size:$size-font-small;
+ display: block;
+ font-size: $size-font-small;
font-weight: $font-weight-regular;
line-height: $line-height-reset;
padding-left: 8px;
diff --git a/ui/src/components/Card/index.tsx b/ui/src/components/Card/index.tsx
index 7ff8700f5..07a7a9276 100644
--- a/ui/src/components/Card/index.tsx
+++ b/ui/src/components/Card/index.tsx
@@ -19,19 +19,17 @@ const CardList = ({ project }: ProjectType) => {
if (isEmptyString(id)) return;
navigate(`/projects/${id}/migration/steps/1`);
};
-
useEffect(() => {
const fetchProject = async () => {
- const { data, status } = await getProject(
- selectedOrganisation?.value || '',
- project?.id || ''
- );
- if (data?.legacy_cms && status === 200) {
- setprojectDetails(data?.legacy_cms?.cms);
+ if (selectedOrganisation?.value && project?.id) {
+ const { data, status } = await getProject(selectedOrganisation?.value, project?.id);
+ if (status === 200 && data?.legacy_cms) {
+ setprojectDetails(data?.legacy_cms.cms);
+ }
}
};
fetchProject();
- }, [projectDetails]);
+ }, [selectedOrganisation?.value, project?.id]);
return (
diff --git a/ui/src/components/Common/Settings/Settings.scss b/ui/src/components/Common/Settings/Settings.scss
index dda7f602d..cfb8d60e0 100644
--- a/ui/src/components/Common/Settings/Settings.scss
+++ b/ui/src/components/Common/Settings/Settings.scss
@@ -13,7 +13,7 @@
.PageLayout {
width: 100%;
}
- .PageLayout__head {
+ .PageLayout__head {
border-left: 0 none;
}
}
diff --git a/ui/src/components/ContentMapper/contentMapper.interface.ts b/ui/src/components/ContentMapper/contentMapper.interface.ts
index 0a85ad55f..02e05cf29 100644
--- a/ui/src/components/ContentMapper/contentMapper.interface.ts
+++ b/ui/src/components/ContentMapper/contentMapper.interface.ts
@@ -93,6 +93,10 @@ export interface ContentTypeList {
export interface optionsType {
label?: string;
- value?: string;
+ value?: object;
isDisabled?: boolean;
}
+
+export interface ExstingContentTypeMatch {
+ [key: string]: string;
+}
diff --git a/ui/src/components/ContentMapper/index.tsx b/ui/src/components/ContentMapper/index.tsx
index 554d2fcd7..73aaf204e 100644
--- a/ui/src/components/ContentMapper/index.tsx
+++ b/ui/src/components/ContentMapper/index.tsx
@@ -81,10 +81,19 @@ const Fields: Mapping = {
CheckBox: 'Select'
};
+interface ContentTypeMap {
+ [key: string]: string;
+}
+
const ContentMapper = () => {
/** ALL CONTEXT HERE */
- const { migrationData, updateMigrationData, newMigrationData, updateNewMigrationData } =
- useContext(AppContext);
+ const {
+ migrationData,
+ updateMigrationData,
+ newMigrationData,
+ updateNewMigrationData,
+ selectedOrganisation
+ } = useContext(AppContext);
const {
contentMappingData: {
@@ -112,10 +121,20 @@ const ContentMapper = () => {
const [contentTypesList, setContentTypesList] = useState
([]);
const [IsEmptyStack, setIsEmptyStack] = useState(false);
const [selectedContentType, setSelectedContentType] = useState();
- const [OtherContentType, setOtherContentType] = useState();
const [exstingField, setexsitingField] = useState({});
const [selectedOptions, setSelectedOptions] = useState([]);
const [isButtonLoading, setisButtonLoading] = useState(false);
+ const [isDropDownChanged, setisDropDownCHanged] = useState(false);
+ const [contentTypeMapped, setcontentTypeMapped] = useState(
+ newMigrationData?.content_mapping?.content_type_mapping || {}
+ );
+ const [OtherContentType, setOtherContentType] = useState({
+ label: contentTypeMapped?.[otherCmsTitle],
+ value: contentTypeMapped?.[otherCmsTitle]
+ });
+ const [otherCmsUid, setotherCmsUid] = useState(contentTypes[0]?.otherCmsUid);
+ const [isContentTypeMapped, setisContentTypeMapped] = useState(false);
+ const [isContentTypeSaved, setisContentTypeSaved] = useState(false);
const [active, setActive] = useState(null ?? 0);
@@ -149,6 +168,30 @@ const ContentMapper = () => {
});
}, []);
+ useEffect(() => {
+ if (contentTypeMapped && otherCmsTitle) {
+ setOtherContentType({
+ label: contentTypeMapped?.[otherCmsTitle] ?? 'Select Content Type',
+ value: contentTypeMapped?.[otherCmsTitle] ?? 'Select Content Type'
+ });
+ }
+ }, [contentTypeMapped, otherCmsTitle]);
+
+ useEffect(() => {
+ const updatedExstingField: any = {};
+ if (isContentTypeSaved) {
+ tableData?.forEach((row) => {
+ if (row?.contentstackField) {
+ updatedExstingField[row?.uid] = {
+ label: row?.contentstackField,
+ value: row?.contentstackField
+ };
+ }
+ });
+ setexsitingField(updatedExstingField);
+ }
+ }, [tableData, isContentTypeSaved]);
+
// Method to fetch content types
const fetchContentTypes = async (searchText: string) => {
const { data } = await getContentTypes(projectId || '', 0, 10, ''); //org id will always present
@@ -158,6 +201,7 @@ const ContentMapper = () => {
setTotalCounts(data?.contentTypes?.[0]?.fieldMapping?.length);
setOtherCmsTitle(data?.contentTypes?.[0]?.otherCmsTitle);
setContentTypeUid(data?.contentTypes?.[0]?.id);
+ setotherCmsUid(data?.contentTypes?.[0]?.otherCmsUid);
fetchFields(data?.contentTypes?.[0]?.id, searchText);
};
const stackStatus = async () => {
@@ -248,9 +292,17 @@ const ContentMapper = () => {
// Method to change the content type
const openContentType = (e: React.MouseEvent, i: number) => {
setActive(i);
- setOtherCmsTitle(contentTypes?.[i]?.otherCmsTitle);
+
+ const otherTitle = contentTypes?.[i]?.otherCmsTitle;
+ setOtherCmsTitle(otherTitle);
+ const option = contentTypeMapped?.[otherTitle] ?? 'Select Content Type';
+ setOtherContentType({ label: option, value: option });
+
setContentTypeUid(contentTypes?.[i]?.id);
setCurrentIndex(i);
+ setotherCmsUid(contentTypes?.[i]?.otherCmsUid);
+ setSelectedContentType(contentTypes?.[i]);
+
fetchFields(contentTypes?.[i]?.id, searchText);
};
@@ -313,27 +365,29 @@ const ContentMapper = () => {
const accessorCall = (data: FieldMapType) => {
return (
-
{data?.otherCmsField}
+
{data?.otherCmsField}
- Other CMS Type: {data?.otherCmsType}
- UID: {data?.uid}
+ Other CMS Type: {data?.otherCmsType}
+
+ UID: {data?.uid}
- )
+ );
};
interface UidMap {
[key: string]: boolean;
}
const rowIds = tableData.reduce((acc, item) => {
- acc[item.id] = true;
+ acc[item?.id] = true;
return acc;
}, {});
// Method for change select value
const handleValueChange = (value: FieldTypes, rowIndex: string) => {
+ setisDropDownCHanged(true);
setFieldValue(value);
- const updatedRows = tableData.map((row) => {
- if (row.uid === rowIndex) {
+ const updatedRows = tableData?.map((row) => {
+ if (row?.uid === rowIndex) {
return { ...row, ContentstackFieldType: value?.value };
}
return row;
@@ -344,12 +398,22 @@ const ContentMapper = () => {
const handleDropDownChange = (value: FieldTypes) => {
setOtherContentType(value);
// fetchFields(contentTypes?.[i]?.id, searchText);
-
};
- const handleAdvancedSetting = (fieldtype: string) => {
+ const handleAdvancedSetting = (
+ fieldtype: string,
+ fieldvalue: ExistingFieldType,
+ rowId: string
+ ) => {
return cbModal({
- component: (props: ModalObj) => ,
+ component: (props: ModalObj) => (
+
+ ),
modalProps: {
shouldCloseOnOverlayClick: true
}
@@ -407,25 +471,30 @@ const ContentMapper = () => {
version="v2"
icon="Setting"
size="small"
- onClick={() => handleAdvancedSetting(data?.ContentstackFieldType)}
+ onClick={() =>
+ handleAdvancedSetting(data?.ContentstackFieldType, exstingField, data?.uid)
+ }
/>
);
};
const handleFieldChange = (selectedValue: FieldTypes, rowIndex: string) => {
+ setisDropDownCHanged(true);
setexsitingField((prevOptions) => ({
...prevOptions,
[rowIndex]: { label: selectedValue?.label, value: selectedValue?.value }
}));
- setSelectedOptions((prevSelected) => {
- const newValue = selectedValue?.label;
- return prevSelected.includes(newValue) ? prevSelected : [...prevSelected, newValue];
- });
+ if (isDropDownChanged && isContentTypeSaved) {
+ setSelectedOptions((prevSelected) => {
+ const newValue = selectedValue?.label;
+ return prevSelected?.includes(newValue) ? prevSelected : [...prevSelected, newValue];
+ });
+ }
const updatedRows = tableData.map((row) => {
- if (row.uid === rowIndex) {
+ if (row?.uid === rowIndex) {
return { ...row, contentstackField: selectedValue?.label };
}
return row;
@@ -472,53 +541,53 @@ const ContentMapper = () => {
!value?.field_metadata?.allow_rich_text &&
!value?.field_metadata?.markdown
) {
- OptionsForRow.push({ label: value?.display_name, value: key, isDisabled: false });
+ OptionsForRow.push({ label: value?.display_name, value: value, isDisabled: false });
}
break;
case 'multiline':
if (value?.field_metadata?.multiline === true) {
- OptionsForRow.push({ label: value?.display_name, value: key, isDisabled: false });
+ OptionsForRow.push({ label: value?.display_name, value: value, isDisabled: false });
}
break;
case 'url':
if (value?.uid === 'url') {
- OptionsForRow.push({ label: value?.display_name, value: key, isDisabled: false });
+ OptionsForRow.push({ label: value?.display_name, value: value, isDisabled: false });
}
break;
case 'file':
if (value?.data_type === 'file') {
- OptionsForRow.push({ label: value?.display_name, value: key, isDisabled: false });
+ OptionsForRow.push({ label: value?.display_name, value: value, isDisabled: false });
}
break;
case 'number':
if (value?.data_type === 'number' && !value?.enum) {
- OptionsForRow.push({ label: value?.display_name, value: key, isDisabled: false });
+ OptionsForRow.push({ label: value?.display_name, value: value, isDisabled: false });
}
break;
case 'isodate':
if (value?.data_type === 'isodate') {
- OptionsForRow.push({ label: value?.display_name, value: key, isDisabled: false });
+ OptionsForRow.push({ label: value?.display_name, value: value, isDisabled: false });
}
break;
case 'json':
if (value?.data_type === 'json') {
- OptionsForRow.push({ label: value?.display_name, value: key, isDisabled: false });
+ OptionsForRow.push({ label: value?.display_name, value: value, isDisabled: false });
}
break;
case 'enum':
if ('enum' in value) {
- OptionsForRow.push({ label: value?.display_name, value: key, isDisabled: false });
+ OptionsForRow.push({ label: value?.display_name, value: value, isDisabled: false });
}
break;
case 'allow_rich_text':
if (value?.field_metadata?.allow_rich_text === true) {
- OptionsForRow.push({ label: value?.display_name, value: key, isDisabled: false });
+ OptionsForRow.push({ label: value?.display_name, value: value, isDisabled: false });
}
break;
default:
OptionsForRow.push({
label: 'No matches found',
- value: 'No matches found',
+ value: { 'No matches found': '' },
isDisabled: false
});
break;
@@ -539,38 +608,76 @@ const ContentMapper = () => {
}));
return (
-
-