Skip to content

Commit 768c21d

Browse files
authored
Merge pull request #201 from WorldBank-Transport/develop
Release v0.8.0
2 parents 3d931bd + 005cd18 commit 768c21d

31 files changed

+1941
-351
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The configuration is overridable by environment variables, expressed between []:
3636
- `iDEditor` - The address of the iDEditor. Defaults to the `master` branch of the [RAM fork of iD](https://github.com/WorldBank-Transport/ram-id), hosted on GH Pages. (Default: https://id.ruralaccess.info). [IDEDITOR]
3737
- `mbtoken` - The Mapbox Token to load map tiles from. [MBTOKEN]
3838
- `rahUrl` - The url for the Rural Accessibility Hub. [RAH_URL]
39+
- `roadNetEditMax` - Maximum value over which the road network editing is disabled. Must match the value of the same config on the backend. [ROAD_NET_EDIT_MAX]
3940
- `auth` - The configuration for optional authentication with Auth0. By default, no authentication is set (Default: {})
4041
- `auth.domain` - See instructions below [AUTH_DOMAIN]
4142
- `auth.clientID` - See instructions below [AUTH_CLIENTID]
@@ -48,7 +49,7 @@ module.exports = {
4849
api: 'http://localhost:4000',
4950
idEditor: 'https://id.ruralaccess.info',
5051
mbtoken: 'asfd23rlmksjdf023rnnsafd',
51-
rahUrl: 'http://rah.surge.sh'
52+
rahUrl: 'http://hub.ruralaccess.info'
5253
auth: {}
5354
};
5455
```

app/assets/scripts/actions/index.js

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ export const RESET_RAH_FORM = 'RESET_RAH_FORM';
7070
export const START_SUBMIT_RAH = 'START_SUBMIT_RAH';
7171
export const FINISH_SUBMIT_RAH = 'FINISH_SUBMIT_RAH';
7272

73+
export const REQUEST_PROFILE_SETTINGS = 'REQUEST_PROFILE_SETTINGS';
74+
export const RECEIVE_PROFILE_SETTINGS = 'RECEIVE_PROFILE_SETTINGS';
75+
export const INVALIDATE_PROFILE_SETTINGS = 'INVALIDATE_PROFILE_SETTINGS';
76+
export const RESET_PROFILE_SETTINGS_FORM = 'RESET_PROFILE_SETTINGS_FORM';
77+
export const START_SUBMIT_PROFILE_SETTINGS = 'START_SUBMIT_PROFILE_SETTINGS';
78+
export const FINISH_SUBMIT_PROFILE_SETTINGS = 'FINISH_SUBMIT_PROFILE_SETTINGS';
79+
7380
// Auth
7481

7582
export function loginSuccess () {
@@ -433,6 +440,41 @@ export function postRAHExport (projId, data) {
433440
return postAndDispatch(`${config.api}/projects/${projId}/rah-export`, data, startSubmitRAH, finishSubmitRAH);
434441
}
435442

443+
// Profile Data
444+
445+
export function invalidateProfileSettings () {
446+
return { type: INVALIDATE_PROFILE_SETTINGS };
447+
}
448+
449+
export function requestProfileSettings () {
450+
return { type: REQUEST_PROFILE_SETTINGS };
451+
}
452+
453+
export function receiveProfileSettings (settings, error = null) {
454+
return { type: RECEIVE_PROFILE_SETTINGS, data: settings, error, receivedAt: Date.now() };
455+
}
456+
457+
export function fetchProfileSettings (projectId) {
458+
const url = `${config.api}/projects/${projectId}/source-data/editor?type=profile`;
459+
return getAndDispatch(url, requestProfileSettings, receiveProfileSettings);
460+
}
461+
462+
export function resetProfileSettingsForm () {
463+
return { type: RESET_PROFILE_SETTINGS_FORM };
464+
}
465+
466+
export function startSubmitProfileSettings () {
467+
return { type: START_SUBMIT_PROFILE_SETTINGS };
468+
}
469+
470+
export function finishSubmitProfileSettings () {
471+
return { type: FINISH_SUBMIT_PROFILE_SETTINGS };
472+
}
473+
export function postProfileSettings (projectId, data) {
474+
const url = `${config.api}/projects/${projectId}/source-data/editor?type=profile`;
475+
return postAndDispatch(url, data, startSubmitProfileSettings, finishSubmitProfileSettings);
476+
}
477+
436478
// Fetcher function
437479

438480
function getAndDispatch (url, requestFn, receiveFn) {
@@ -466,7 +508,7 @@ function fetchDispatchFactory (url, options, requestFn, receiveFn) {
466508
return function (dispatch, getState) {
467509
dispatch(requestFn());
468510

469-
fetchJSON(url, options)
511+
return fetchJSON(url, options)
470512
.then(json => dispatch(receiveFn(json)), err => dispatch(receiveFn(null, err)));
471513
};
472514
}

0 commit comments

Comments
 (0)