diff --git a/ui/src/components/LegacyCms/Actions/LoadSelectCms.tsx b/ui/src/components/LegacyCms/Actions/LoadSelectCms.tsx
index fffbaa1c3..c60f35bb1 100644
--- a/ui/src/components/LegacyCms/Actions/LoadSelectCms.tsx
+++ b/ui/src/components/LegacyCms/Actions/LoadSelectCms.tsx
@@ -52,7 +52,7 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
/**** ALL METHODS HERE ****/
//Handle Legacy cms selection
- const handleDirectSelection = (cms:any) => {
+ const handleDirectSelection = async (cms:any) => {
setSelectedCard(cms);
updateNewMigrationData({
@@ -61,10 +61,11 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
...newMigrationData?.legacy_cms,
selectedCms: cms }
});
- updateLegacyCMSData(selectedOrganisation?.value, projectId, { legacy_cms: cms?.cms_id });
- if(selectedCard?.title){
- props?.handleStepChange(props?.currentStep);
- }
+
+ await updateLegacyCMSData(selectedOrganisation?.value, projectId, { legacy_cms: cms?.cms_id });
+
+ props?.handleStepChange(props?.currentStep);
+
};
//Handle CMS Filter Updation in local storage.
@@ -89,14 +90,18 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
const filterCMSData = async (searchText: string) => {
const { all_cms = [] } = migrationData?.legacyCMSData || {};
- const cmstype = cmsType // Fetch the specific CMS type
+
+ const res: any = await fileValidation();
+ const cms = res?.data?.file_details?.cmsType?.toLowerCase();
+ setCmsType(cms);
+ const cmstype = cms // Fetch the specific CMS type
let filteredCmsData: ICMSType[] = [];
if (isEmptyString(searchText) && !validateArray(cmsFilter) && !cmstype) {
filteredCmsData = all_cms;
} else {
- if (cmstype) {
- filteredCmsData = all_cms?.filter((cms: ICMSType) => cms?.cms_id === cmstype);
+ if (cmstype) {
+ filteredCmsData = all_cms?.filter((cms: ICMSType) => cms?.cms_id === cmstype);
}
}
@@ -116,11 +121,12 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
- const newSelectedCard = filteredCmsData?.some((cms) => cms?.cms_id === cmstype) ? filteredCmsData?.[0] : DEFAULT_CMS_TYPE
-
+ const newSelectedCard = filteredCmsData?.some((cms) => cms?.cms_id === cmstype) ? filteredCmsData?.[0] : DEFAULT_CMS_TYPE
+
setSelectedCard(newSelectedCard);
+
- if (newSelectedCard && selectedCard?.cms_id) {
+ if (newSelectedCard) {
setSelectedCard(newSelectedCard);
const newMigrationDataObj: INewMigration = {
@@ -151,21 +157,27 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
}, [cmsFilter]);
useEffect(()=>{
- handleDirectSelection(selectedCard)
+ if(selectedCard?.title !== 'Drupal' && selectedCard?.title !== 'Sitecore'){
+ handleDirectSelection(selectedCard)
+ }
},[cmsType,selectedCard]);
useEffect(() => {
const getCmsType = async () => {
const res: any = await fileValidation();
- const cmsType = res?.data?.file_details?.cmsType?.toLowerCase();
- setCmsType(cmsType);
+ const cms = res?.data?.file_details?.cmsType?.toLowerCase();
+ setCmsType(cms);
+ filterCMSData(cms);
return cmsType;
};
- }, []);
+ getCmsType();
+
+ }, [cmsType]);
- return (
-
+ return (
+
+
{(cmsType === 'sitecore' || cmsType === 'drupal') && (
@@ -194,7 +206,7 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
{return}}
+ onCardClick={handleDirectSelection}
selectedCard={selectedCard}
idField="cms_id"
/>
@@ -215,7 +227,7 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
)}
)}
-
+
{isEmptyString(newMigrationData?.legacy_cms?.selectedCms?.title) &&
(
Please enter the correct CMS
diff --git a/ui/src/components/Stepper/FlowStepper/FlowBlockItem.tsx b/ui/src/components/Stepper/FlowStepper/FlowBlockItem.tsx
index e9e3f727f..01482e1a2 100644
--- a/ui/src/components/Stepper/FlowStepper/FlowBlockItem.tsx
+++ b/ui/src/components/Stepper/FlowStepper/FlowBlockItem.tsx
@@ -16,16 +16,19 @@ interface FlowBlockItemProps {
isActive?: boolean;
isCompleted?: boolean;
step: IFlowStep;
- onStepClick: (step: IFlowStep) => () => void;
+ onStepClick: (step: IFlowStep, isCompleted:boolean) => () => void;
}
const FlowBlockItem: FC
= (props: FlowBlockItemProps) => {
+ //console.log("isComeplted : ", props?.isCompleted, props?.step);
+
const [isHovered, setIsHovered] = useState(false);
const handleHoveredToggle = (flag: boolean) => () => {
setIsHovered(flag);
};
+
return (
@@ -38,9 +41,9 @@ const FlowBlockItem: FC = (props: FlowBlockItemProps) => {
{props?.step.name}
@@ -49,8 +52,8 @@ const FlowBlockItem: FC
= (props: FlowBlockItemProps) => {
{
/** ALL HOOKS Here */
const params = useParams();
const navigate = useNavigate();
- const { migrationData, updateMigrationData } = useContext(AppContext);
-
- const onStepClick = (step: IFlowStep) => () => {
- if (params.stepId === `${step.name}`) return;
+ const { migrationData, updateMigrationData, selectedOrganisation } = useContext(AppContext);
+ const onStepClick = (step: IFlowStep, isCompleted: boolean) => async() => {
+ if (params?.stepId === `${step?.name}`) return;
+
updateMigrationData({ currentFlowStep: step });
- const url = `/projects/${params?.projectId}/migration/steps/${step.name}`;
+
+ const url = `/projects/${params?.projectId}/migration/steps/${step?.name}`;
- navigate(url, { replace: true });
+ navigate(url, { replace: true });
+
};
return (
{validateArray(migrationData?.allFlowSteps) ? (
- migrationData?.allFlowSteps?.map((step: IFlowStep) => (
+ migrationData?.allFlowSteps?.map((step: IFlowStep) => {
+ return(
+step.name}
+ isActive={params?.stepId === `${step?.name}`}
+ key={step?.flow_id}
+ isCompleted={currentStep > +step?.name}
/>
- ))
+ )})
) : (
<>>
)}
diff --git a/ui/src/components/Stepper/FlowStepper/flowStep.interface.ts b/ui/src/components/Stepper/FlowStepper/flowStep.interface.ts
index 0648a82fe..4546e33bf 100644
--- a/ui/src/components/Stepper/FlowStepper/flowStep.interface.ts
+++ b/ui/src/components/Stepper/FlowStepper/flowStep.interface.ts
@@ -4,6 +4,7 @@ export interface IFlowStep {
description: string;
name: string;
flow_id: string;
+ isCompleted: boolean
}
export const DEFAULT_IFLOWSTEP: IFlowStep = {
@@ -11,5 +12,6 @@ export const DEFAULT_IFLOWSTEP: IFlowStep = {
description: '',
name: '1',
flow_id: '',
- group_name: ''
+ group_name: '',
+ isCompleted:false
};