From 210fc1f92bf5aefba817ed9783eec6c107e95414 Mon Sep 17 00:00:00 2001 From: AishDani Date: Thu, 25 Jul 2024 13:16:17 +0530 Subject: [PATCH 1/3] refactor:replaced fetch and reset icons with buttons --- ui/src/components/ContentMapper/index.tsx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/ui/src/components/ContentMapper/index.tsx b/ui/src/components/ContentMapper/index.tsx index 01d7617b7..002e1608d 100644 --- a/ui/src/components/ContentMapper/index.tsx +++ b/ui/src/components/ContentMapper/index.tsx @@ -1277,7 +1277,9 @@ const ContentMapper = ({projectData}:ContentMapperComponentProps) => { return result; } const tableHeight = calcHeight(); - + + //variable for button component in table + const onlyIcon= true; return (
@@ -1393,18 +1395,18 @@ const ContentMapper = ({projectData}:ContentMapperComponentProps) => {
{!IsEmptyStack && ( - + + )} - + {!IsEmptyStack && ( From 95298722a189aaa9cf5a79651b0dd81c9da81e4e Mon Sep 17 00:00:00 2001 From: AishDani Date: Thu, 25 Jul 2024 14:03:33 +0530 Subject: [PATCH 2/3] refactor:legacy cms bugs --- .../LegacyCms/Actions/LoadPrefix.tsx | 11 +++++++++++ .../LegacyCms/Actions/LoadUploadFile.tsx | 4 ++-- ui/src/components/LegacyCms/index.tsx | 19 +++++++++++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx b/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx index af7c68a3a..2ef435913 100644 --- a/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx +++ b/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx @@ -128,6 +128,17 @@ const LoadPreFix = (props: LoadSelectCmsProps) => { } else { setIsError(true); setErrorMessage('Please enter Affix'); + const newMigrationDataObj: INewMigration = { + ...newMigrationData, + legacy_cms: { + ...newMigrationData?.legacy_cms, + affix: value, + isRestictedKeywordCheckboxChecked: isCheckedBoxChecked + } + }; + + dispatch(updateNewMigrationData(newMigrationDataObj)); + } }); diff --git a/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx b/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx index d6a47ac30..49738903d 100644 --- a/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx +++ b/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx @@ -155,8 +155,8 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { } else{ - //setIsValidated(false); - setValidationMessage('Validation Falied'); + setIsValidated(false); + setValidationMessage('Validation is failed'); setIsValidationAttempted(true); setProgressPercentage(100); diff --git a/ui/src/components/LegacyCms/index.tsx b/ui/src/components/LegacyCms/index.tsx index bea44d7fb..c2149009b 100644 --- a/ui/src/components/LegacyCms/index.tsx +++ b/ui/src/components/LegacyCms/index.tsx @@ -50,7 +50,7 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, projectData, isCompleted const [isValidated, setisValidated] = useState( newMigrationData?.legacy_cms?.uploadedFile?.isValidated || false ); - + const [isAllStepsCompleted, setIsAllStepsCompleted] = useState(false); const navigate = useNavigate(); const autoVerticalStepper = useRef(null); @@ -185,7 +185,7 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, projectData, isCompleted }, isValidated: legacyCMSData?.is_fileValid || newMigrationData?.legacy_cms?.uploadedFile?.isValidated, }, //need to add backend data once endpoint exposed. - affix: legacyCMSData?.affix || newMigrationData?.legacy_cms?.affix || '', + affix: legacyCMSData?.affix || '', isFileFormatCheckboxChecked: true, //need to add backend data once endpoint exposed. isRestictedKeywordCheckboxChecked: true //need to add backend data once endpoint exposed. } @@ -249,6 +249,21 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, projectData, isCompleted } },[newMigrationData]); + + useEffect(()=>{ + if(! isEmptyString(newMigrationData?.legacy_cms?.affix) + && !isEmptyString(newMigrationData?.legacy_cms?.selectedFileFormat?.title) && + ! isEmptyString(newMigrationData?.legacy_cms?.selectedCms?.title) && + newMigrationData?.legacy_cms?.uploadedFile?.isValidated){ + setIsAllStepsCompleted(true); + handleAllStepsComplete(true); + } + else{ + setIsAllStepsCompleted(false); + handleAllStepsComplete(false); + + } + },[newMigrationData,isAllStepsCompleted]) return ( <> From bf4230857a3f77530d7f0408806cbfc19101b2f0 Mon Sep 17 00:00:00 2001 From: AishDani Date: Thu, 25 Jul 2024 14:14:44 +0530 Subject: [PATCH 3/3] refactor:legacy cms bugs --- .../LegacyCms/Actions/LoadUploadFile.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx b/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx index 49738903d..be2521a37 100644 --- a/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx +++ b/ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { FileDetails, INewMigration } from '../../../context/app/app.interface'; import { fileValidation, getConfig } from '../../../services/api/upload.service'; @@ -57,7 +57,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { const selectedOrganisation = useSelector((state:RootState)=>state?.authentication?.selectedOrganisation); const migrationData = useSelector((state:RootState)=>state?.migration?.migrationData); - + const newMigrationDataRef = useRef(newMigrationData); const dispatch = useDispatch(); const [isLoading, setIsLoading] = useState(false); const [isValidated, setIsValidated] = useState(newMigrationData?.legacy_cms?.uploadedFile?.isValidated); @@ -104,9 +104,9 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { const newMigrationDataObj: INewMigration = { - ...newMigrationData, + ...newMigrationDataRef?.current, legacy_cms: { - ...newMigrationData?.legacy_cms, + ...newMigrationDataRef?.current?.legacy_cms, uploadedFile: { name: res?.data?.localPath, url: res?.data?.localPath, @@ -216,9 +216,9 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { setFileExtension(extension); const newMigrationDataObj: INewMigration = { - ...newMigrationData, + ...newMigrationDataRef?.current, legacy_cms: { - ...newMigrationData?.legacy_cms, + ...newMigrationDataRef?.current?.legacy_cms, uploadedFile: { name: res?.data?.localPath, url: res?.data?.localPath, @@ -397,6 +397,10 @@ const LoadUploadFile = (props: LoadUploadFileProps) => { },[newMigrationData?.legacy_cms?.selectedFileFormat]); + useEffect(() => { + newMigrationDataRef.current = newMigrationData; + }, [newMigrationData]); + const validationClassName = isValidated ? 'success' : 'error'; const containerClassName = `validation-container ${isValidationAttempted && !isValidated ? 'error-container pb-2' : ''}`;