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 @@ -159,7 +159,7 @@ const ContentMapper = () => {
newMigrationData?.destination_stack?.selectedStack?.value
);

if (contentTypeCount > 0) {
if (contentTypeCount?.data?.contenttype_count > 0) {
setIsEmptyStack(false);
} else {
setIsEmptyStack(true);
Expand Down
7 changes: 0 additions & 7 deletions ui/src/components/DestinationStack/Actions/LoadStacks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,6 @@ const LoadStacks = (props: LoadFileFormatProps) => {
};

updateNewMigrationData(newMigrationDataObj);

//API call for saving selected CMS
if (data?.value) {
updateDestinationStack(selectedOrganisation?.value, projectId, {
stack_api_key: data?.value
});
}
}

//call for Step Change
Expand Down
9 changes: 8 additions & 1 deletion ui/src/components/DestinationStack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import './DestinationStack.scss';
import { isEmptyString, validateArray } from '../../utilities/functions';
import { getAllStacksInOrg } from '../../services/api/stacks.service';
import { MigrationResponse, StackResponse } from '../../services/api/service.interface';
import { updateCurrentStepData } from '../../services/api/migration.service';
import {
updateCurrentStepData,
updateDestinationStack
} from '../../services/api/migration.service';
import { getCMSDataFromFile } from '../../cmsData/cmsSelector';

type DestinationStackComponentProps = {
Expand Down Expand Up @@ -59,6 +62,10 @@ const DestinationStackComponent = ({
const handleOnClick = async (event: MouseEvent) => {
event.preventDefault();
//Update Data in backend
await updateDestinationStack(selectedOrganisation?.value, projectId, {
stack_api_key: newMigrationData?.destination_stack?.selectedStack?.value
});

const res = await updateCurrentStepData(selectedOrganisation.value, projectId);
if (res) {
const url = `/projects/${projectId}/migration/steps/3`;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const LoadFileFormat = (props: LoadFileFormatProps) => {
</div>
</div>
<div className="col-12 pt-2">
<Button version="v2" onClick={handleBtnClick}>
<Button version="v2" disabled={!isCheckedBoxChecked} onClick={handleBtnClick}>
{migrationData?.legacyCMSData?.file_format_cta}
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/LegacyCms/Actions/LoadPrefix.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const LoadPreFix = (props: LoadSelectCmsProps) => {
/>
</div>
<div className="col-12">
<Button version="v2" onClick={handleOnBlur}>
<Button version="v2" disabled={!isCheckedBoxChecked} onClick={handleOnBlur}>
{migrationData?.legacyCMSData?.affix_cta}
</Button>
</div>
Expand Down
12 changes: 6 additions & 6 deletions ui/src/services/api/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@ import { API_VERSION } from '../../utilities/constants';
import { getDataFromLocalStorage } from '../../utilities/functions';
import { getCall, postCall, putCall } from './service';

const options = {
const options = () => ({
headers: {
app_token: getDataFromLocalStorage('app_token')
}
};
});

export const getAllProjects = async (orgId: string) => {
try {
return await getCall(`${API_VERSION}/org/${orgId}/project`, options);
return await getCall(`${API_VERSION}/org/${orgId}/project`, options());
} catch (error: any) {
return error;
}
};

export const getProject = async (orgId: string, projectId: string) => {
try {
return await getCall(`${API_VERSION}/org/${orgId}/project/${projectId}`, options);
return await getCall(`${API_VERSION}/org/${orgId}/project/${projectId}`, options());
} catch (error: any) {
return error;
}
};

export const createProject = async (orgId: string, data: any) => {
try {
return await postCall(`${API_VERSION}/org/${orgId}/project/`, data, options);
return await postCall(`${API_VERSION}/org/${orgId}/project/`, data, options());
} catch (error: any) {
return error;
}
};

export const updateProject = async (orgId: string, projectId: string, data: any) => {
try {
return await putCall(`${API_VERSION}/org/${orgId}/project/${projectId}`, data, options);
return await putCall(`${API_VERSION}/org/${orgId}/project/${projectId}`, data, options());
} catch (error: any) {
return error;
}
Expand Down
7 changes: 4 additions & 3 deletions ui/src/services/api/stacks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ export const createStacksInOrg = async (orgId: string, data: any) => {
};

export const getStackStatus = async (orgId: string, data: string) => {
console.log('.................', orgId, data);

try {
return await postCall(`${API_VERSION}/org/${orgId}/stack_status`, data, options);
const stack_api = {
stack_api_key: data
};
return await postCall(`${API_VERSION}/org/${orgId}/stack_status`, stack_api, options);
} catch (error: any) {
return error;
}
Expand Down