diff --git a/ui/src/components/ContentMapper/index.tsx b/ui/src/components/ContentMapper/index.tsx
index e3b950bb7..89bf53b41 100644
--- a/ui/src/components/ContentMapper/index.tsx
+++ b/ui/src/components/ContentMapper/index.tsx
@@ -501,7 +501,15 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
[key]: { label: item?.display_name, value: item },
}));
}
- if (item?.data_type === "group" && Array.isArray(item?.schema)) {
+ if(contentTypeSchema?.every((item)=> value?.value?.uid !== item?.uid)){
+ setExistingField((prevOptions: ExistingFieldType) => {
+ const { [key]: _, ...rest } = prevOptions; // Destructure to exclude the key to remove
+ return {
+ ...rest
+ };
+ })
+ }
+ else if (item?.data_type === "group" && Array.isArray(item?.schema)) {
item?.schema?.forEach((schemaItem) => {
if (value?.value?.uid === schemaItem?.uid && value?.label === `${item?.display_name} > ${schemaItem?.display_name}`) {
@@ -1918,7 +1926,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
...newMigrationData,
content_mapping:{
...newMigrationData?.content_mapping,
- existingCT: contentTypes,
+ [isContentType ? 'existingCT' : 'existingGlobal']: contentTypes,
content_type_mapping : updatedContentTypeMapping
}
@@ -2289,7 +2297,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
-
+
diff --git a/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx b/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx
index c6c8ab4f3..10408bb29 100644
--- a/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx
+++ b/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx
@@ -386,6 +386,7 @@ const LanguageMapper = () => {
setoptions(allLocales);
Object?.entries(newMigrationData?.destination_stack?.localeMapping)?.length === 0 &&
+ newMigrationData?.project_current_step <= 2 &&
setcmsLocaleOptions((prevList: { label: string; value: string }[]) => {
const newLabel = newMigrationData?.destination_stack?.selectedStack?.master_locale;
diff --git a/ui/src/components/DestinationStack/Actions/LoadStacks.tsx b/ui/src/components/DestinationStack/Actions/LoadStacks.tsx
index 7ef24c9bb..09445e430 100644
--- a/ui/src/components/DestinationStack/Actions/LoadStacks.tsx
+++ b/ui/src/components/DestinationStack/Actions/LoadStacks.tsx
@@ -236,10 +236,10 @@ const LoadStacks = (props: LoadFileFormatProps) => {
dispatch(updateNewMigrationData(newMigrationDataObj));
}
const newMigrationDataObj: INewMigration = {
- // ...newMigrationDataRef?.current,
- ...newMigrationData,
+ ...newMigrationDataRef?.current,
+ //...newMigrationData,
destination_stack: {
- ...newMigrationData?.destination_stack,
+ ...newMigrationDataRef?.current?.destination_stack,
csLocale: csLocales?.data?.locales
}
};
@@ -316,15 +316,17 @@ const LoadStacks = (props: LoadFileFormatProps) => {
+
{
...newMigrationDataRef?.current,
legacy_cms: {
...newMigrationDataRef?.current?.legacy_cms,
- selectedFileFormat: selectedFileFormatObj
+ selectedFileFormat: selectedFileFormatObj,
}
};
@@ -131,7 +131,7 @@ const LoadFileFormat = (props: LoadFileFormatProps) => {
/**** ALL USEEffects HERE ****/
useEffect(()=>{
handleFileFormat();
- handleBtnClick();
+ //handleBtnClick();
},[]);
useEffect(() => {
diff --git a/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx b/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx
index fa8a9a0f8..5c08d8ad0 100644
--- a/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx
+++ b/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx
@@ -89,6 +89,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
//const [isCancelLoading, setIsCancelLoading] = useState(false);
//const [setIsFormatValid] = useState(false);
const [affix, setAffix] = useState(newMigrationData?.legacy_cms?.affix);
+ const [reValidate, setReValidate] = useState(newMigrationData?.legacy_cms?.uploadedFile?.reValidate || false);
const { projectId = '' } = useParams();
@@ -394,6 +395,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
if(!isEmptyString(newMigrationData?.legacy_cms?.affix) && !newMigrationData?.legacy_cms?.uploadedFile?.isValidated ){
setIsDisabled(false);
}
+ setReValidate(newMigrationData?.legacy_cms?.uploadedFile?.reValidate || false);
// else{
// setIsValidated(false);
@@ -466,7 +468,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
isLoading={isLoading}
loadingColor="#6c5ce7"
version="v2"
- disabled={isDisabled || isEmptyString(affix)}
+ disabled={isDisabled || isEmptyString(affix) || reValidate}
>
Validate File
diff --git a/ui/src/components/LegacyCms/index.tsx b/ui/src/components/LegacyCms/index.tsx
index 4a206bb05..4df51d8d4 100644
--- a/ui/src/components/LegacyCms/index.tsx
+++ b/ui/src/components/LegacyCms/index.tsx
@@ -132,7 +132,7 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, isCompleted, handleOnAll
? selectedCmsData.allowed_file_formats?.find(
(cms: ICardType) => cms?.fileformat_id === legacyCMSData?.file_format
)
- : defaultCardType;
+ : newMigrationData?.legacy_cms?.selectedFileFormat;
//Make Step 1 Complete
if (!isEmptyString(selectedCmsData?.cms_id || newMigrationData?.legacy_cms?.selectedCms?.cms_id)) {
@@ -164,7 +164,8 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, isCompleted, handleOnAll
awsData: legacyCMSData?.awsDetails,
isLocalPath: legacyCMSData?.is_localPath
},
- isValidated: legacyCMSData?.is_fileValid ,
+ isValidated: legacyCMSData?.is_fileValid,
+ reValidate: newMigrationData?.legacy_cms?.uploadedFile?.reValidate
}, //need to add backend data once endpoint exposed.
affix: legacyCMSData?.affix ?? '',
isFileFormatCheckboxChecked: true, //need to add backend data once endpoint exposed.
diff --git a/ui/src/context/app/app.interface.ts b/ui/src/context/app/app.interface.ts
index 583aff8b7..e5c841283 100644
--- a/ui/src/context/app/app.interface.ts
+++ b/ui/src/context/app/app.interface.ts
@@ -372,7 +372,7 @@ export const DEFAULT_NEW_MIGRATION: INewMigration = {
destination_stack: DEFAULT_DESTINATION_STACK,
content_mapping: DEFAULT_CONTENT_MAPPER,
test_migration: DEFAULT_TEST_MIGRATION,
- isprojectMapped: false,
+ isprojectMapped: true,
stackDetails: DEFAULT_DROPDOWN,
testStacks: [],
migration_execution: DEFAULT_MIGRATION_EXECUTION_STEP,
diff --git a/ui/src/pages/Migration/index.tsx b/ui/src/pages/Migration/index.tsx
index b6bb4751b..be24fead9 100644
--- a/ui/src/pages/Migration/index.tsx
+++ b/ui/src/pages/Migration/index.tsx
@@ -84,13 +84,14 @@ const Migration = () => {
const [isLoading, setIsLoading] = useState(false);
const [currentStepIndex, setCurrentStepIndex] = useState(0);
const [isCompleted, setIsCompleted] = useState(false);
- const [isProjectMapper, setIsProjectMapper] = useState(false);
+ const [isProjectMapper, setIsProjectMapper] = useState(true);
const [disableMigration, setDisableMigration] = useState(false);
const [isModalOpen, setIsModalOpen] = useState(false);
const saveRef = useRef(null);
+ const newMigrationDataRef = useRef(newMigrationData);
useEffect(() => {
fetchData();
@@ -99,14 +100,14 @@ const Migration = () => {
/**
* Dispatches the isprojectMapped key to redux
*/
- useEffect(()=> {
- dispatch(updateNewMigrationData({
- ...newMigrationData,
- isprojectMapped: isProjectMapper
+ // useEffect(()=> {
+ // dispatch(updateNewMigrationData({
+ // ...newMigrationDataRef?.current,
+ // isprojectMapped: isProjectMapper
- }));
+ // }));
- },[isProjectMapper]);
+ // },[isProjectMapper]);
useBlockNavigation(isModalOpen);
@@ -182,7 +183,7 @@ const Migration = () => {
*/
const fetchProjectData = async () => {
if (isEmptyString(selectedOrganisation?.value) || isEmptyString(params?.projectId)) return;
-
+ setIsProjectMapper(true);
const data = await getMigrationData(selectedOrganisation?.value, params?.projectId ?? '');
const migratedstacks = await getMigratedStacks(selectedOrganisation?.value, projectId );
@@ -190,7 +191,6 @@ const Migration = () => {
setIsLoading(false);
setProjectData(data?.data);
}
- setIsProjectMapper(true);
const projectData = data?.data;
const legacyCmsData:ILegacyCMSComponent = await getCMSDataFromFile(CS_ENTRIES.LEGACY_CMS);
@@ -239,11 +239,11 @@ const Migration = () => {
const projectMapper = {
...newMigrationData,
legacy_cms: {
- ...newMigrationData?.legacy_cms,
+ ...newMigrationDataRef?.current?.legacy_cms,
selectedCms: selectedCmsData,
- selectedFileFormat: selectedFileFormatData,
affix: projectData?.legacy_cms?.affix ,
uploadedFile: {
+ ...newMigrationDataRef?.current?.legacy_cms,
file_details: {
localPath: projectData?.legacy_cms?.file_path,
awsData: {
@@ -289,6 +289,7 @@ const Migration = () => {
},
stackDetails: projectData?.stackDetails,
testStacks: projectData?.test_stacks,
+ isprojectMapped: false,
project_current_step: projectData?.current_step,
};
@@ -502,7 +503,7 @@ const Migration = () => {
} else if (! hasNonEmptyMapping) {
setIsLoading(false);
Notification({
- notificationContent: { text: 'Please complete the language mapping to preceed futher' },
+ notificationContent: { text: 'Please complete the language mapping to proceed futher' },
type: 'warning'
});
}