Skip to content

Commit c0bae06

Browse files
committed
Revert "refactor:CMG-506:refactored user flow when content mapper not generated by enabling save and continue button"
This reverts commit 35356c2.
1 parent e4e3358 commit c0bae06

File tree

7 files changed

+16
-56
lines changed

7 files changed

+16
-56
lines changed

ui/src/components/ContentMapper/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ const Fields: MappingFields = {
215215

216216
}
217217
type contentMapperProps = {
218-
handleStepChange: (step: number) => void;
218+
handleStepChange: (currentStep: number) => void;
219219
}
220220

221221
const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: React.ForwardedRef<ContentTypeSaveHandles>) => {
@@ -2410,8 +2410,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
24102410
...newMigrationData?.legacy_cms,
24112411
uploadedFile:{
24122412
...newMigrationData?.legacy_cms?.uploadedFile,
2413-
reValidate: true,
2414-
file_revalidated: true
2413+
reValidate: true
24152414
}
24162415
}
24172416
}

ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
137137
buketKey: data?.file_details?.awsData?.buketKey
138138
}
139139
},
140-
cmsType: data?.cmsType,
141-
file_revalidated: true
140+
cmsType: data?.cmsType
142141

143142
}
144143
}

ui/src/components/MigrationFlowHeader/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const MigrationFlowHeader = ({
3636
}: MigrationFlowHeaderProps) => {
3737
const [projectName, setProjectName] = useState('');
3838
const [currentStep, setCurrentStep] = useState<number>(0);
39-
const [contentMapperLength, setcontentMapperLength] = useState<number>();
4039

4140
const navigate = useNavigate();
4241
const params: Params<string> = useParams();
@@ -57,7 +56,6 @@ const MigrationFlowHeader = ({
5756
const fetchProject = async () => {
5857
setProjectName(projectData?.name);
5958
setCurrentStep(projectData?.current_step);
60-
setcontentMapperLength(projectData?.content_mapper?.length)
6159

6260
//Navigate to lastest or active Step
6361
const url = `/projects/${params?.projectId}/migration/steps/${projectData?.current_step}`;
@@ -96,8 +94,6 @@ const MigrationFlowHeader = ({
9694
newMigrationData?.destination_stack?.selectedStack?.value
9795
);
9896

99-
const enableButton = contentMapperLength === 0 && newMigrationData?.project_current_step === 3 && params?.stepId === '1' && (!newMigrationData?.legacy_cms?.uploadedFile?.reValidate || newMigrationData?.legacy_cms?.uploadedFile?.reValidate) && newMigrationData?.legacy_cms?.uploadedFile?.file_revalidated
100-
10197
return (
10298
<div className="d-flex align-items-center justify-content-between migration-flow-header">
10399
<div className="d-flex align-items-center">
@@ -116,7 +112,7 @@ const MigrationFlowHeader = ({
116112
aria-label="Save and Continue"
117113
isLoading={isLoading || newMigrationData?.isprojectMapped}
118114
disabled={
119-
(isStep4AndNotMigrated || isStepInvalid || isExecutionStarted || destinationStackMigrated) && !enableButton
115+
isStep4AndNotMigrated || isStepInvalid || isExecutionStarted || destinationStackMigrated
120116
}
121117
>
122118
{stepValue}

ui/src/components/Stepper/HorizontalStepper/HorizontalStepper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export type stepperProps = {
5050
};
5151

5252
export type HorizontalStepperHandles = {
53-
handleStepChange: (stepIndex: number) => void;
53+
handleStepChange: (currentStep: number) => void;
5454
};
5555

5656
const showNotification = (currentIndex: number) => {

ui/src/context/app/app.interface.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ export interface IFile {
6868
file_details?: FileDetails;
6969
isValidated: boolean;
7070
reValidate: boolean;
71-
cmsType: string;
72-
file_revalidated: boolean;
71+
cmsType: string
7372
}
7473

7574
export interface ICMSType extends ICardType {
@@ -312,7 +311,6 @@ export const DEFAULT_FILE: IFile = {
312311
isValidated: false,
313312
reValidate: false,
314313
cmsType: '',
315-
file_revalidated: false
316314
};
317315

318316
export const DEFAULT_CMS_TYPE: ICMSType = {

ui/src/pages/Migration/index.tsx

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,7 @@ const Migration = () => {
324324
isLocalPath: projectData?.legacy_cms?.is_localPath
325325
},
326326
isValidated: projectData?.legacy_cms?.is_fileValid,
327-
reValidate: newMigrationData?.legacy_cms?.uploadedFile?.reValidate,
328-
file_revalidated: newMigrationData?.legacy_cms?.uploadedFile?.file_revalidated
327+
reValidate: newMigrationData?.legacy_cms?.uploadedFile?.reValidate
329328
} : uploadObj,
330329
isFileFormatCheckboxChecked: true,
331330
isRestictedKeywordCheckboxChecked: true,
@@ -374,7 +373,7 @@ const Migration = () => {
374373
*/
375374
const createStepper = (
376375
projectData: MigrationResponse,
377-
handleStepChange: (step: number) => void
376+
handleStepChange: (currentStep: number) => void
378377
) => {
379378
const steps = [
380379
{
@@ -451,7 +450,7 @@ const Migration = () => {
451450
const handleOnClickLegacyCms = async (event: MouseEvent) => {
452451
setIsLoading(true);
453452

454-
if (isCompleted && newMigrationData?.project_current_step === 1) {
453+
if (isCompleted) {
455454
event.preventDefault();
456455

457456
//Update Data in backend
@@ -494,26 +493,6 @@ const Migration = () => {
494493
type: 'error'
495494
});
496495
}
497-
}
498-
else if(newMigrationData?.project_current_step > 1 && (!newMigrationData?.legacy_cms?.uploadedFile?.reValidate || newMigrationData?.legacy_cms?.uploadedFile?.reValidate)){
499-
if(!newMigrationData?.legacy_cms?.uploadedFile?.file_revalidated){
500-
setIsLoading(false);
501-
Notification({
502-
notificationContent: {
503-
text: 'Please reValidate the file to procced furthur'
504-
},
505-
type: 'warning'
506-
});
507-
}
508-
else{
509-
setIsLoading(false);
510-
handleStepChange(2);
511-
const url = `/projects/${projectId}/migration/steps/3`;
512-
navigate(url, { replace: true });
513-
514-
}
515-
516-
517496
} else {
518497
setIsLoading(false);
519498

@@ -644,21 +623,12 @@ const Migration = () => {
644623
}
645624
});
646625
} else {
626+
event.preventDefault();
627+
const url = `/projects/${projectId}/migration/steps/4`;
628+
navigate(url, { replace: true });
647629

648-
const res = await updateCurrentStepData(selectedOrganisation.value, projectId);
649-
if (res?.status === 200) {
650-
setIsLoading(false);
651-
event.preventDefault();
652-
const url = `/projects/${projectId}/migration/steps/4`;
653-
navigate(url, { replace: true });
654-
} else {
655-
setIsLoading(false);
656-
Notification({
657-
notificationContent: { text: res?.data?.error?.message },
658-
type: 'error'
659-
});
660-
}
661-
630+
await updateCurrentStepData(selectedOrganisation.value, projectId);
631+
handleStepChange(3);
662632
}
663633
};
664634

@@ -752,7 +722,7 @@ const Migration = () => {
752722
<div className="steps-wrapper">
753723
<HorizontalStepper
754724
ref={stepperRef}
755-
steps={createStepper(projectData ?? defaultMigrationResponse, handleStepChange)}
725+
steps={createStepper(projectData ?? defaultMigrationResponse, handleClick)}
756726
handleSaveCT={saveRef?.current?.handleSaveContentType}
757727
changeDropdownState={changeDropdownState}
758728
projectData={projectData || defaultMigrationResponse}

ui/src/services/api/service.interface.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export interface MigrationResponse {
3737
isMigrationStarted: boolean;
3838
isMigrationCompleted: boolean;
3939
migration_execution: boolean;
40-
content_mapper: []
4140
}
4241

4342
export interface LegacyCms {
@@ -66,8 +65,7 @@ export const defaultMigrationResponse: MigrationResponse = {
6665
current_step: 1,
6766
isMigrationStarted: false,
6867
isMigrationCompleted: false,
69-
migration_execution: false,
70-
content_mapper: []
68+
migration_execution: false
7169
};
7270
interface data {
7371
file_details: FileDetails;

0 commit comments

Comments
 (0)