diff --git a/ui/src/components/ContentMapper/index.tsx b/ui/src/components/ContentMapper/index.tsx index 0c7de7dec..e3b950bb7 100644 --- a/ui/src/components/ContentMapper/index.tsx +++ b/ui/src/components/ContentMapper/index.tsx @@ -189,7 +189,7 @@ const Fields: MappingFields = { options: { 'Select':'checkbox' }, - type:'display_type' + type:'checkbox' }, 'global_field':{ label : 'Global', diff --git a/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx b/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx index 2c5be0421..c6c8ab4f3 100644 --- a/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx +++ b/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx @@ -112,7 +112,7 @@ const Mapper = ({ type: 'csLocale' | 'sourceLocale' ) => { const selectedLocaleKey = selectedValue?.value; - if (!selectedLocaleKey) return; + setExistingField((prevOptions: ExistingFieldType) => { const updatedOptions = { @@ -139,7 +139,11 @@ const Mapper = ({ setSelectedMappings((prev) => { const updatedMappings = { ...prev }; - if (type === 'csLocale') { + + if (!selectedValue) { + delete updatedMappings[existingField[index]?.value]; + } + else if (type === 'csLocale' && selectedLocaleKey) { updatedMappings[selectedLocaleKey] = existingLocale[index]?.label ? existingLocale[index]?.label : ''; diff --git a/ui/src/components/DestinationStack/Actions/LoadStacks.tsx b/ui/src/components/DestinationStack/Actions/LoadStacks.tsx index b29ff632e..7ef24c9bb 100644 --- a/ui/src/components/DestinationStack/Actions/LoadStacks.tsx +++ b/ui/src/components/DestinationStack/Actions/LoadStacks.tsx @@ -16,7 +16,7 @@ import { Stack } from '../../../components/Common/AddStack/addStack.interface'; import { isEmptyString, validateArray } from '../../../utilities/functions'; // Services -import { createStacksInOrg, getAllStacksInOrg } from '../../../services/api/stacks.service'; +import { createStacksInOrg, getAllStacksInOrg, getStackLocales } from '../../../services/api/stacks.service'; // Components import AddStack from '../../../components/Common/AddStack/addStack'; @@ -186,7 +186,7 @@ const LoadStacks = (props: LoadFileFormatProps) => { if (allStack?.length <= 0) { setAllStack(loadingOption); const stackData = await getAllStacksInOrg(selectedOrganisation?.value, ''); // org id will always be there - + const csLocales = await getStackLocales(selectedOrganisation?.value); const stackArray = validateArray(stackData?.data?.stacks) ? stackData?.data?.stacks?.map((stack: StackResponse) => ({ label: stack?.name, @@ -235,6 +235,16 @@ const LoadStacks = (props: LoadFileFormatProps) => { // Dispatch the updated migration data to Redux dispatch(updateNewMigrationData(newMigrationDataObj)); } + const newMigrationDataObj: INewMigration = { + // ...newMigrationDataRef?.current, + ...newMigrationData, + destination_stack: { + ...newMigrationData?.destination_stack, + csLocale: csLocales?.data?.locales + } + }; + // Dispatch the updated migration data to Redux + dispatch(updateNewMigrationData(newMigrationDataObj)); } } catch (error) { return error; diff --git a/ui/src/pages/Migration/index.tsx b/ui/src/pages/Migration/index.tsx index 489b6b968..b6bb4751b 100644 --- a/ui/src/pages/Migration/index.tsx +++ b/ui/src/pages/Migration/index.tsx @@ -185,7 +185,7 @@ const Migration = () => { const data = await getMigrationData(selectedOrganisation?.value, params?.projectId ?? ''); const migratedstacks = await getMigratedStacks(selectedOrganisation?.value, projectId ); - const csLocales = await getStackLocales(selectedOrganisation?.value); + if (data) { setIsLoading(false); setProjectData(data?.data); @@ -267,7 +267,6 @@ const Migration = () => { stackArray: [], migratedStacks: migratedstacks?.data?.destinationStacks, sourceLocale: projectData?.source_locales, - csLocale: csLocales?.data?.locales, localeMapping: locales }, content_mapping: {