Skip to content

Commit f697c19

Browse files
feat(DeploymentViewer): add custom geocoder settings panel
1 parent 1f91096 commit f697c19

File tree

8 files changed

+174
-7
lines changed

8 files changed

+174
-7
lines changed

__tests__/test-utils/mock-data/manager.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import clone from 'lodash/cloneDeep'
44

55
import UserPermissions from '../../../lib/common/user/UserPermissions'
66
import UserSubscriptions from '../../../lib/common/user/UserSubscriptions'
7-
87
import type {
98
Deployment,
109
FeedVersion,
@@ -61,6 +60,8 @@ export function makeMockDeployment (
6160
routerId: null,
6261
skipOsmExtract: false,
6362
tripPlannerVersion: 'OTP_1',
63+
peliasUpdate: null,
64+
peliasWebhookUrl: null,
6465
user: null
6566
}
6667
}
@@ -86,6 +87,7 @@ export const mockProject = {
8687
feedSources: [],
8788
id: 'mock-project-id',
8889
lastUpdated: 1553236399556,
90+
lastUsedPeliasWebhookUrl: null,
8991
name: 'mock-project',
9092
organizationId: null,
9193
otpServers: [],

lib/manager/actions/__tests__/__snapshots__/projects.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ Object {
113113
"osmExtractUrl": null,
114114
"otpCommit": null,
115115
"otpVersion": null,
116+
"peliasUpdate": null,
117+
"peliasWebhookUrl": null,
116118
"pinnedfeedVersionIds": Array [],
117119
"projectBounds": Object {
118120
"east": 0,
@@ -175,6 +177,7 @@ Object {
175177
],
176178
"id": "mock-project-with-deployments-id",
177179
"lastUpdated": 1553236399556,
180+
"lastUsedPeliasWebhookUrl": null,
178181
"name": "mock-project-with-deployments",
179182
"organizationId": null,
180183
"otpServers": Array [],

lib/manager/components/deployment/DeploymentViewer.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,19 @@ import {formatTimestamp, fromNow} from '../../../common/util/date-time'
3131
import {defaultTileLayerProps} from '../../../common/util/maps'
3232
import { versionsSorter } from '../../../common/util/util'
3333
import {getServerDeployedTo} from '../../util/deployment'
34-
import CurrentDeploymentPanel from './CurrentDeploymentPanel'
35-
import DeploymentConfigurationsPanel from './DeploymentConfigurationsPanel'
36-
import DeploymentConfirmModal from './DeploymentConfirmModal'
37-
import DeploymentVersionsTable from './DeploymentVersionsTable'
38-
3934
import type {Props as ContainerProps} from '../../containers/ActiveDeploymentViewer'
4035
import type {
4136
ServerJob,
4237
SummarizedFeedVersion
4338
} from '../../../types'
4439
import type {ManagerUserState} from '../../../types/reducers'
4540

41+
import CurrentDeploymentPanel from './CurrentDeploymentPanel'
42+
import DeploymentConfigurationsPanel from './DeploymentConfigurationsPanel'
43+
import DeploymentConfirmModal from './DeploymentConfirmModal'
44+
import DeploymentVersionsTable from './DeploymentVersionsTable'
45+
import PeliasPanel from './PeliasPanel'
46+
4647
type Props = ContainerProps & {
4748
addFeedVersion: typeof deploymentActions.addFeedVersion,
4849
deployJobs: Array<ServerJob>,
@@ -413,6 +414,11 @@ export default class DeploymentViewer extends Component<Props, State> {
413414
deployment={deployment}
414415
updateDeployment={updateDeployment}
415416
/>
417+
{/* Pelias panel */}
418+
<PeliasPanel
419+
deployment={deployment}
420+
updateDeployment={updateDeployment}
421+
/>
416422
</Col>
417423
</Row>
418424
</div>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// @flow
2+
3+
import Icon from '@conveyal/woonerf/components/icon'
4+
import React, { Component } from 'react'
5+
import { Checkbox, FormControl, ListGroup, ListGroupItem, Panel } from 'react-bootstrap'
6+
7+
import * as deploymentActions from '../../actions/deployments'
8+
import type {
9+
Deployment
10+
} from '../../../types'
11+
12+
type Props = {
13+
deployment: Deployment,
14+
updateDeployment: typeof deploymentActions.updateDeployment,
15+
}
16+
17+
type State = {
18+
webhookUrl: string
19+
}
20+
21+
export default class PeliasPanel extends Component<Props, State> {
22+
state = { webhookUrl: '' };
23+
24+
componentDidMount = () => {
25+
const { deployment } = this.props
26+
this.setState({ webhookUrl: (deployment.peliasWebhookUrl || '') })
27+
};
28+
29+
_onChangeUpdatePelias = () =>
30+
this._updateDeployment({
31+
peliasUpdate: !this.props.deployment.peliasUpdate
32+
});
33+
34+
_onBlurWebhookUrl = (event: SyntheticInputEvent<HTMLInputElement>) => {
35+
const { target } = event
36+
const { value } = target
37+
this._updateDeployment({ peliasWebhookUrl: value })
38+
};
39+
_onChangeWebhookUrl = (event: SyntheticInputEvent<HTMLInputElement>) => {
40+
const { target } = event
41+
const { value } = target
42+
this.setState({ webhookUrl: value })
43+
};
44+
45+
_updateDeployment = (props: { [string]: any }) => {
46+
const { deployment, updateDeployment } = this.props
47+
updateDeployment(deployment, props)
48+
};
49+
50+
render () {
51+
const { deployment } = this.props
52+
const { webhookUrl } = this.state
53+
54+
return (
55+
<Panel
56+
header={
57+
<h3>
58+
<Icon type='map-marker' /> Custom Geocoder Settings
59+
</h3>
60+
}
61+
>
62+
<ListGroup fill>
63+
<ListGroupItem>
64+
<h5>Custom Geocoder Webhook URL</h5>
65+
<FormControl
66+
type='url'
67+
placeholder='Update webhook URL'
68+
value={webhookUrl}
69+
onChange={this._onChangeWebhookUrl}
70+
onBlur={this._onBlurWebhookUrl}
71+
/>
72+
</ListGroupItem>
73+
<ListGroupItem>
74+
<h5>Send GTFS feeds to custom geocoder</h5>
75+
<Checkbox
76+
checked={deployment.peliasUpdate}
77+
onChange={this._onChangeUpdatePelias}
78+
>
79+
Update Custom Geocoder
80+
</Checkbox>
81+
</ListGroupItem>
82+
<ListGroupItem>
83+
<h5>Custom POI CSV Upload</h5>
84+
TODO
85+
</ListGroupItem>
86+
</ListGroup>
87+
</Panel>
88+
)
89+
}
90+
}

lib/manager/containers/__tests__/__snapshots__/ActiveProjectViewer.js.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ exports[`lib > manager > ActiveProjectViewer should render with newly created pr
6868
"feedSources": Array [],
6969
"id": "mock-project-id",
7070
"lastUpdated": 1553236399556,
71+
"lastUsedPeliasWebhookUrl": null,
7172
"name": "mock-project",
7273
"organizationId": null,
7374
"otpServers": Array [],
@@ -1933,6 +1934,7 @@ exports[`lib > manager > ActiveProjectViewer should render with newly created pr
19331934
"feedSources": Array [],
19341935
"id": "mock-project-id",
19351936
"lastUpdated": 1553236399556,
1937+
"lastUsedPeliasWebhookUrl": null,
19361938
"name": "mock-project",
19371939
"organizationId": null,
19381940
"otpServers": Array [],
@@ -1978,6 +1980,7 @@ exports[`lib > manager > ActiveProjectViewer should render with newly created pr
19781980
"feedSources": Array [],
19791981
"id": "mock-project-id",
19801982
"lastUpdated": 1553236399556,
1983+
"lastUsedPeliasWebhookUrl": null,
19811984
"name": "mock-project",
19821985
"organizationId": null,
19831986
"otpServers": Array [],
@@ -2096,6 +2099,7 @@ exports[`lib > manager > ActiveProjectViewer should render with newly created pr
20962099
"feedSources": Array [],
20972100
"id": "mock-project-id",
20982101
"lastUpdated": 1553236399556,
2102+
"lastUsedPeliasWebhookUrl": null,
20992103
"name": "mock-project",
21002104
"organizationId": null,
21012105
"otpServers": Array [],
@@ -2145,6 +2149,7 @@ exports[`lib > manager > ActiveProjectViewer should render with newly created pr
21452149
"feedSources": Array [],
21462150
"id": "mock-project-id",
21472151
"lastUpdated": 1553236399556,
2152+
"lastUsedPeliasWebhookUrl": null,
21482153
"name": "mock-project",
21492154
"organizationId": null,
21502155
"otpServers": Array [],
@@ -2211,6 +2216,7 @@ exports[`lib > manager > ActiveProjectViewer should render with newly created pr
22112216
"feedSources": Array [],
22122217
"id": "mock-project-id",
22132218
"lastUpdated": 1553236399556,
2219+
"lastUsedPeliasWebhookUrl": null,
22142220
"name": "mock-project",
22152221
"organizationId": null,
22162222
"otpServers": Array [],
@@ -3891,6 +3897,7 @@ exports[`lib > manager > ActiveProjectViewer should render with newly created pr
38913897
"feedSources": Array [],
38923898
"id": "mock-project-id",
38933899
"lastUpdated": 1553236399556,
3900+
"lastUsedPeliasWebhookUrl": null,
38943901
"name": "mock-project",
38953902
"organizationId": null,
38963903
"otpServers": Array [],

lib/manager/containers/__tests__/__snapshots__/DeploymentsPanel.js.snap

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
126126
"osmExtractUrl": null,
127127
"otpCommit": null,
128128
"otpVersion": null,
129+
"peliasUpdate": null,
130+
"peliasWebhookUrl": null,
129131
"pinnedfeedVersionIds": Array [],
130132
"projectBounds": Object {
131133
"east": 0,
@@ -158,6 +160,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
158160
"osmExtractUrl": null,
159161
"otpCommit": null,
160162
"otpVersion": null,
163+
"peliasUpdate": null,
164+
"peliasWebhookUrl": null,
161165
"pinnedfeedVersionIds": Array [],
162166
"projectBounds": Object {
163167
"east": 0,
@@ -220,6 +224,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
220224
],
221225
"id": "mock-project-with-deployments-id",
222226
"lastUpdated": 1553236399556,
227+
"lastUsedPeliasWebhookUrl": null,
223228
"name": "mock-project-with-deployments",
224229
"organizationId": null,
225230
"otpServers": Array [],
@@ -352,6 +357,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
352357
"osmExtractUrl": null,
353358
"otpCommit": null,
354359
"otpVersion": null,
360+
"peliasUpdate": null,
361+
"peliasWebhookUrl": null,
355362
"pinnedfeedVersionIds": Array [],
356363
"projectBounds": Object {
357364
"east": 0,
@@ -384,6 +391,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
384391
"osmExtractUrl": null,
385392
"otpCommit": null,
386393
"otpVersion": null,
394+
"peliasUpdate": null,
395+
"peliasWebhookUrl": null,
387396
"pinnedfeedVersionIds": Array [],
388397
"projectBounds": Object {
389398
"east": 0,
@@ -446,6 +455,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
446455
],
447456
"id": "mock-project-with-deployments-id",
448457
"lastUpdated": 1553236399556,
458+
"lastUsedPeliasWebhookUrl": null,
449459
"name": "mock-project-with-deployments",
450460
"organizationId": null,
451461
"otpServers": Array [],
@@ -630,6 +640,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
630640
"osmExtractUrl": null,
631641
"otpCommit": null,
632642
"otpVersion": null,
643+
"peliasUpdate": null,
644+
"peliasWebhookUrl": null,
633645
"pinnedfeedVersionIds": Array [],
634646
"projectBounds": Object {
635647
"east": 0,
@@ -662,6 +674,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
662674
"osmExtractUrl": null,
663675
"otpCommit": null,
664676
"otpVersion": null,
677+
"peliasUpdate": null,
678+
"peliasWebhookUrl": null,
665679
"pinnedfeedVersionIds": Array [],
666680
"projectBounds": Object {
667681
"east": 0,
@@ -787,6 +801,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
787801
"osmExtractUrl": null,
788802
"otpCommit": null,
789803
"otpVersion": null,
804+
"peliasUpdate": null,
805+
"peliasWebhookUrl": null,
790806
"pinnedfeedVersionIds": Array [],
791807
"projectBounds": Object {
792808
"east": 0,
@@ -819,6 +835,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
819835
"osmExtractUrl": null,
820836
"otpCommit": null,
821837
"otpVersion": null,
838+
"peliasUpdate": null,
839+
"peliasWebhookUrl": null,
822840
"pinnedfeedVersionIds": Array [],
823841
"projectBounds": Object {
824842
"east": 0,
@@ -881,6 +899,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
881899
],
882900
"id": "mock-project-with-deployments-id",
883901
"lastUpdated": 1553236399556,
902+
"lastUsedPeliasWebhookUrl": null,
884903
"name": "mock-project-with-deployments",
885904
"organizationId": null,
886905
"otpServers": Array [],
@@ -1155,6 +1174,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
11551174
"osmExtractUrl": null,
11561175
"otpCommit": null,
11571176
"otpVersion": null,
1177+
"peliasUpdate": null,
1178+
"peliasWebhookUrl": null,
11581179
"pinnedfeedVersionIds": Array [],
11591180
"projectBounds": Object {
11601181
"east": 0,
@@ -1280,6 +1301,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
12801301
"osmExtractUrl": null,
12811302
"otpCommit": null,
12821303
"otpVersion": null,
1304+
"peliasUpdate": null,
1305+
"peliasWebhookUrl": null,
12831306
"pinnedfeedVersionIds": Array [],
12841307
"projectBounds": Object {
12851308
"east": 0,
@@ -1312,6 +1335,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
13121335
"osmExtractUrl": null,
13131336
"otpCommit": null,
13141337
"otpVersion": null,
1338+
"peliasUpdate": null,
1339+
"peliasWebhookUrl": null,
13151340
"pinnedfeedVersionIds": Array [],
13161341
"projectBounds": Object {
13171342
"east": 0,
@@ -1374,6 +1399,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
13741399
],
13751400
"id": "mock-project-with-deployments-id",
13761401
"lastUpdated": 1553236399556,
1402+
"lastUsedPeliasWebhookUrl": null,
13771403
"name": "mock-project-with-deployments",
13781404
"organizationId": null,
13791405
"otpServers": Array [],
@@ -1554,6 +1580,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
15541580
"osmExtractUrl": null,
15551581
"otpCommit": null,
15561582
"otpVersion": null,
1583+
"peliasUpdate": null,
1584+
"peliasWebhookUrl": null,
15571585
"pinnedfeedVersionIds": Array [],
15581586
"projectBounds": Object {
15591587
"east": 0,
@@ -1679,6 +1707,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
16791707
"osmExtractUrl": null,
16801708
"otpCommit": null,
16811709
"otpVersion": null,
1710+
"peliasUpdate": null,
1711+
"peliasWebhookUrl": null,
16821712
"pinnedfeedVersionIds": Array [],
16831713
"projectBounds": Object {
16841714
"east": 0,
@@ -1711,6 +1741,8 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
17111741
"osmExtractUrl": null,
17121742
"otpCommit": null,
17131743
"otpVersion": null,
1744+
"peliasUpdate": null,
1745+
"peliasWebhookUrl": null,
17141746
"pinnedfeedVersionIds": Array [],
17151747
"projectBounds": Object {
17161748
"east": 0,
@@ -1773,6 +1805,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
17731805
],
17741806
"id": "mock-project-with-deployments-id",
17751807
"lastUpdated": 1553236399556,
1808+
"lastUsedPeliasWebhookUrl": null,
17761809
"name": "mock-project-with-deployments",
17771810
"organizationId": null,
17781811
"otpServers": Array [],

0 commit comments

Comments
 (0)