Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion ui/src/components/ContentMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ const dummy_obj:MappingFields = {
'json':{
label:'JSON Rich Text Editor',
options : {
'JSON Rich Text Editor':'json'
'JSON Rich Text Editor':'json',
'HTML Rich text Editor': 'html'
}
},
'html':{
Expand Down
5 changes: 1 addition & 4 deletions ui/src/components/DestinationStack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const DestinationStackComponent = ({
const [isLoading, setIsLoading] = useState<boolean>(true);
// const [isCompleted, setIsCompleted] = useState<boolean>(false);
const [isMigrationLocked, setIsMigrationLocked] = useState<boolean>(false);
const [stepperKey, setStepperKey] = useState<string>('v-mig-destination-step');
const [stepperKey, setStepperKey] = useState<string>('destination-Vertical-stepper');
const [internalActiveStepIndex, setInternalActiveStepIndex] = useState<number>(-1);

const autoVerticalStepperComponent = useRef<any>(null);
Expand Down Expand Up @@ -182,9 +182,6 @@ const DestinationStackComponent = ({
fetchCMSData();
}, []);

useEffect(() => {
setStepperKey('destination-Vertical-stepper');
}, [isLoading]);

useEffect(() => {
updateDestinationStackData();
Expand Down
13 changes: 7 additions & 6 deletions ui/src/components/LegacyCms/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { forwardRef, useEffect, useRef, useState , useImperativeHandle} from 'react';
import { forwardRef, useEffect, useRef, useState , useImperativeHandle, useMemo} from 'react';
import { useDispatch,useSelector } from 'react-redux';
import AutoVerticalStepper from '../Stepper/VerticalStepper/AutoVerticalStepper';
import { getLegacyCMSSteps } from './StepperSteps';
Expand Down Expand Up @@ -45,7 +45,8 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, projectData, isCompleted
const [isMigrationLocked, setIsMigrationLocked] = useState<boolean>(false);
const [isLoading, setIsLoading] = useState<boolean>(true);
const [internalActiveStepIndex, setInternalActiveStepIndex] = useState<number>(-1);
const [stepperKey, setStepperKey] = useState<string>('v-mig-step');
const [stepperKey, setStepperKey] = useState<string>('legacy-Vertical-stepper');

const { projectId = '' } = useParams();
const [isValidated, setisValidated] = useState<boolean>(
newMigrationData?.legacy_cms?.uploadedFile?.isValidated || false
Expand Down Expand Up @@ -202,7 +203,7 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, projectData, isCompleted
}, []);

useEffect(() => {
setStepperKey('legacy-Vertical-stepper');

setisValidated(newMigrationData?.legacy_cms?.uploadedFile?.isValidated || false);
}, [isLoading]);

Expand All @@ -219,9 +220,7 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, projectData, isCompleted
autoVerticalStepper.current.handleDynamicStepChange(internalActiveStepIndex, true);
}
}
}, [internalActiveStepIndex]);

useEffect(()=>{
dispatch(updateNewMigrationData(
{
...newMigrationData,
Expand All @@ -232,7 +231,9 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, projectData, isCompleted

}));

},[internalActiveStepIndex]);

}, [internalActiveStepIndex]);


useEffect(()=>{
if (!isEmptyString(newMigrationData?.legacy_cms?.selectedCms?.cms_id)) {
Expand Down
2 changes: 2 additions & 0 deletions ui/src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import { CS_ENTRIES } from '../../utilities/constants';

// Interface
import { HomepageType } from './home.interface';
import useBlockNavigation from '../../hooks/userNavigation';

const Home = () => {
const [data, setData] = useState<HomepageType>({});
useBlockNavigation(true);

const fetchData = async () => {
//check if offline CMS data field is set to true, if then read data from cms data file.
Expand Down
31 changes: 30 additions & 1 deletion ui/src/pages/Login/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Libraries
import { FC,useEffect, useState } from 'react';
import { FC,useEffect, useRef, useState } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { useDispatch } from 'react-redux';

Expand Down Expand Up @@ -66,6 +66,7 @@ const Login: FC<IProps> = () => {
// ************* ALL States Here ************
const [loginStates, setLoginStates] = useState<IStates>(defaultStates);
const [isLoading, setIsLoading] = useState<boolean>(false)
const [isBlock, setIsBlock] = useState(false);

const navigate = useNavigate();
const location = useLocation();
Expand Down Expand Up @@ -177,6 +178,14 @@ const Login: FC<IProps> = () => {
}
};

useEffect(()=>{
if(region && loginStates?.tfa){
setIsBlock(true);

}

},[loginStates]);

// Function for TFA validation
const TFAValidation = (value: string): string | undefined => {
if (value?.length) {
Expand All @@ -186,6 +195,26 @@ const Login: FC<IProps> = () => {
}
};


useEffect(()=>{
const handlePopState = (event: PopStateEvent) => {
event.preventDefault();
window.history.pushState(null, '', window.location.href);

};
if(isBlock){
window.history.pushState(null, '', window.location.href);

}
window.history.pushState(null, '', window.location.href);
window.addEventListener('popstate',handlePopState);


return () => {
window.removeEventListener('popstate', handlePopState);
};

},[isBlock]);
return (
<AccountPage data={accountData}>
{loginStates?.tfa ? (
Expand Down
3 changes: 2 additions & 1 deletion ui/src/pages/Projects/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ const Projects = () => {
const onClose = () => {
fetchProjects();
};
useBlockNavigation(isModalOpen)
useBlockNavigation(isModalOpen || true);

// Function for open modal
const openModal = () => {
setIsModalOpen(true);
Expand Down