Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/components/ContentMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ const Fields: MappingFields = {
options: {
'Select':'checkbox'
},
type:'display_type'
type:'checkbox'
},
'global_field':{
label : 'Global',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const Mapper = ({
type: 'csLocale' | 'sourceLocale'
) => {
const selectedLocaleKey = selectedValue?.value;
if (!selectedLocaleKey) return;


setExistingField((prevOptions: ExistingFieldType) => {
const updatedOptions = {
Expand All @@ -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
: '';
Expand Down
14 changes: 12 additions & 2 deletions ui/src/components/DestinationStack/Actions/LoadStacks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions ui/src/pages/Migration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -267,7 +267,6 @@ const Migration = () => {
stackArray: [],
migratedStacks: migratedstacks?.data?.destinationStacks,
sourceLocale: projectData?.source_locales,
csLocale: csLocales?.data?.locales,
localeMapping: locales
},
content_mapping: {
Expand Down
Loading