Skip to content

Commit 159fe45

Browse files
committed
refactor:fluckering issue while rendering steps and re-validate the file if contentMapper is empty
1 parent 722a599 commit 159fe45

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ const LanguageMapper = () => {
386386

387387
setoptions(allLocales);
388388
Object?.entries(newMigrationData?.destination_stack?.localeMapping)?.length === 0 &&
389+
newMigrationData?.project_current_step <= 2 &&
389390
setcmsLocaleOptions((prevList: { label: string; value: string }[]) => {
390391
const newLabel = newMigrationData?.destination_stack?.selectedStack?.master_locale;
391392

ui/src/components/DestinationStack/Actions/LoadStacks.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,17 @@ const LoadStacks = (props: LoadFileFormatProps) => {
316316
</div>
317317
</div>
318318
<div className="col-12">
319-
<label className="title">Master Locale <span className='asterisk_input'></span>
319+
<label className="title" htmlFor="master_locale">Master Locale <span className='asterisk_input'></span>
320320
</label>
321321
<Tooltip content="Master Locale is auto-selected based on the chosen stack." position='right'>
322322
<Icon icon='Information' version='v2' size='small'></Icon>
323323
</Tooltip>
324324

325325
</div>
326-
<div className="col-12 pb-2">
326+
<div className="col-12 pb-2" id="master_locale">
327327
<TextInput
328+
id="master_locale"
329+
aria-label="master_locale"
328330
version={'v2'}
329331
placeholder={selectedStack?.master_locale ? '' : 'Master Locale will be set after stack selection'}
330332
value={selectedStack?.master_locale }

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
8989
//const [isCancelLoading, setIsCancelLoading] = useState<boolean>(false);
9090
//const [setIsFormatValid] = useState<boolean>(false);
9191
const [affix, setAffix] = useState<string>(newMigrationData?.legacy_cms?.affix);
92+
const [reValidate, setReValidate] = useState<boolean>(newMigrationData?.legacy_cms?.uploadedFile?.reValidate || false);
9293

9394
const { projectId = '' } = useParams();
9495

@@ -394,6 +395,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
394395
if(!isEmptyString(newMigrationData?.legacy_cms?.affix) && !newMigrationData?.legacy_cms?.uploadedFile?.isValidated ){
395396
setIsDisabled(false);
396397
}
398+
setReValidate(newMigrationData?.legacy_cms?.uploadedFile?.reValidate || false);
397399

398400
// else{
399401
// setIsValidated(false);
@@ -466,7 +468,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
466468
isLoading={isLoading}
467469
loadingColor="#6c5ce7"
468470
version="v2"
469-
disabled={isDisabled || isEmptyString(affix)}
471+
disabled={isDisabled || isEmptyString(affix) || !reValidate}
470472
>
471473
Validate File
472474
</Button>

ui/src/components/LegacyCms/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, isCompleted, handleOnAll
164164
awsData: legacyCMSData?.awsDetails,
165165
isLocalPath: legacyCMSData?.is_localPath
166166
},
167-
isValidated: legacyCMSData?.is_fileValid ,
167+
isValidated: legacyCMSData?.is_fileValid,
168+
reValidate: newMigrationData?.legacy_cms?.uploadedFile?.reValidate
168169
}, //need to add backend data once endpoint exposed.
169170
affix: legacyCMSData?.affix ?? '',
170171
isFileFormatCheckboxChecked: true, //need to add backend data once endpoint exposed.

ui/src/pages/Migration/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const Migration = () => {
8484
const [isLoading, setIsLoading] = useState(false);
8585
const [currentStepIndex, setCurrentStepIndex] = useState(0);
8686
const [isCompleted, setIsCompleted] = useState<boolean>(false);
87-
const [isProjectMapper, setIsProjectMapper] = useState<boolean>(false);
87+
const [isProjectMapper, setIsProjectMapper] = useState<boolean>(true);
8888

8989
const [disableMigration, setDisableMigration] = useState(false);
9090
const [isModalOpen, setIsModalOpen] = useState(false);
@@ -182,15 +182,14 @@ const Migration = () => {
182182
*/
183183
const fetchProjectData = async () => {
184184
if (isEmptyString(selectedOrganisation?.value) || isEmptyString(params?.projectId)) return;
185-
185+
setIsProjectMapper(true);
186186
const data = await getMigrationData(selectedOrganisation?.value, params?.projectId ?? '');
187187
const migratedstacks = await getMigratedStacks(selectedOrganisation?.value, projectId );
188188

189189
if (data) {
190190
setIsLoading(false);
191191
setProjectData(data?.data);
192192
}
193-
setIsProjectMapper(true);
194193
const projectData = data?.data;
195194

196195
const legacyCmsData:ILegacyCMSComponent = await getCMSDataFromFile(CS_ENTRIES.LEGACY_CMS);

0 commit comments

Comments
 (0)