Skip to content
14 changes: 11 additions & 3 deletions ui/src/components/ContentMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,15 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
[key]: { label: item?.display_name, value: item },
}));
}
if (item?.data_type === "group" && Array.isArray(item?.schema)) {
if(contentTypeSchema?.every((item)=> value?.value?.uid !== item?.uid)){
setExistingField((prevOptions: ExistingFieldType) => {
const { [key]: _, ...rest } = prevOptions; // Destructure to exclude the key to remove
return {
...rest
};
})
}
else if (item?.data_type === "group" && Array.isArray(item?.schema)) {
item?.schema?.forEach((schemaItem) => {

if (value?.value?.uid === schemaItem?.uid && value?.label === `${item?.display_name} > ${schemaItem?.display_name}`) {
Expand Down Expand Up @@ -1918,7 +1926,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
...newMigrationData,
content_mapping:{
...newMigrationData?.content_mapping,
existingCT: contentTypes,
[isContentType ? 'existingCT' : 'existingGlobal']: contentTypes,
content_type_mapping : updatedContentTypeMapping

}
Expand Down Expand Up @@ -2289,7 +2297,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
</span>
<span className='ml-10'>
<Tooltip content="Schema Preview" position="bottom">
<button className='list-button schema-preview' onClick={() => handleSchemaPreview(content?.otherCmsTitle, content?.id ?? '')}>{SCHEMA_PREVIEW}</button>
<button className='list-button schema-preview' aria-label="schemaPreview" onClick={() => handleSchemaPreview(content?.otherCmsTitle, content?.id ?? '')}>{SCHEMA_PREVIEW}</button>
</Tooltip>
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ const LanguageMapper = () => {

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

Expand Down
6 changes: 4 additions & 2 deletions ui/src/components/DestinationStack/Actions/LoadStacks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,17 @@ const LoadStacks = (props: LoadFileFormatProps) => {
</div>
</div>
<div className="col-12">
<label className="title">Master Locale <span className='asterisk_input'></span>
<label className="title" htmlFor="master_locale">Master Locale <span className='asterisk_input'></span>
</label>
<Tooltip content="Master Locale is auto-selected based on the chosen stack." position='right'>
<Icon icon='Information' version='v2' size='small'></Icon>
</Tooltip>

</div>
<div className="col-12 pb-2">
<div className="col-12 pb-2" id="master_locale">
<TextInput
id="master_locale"
aria-label="master_locale"
version={'v2'}
placeholder={selectedStack?.master_locale ? '' : 'Master Locale will be set after stack selection'}
value={selectedStack?.master_locale }
Expand Down
4 changes: 3 additions & 1 deletion ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
//const [isCancelLoading, setIsCancelLoading] = useState<boolean>(false);
//const [setIsFormatValid] = useState<boolean>(false);
const [affix, setAffix] = useState<string>(newMigrationData?.legacy_cms?.affix);
const [reValidate, setReValidate] = useState<boolean>(newMigrationData?.legacy_cms?.uploadedFile?.reValidate || false);

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

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

// else{
// setIsValidated(false);
Expand Down Expand Up @@ -466,7 +468,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
isLoading={isLoading}
loadingColor="#6c5ce7"
version="v2"
disabled={isDisabled || isEmptyString(affix)}
disabled={isDisabled || isEmptyString(affix) || reValidate}
>
Validate File
</Button>
Expand Down
3 changes: 2 additions & 1 deletion ui/src/components/LegacyCms/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, isCompleted, handleOnAll
awsData: legacyCMSData?.awsDetails,
isLocalPath: legacyCMSData?.is_localPath
},
isValidated: legacyCMSData?.is_fileValid ,
isValidated: legacyCMSData?.is_fileValid,
reValidate: newMigrationData?.legacy_cms?.uploadedFile?.reValidate
}, //need to add backend data once endpoint exposed.
affix: legacyCMSData?.affix ?? '',
isFileFormatCheckboxChecked: true, //need to add backend data once endpoint exposed.
Expand Down
7 changes: 3 additions & 4 deletions ui/src/pages/Migration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const Migration = () => {
const [isLoading, setIsLoading] = useState(false);
const [currentStepIndex, setCurrentStepIndex] = useState(0);
const [isCompleted, setIsCompleted] = useState<boolean>(false);
const [isProjectMapper, setIsProjectMapper] = useState<boolean>(false);
const [isProjectMapper, setIsProjectMapper] = useState<boolean>(true);

const [disableMigration, setDisableMigration] = useState(false);
const [isModalOpen, setIsModalOpen] = useState(false);
Expand Down Expand Up @@ -182,15 +182,14 @@ const Migration = () => {
*/
const fetchProjectData = async () => {
if (isEmptyString(selectedOrganisation?.value) || isEmptyString(params?.projectId)) return;

setIsProjectMapper(true);
const data = await getMigrationData(selectedOrganisation?.value, params?.projectId ?? '');
const migratedstacks = await getMigratedStacks(selectedOrganisation?.value, projectId );

if (data) {
setIsLoading(false);
setProjectData(data?.data);
}
setIsProjectMapper(true);
const projectData = data?.data;

const legacyCmsData:ILegacyCMSComponent = await getCMSDataFromFile(CS_ENTRIES.LEGACY_CMS);
Expand Down Expand Up @@ -502,7 +501,7 @@ const Migration = () => {
} else if (! hasNonEmptyMapping) {
setIsLoading(false);
Notification({
notificationContent: { text: 'Please complete the language mapping to preceed futher' },
notificationContent: { text: 'Please complete the language mapping to proceed futher' },
type: 'warning'
});
}
Expand Down