Skip to content

Commit

Permalink
Remove unused features and adjust features for rb and non-rb provider…
Browse files Browse the repository at this point in the history
…s. (#230)

Remove unused features and adjust features for rb and non-rb providers.
  • Loading branch information
mansoor-sajjad authored Apr 29, 2024
1 parent 663fb9b commit 28269ec
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 224 deletions.
47 changes: 0 additions & 47 deletions src/actions/SuppliersActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,47 +144,6 @@ SuppliersActions.executePeliasTask = tasks => async (dispatch, getState) => {
});
};

SuppliersActions.uploadFiles = (files, providerId) => async (
dispatch,
getState
) => {
dispatch(sendData(0, types.UPDATED_FILE_UPLOAD_PROGRESS));

const url = `${window.config.timetableAdminBaseUrl}${providerId}/files`;

var data = new FormData();

files.forEach(file => {
data.append('files', file);
});

var config = {
onUploadProgress: function(progressEvent) {
let percentCompleted = (progressEvent.loaded / progressEvent.total) * 100;
dispatch(sendData(percentCompleted, types.UPDATED_FILE_UPLOAD_PROGRESS));
},
...(await getApiConfig(getState().UserReducer.auth))
};

return axios
.post(url, data, config)
.then(function(response) {
dispatch(SuppliersActions.addNotification('Uploaded file(s)', 'success'));
dispatch(
SuppliersActions.logEvent({
title: 'Uploaded file(s): ' + files.join(',')
})
);
dispatch(sendData(0, types.UPDATED_FILE_UPLOAD_PROGRESS));
})
.catch(function(response) {
dispatch(
SuppliersActions.addNotification('Unable to upload file(s)', 'error')
);
dispatch(sendData(0, types.UPDATED_FILE_UPLOAD_PROGRESS));
});
};

SuppliersActions.uploadTariffZonesFiles = (files, provider) => async (
dispatch,
getState
Expand Down Expand Up @@ -387,17 +346,11 @@ const getProviderPayload = data => {
referential: trimmedData._referential,
organisation: trimmedData._organisation,
user: trimmedData._user,
dataFormat: trimmedData._dataFormat,
enableValidation: trimmedData._enableValidation,
allowCreateMissingStopPlace: trimmedData._allowCreateMissingStopPlace,
enableStopPlaceIdMapping: trimmedData._enableStopPlaceIdMapping,
enableCleanImport: trimmedData._enableCleanImport,
generateDatedServiceJourneyIds:
trimmedData._generateDatedServiceJourneyIds,
generateMissingServiceLinksForModes:
trimmedData._generateMissingServiceLinksForModes,
googleUpload: trimmedData._googleUpload,
googleQAUpload: trimmedData._googleQAUpload,
migrateDataToProvider: trimmedData._migrateDataToProvider,
enableAutoImport: trimmedData._enableAutoImport,
enableAutoValidation: trimmedData._enableAutoValidation,
Expand Down
1 change: 0 additions & 1 deletion src/actions/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ export const ERRORS_SUPPLIERS = 'ERRORS_SUPPLIERS';
export const REQUESTED_ALL_SUPPLIERS_STATUS = 'REQUESTED_ALL_SUPPLIERS_STATUS';
export const RECEIVED_ALL_SUPPLIERS_STATUS = 'RECEIVED_ALL_SUPPLIERS_STATUS';

export const UPDATED_FILE_UPLOAD_PROGRESS = 'UPDATED_FILE_UPLOAD_PROGRESS';
export const UPDATED_TARIFF_ZONE_FILE_UPLOAD_PROGRESS =
'UPDATED_TARIFF_ZONE_FILE_UPLOAD_PROGRESS';

Expand Down
Loading

0 comments on commit 28269ec

Please sign in to comment.