Skip to content

Commit a097c55

Browse files
feat(PeliasPanel): support dropping pelias db
1 parent 7158675 commit a097c55

File tree

6 files changed

+56
-5
lines changed

6 files changed

+56
-5
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export function makeMockDeployment (
6161
skipOsmExtract: false,
6262
tripPlannerVersion: 'OTP_1',
6363
peliasUpdate: null,
64+
peliasReset: null,
6465
peliasWebhookUrl: null,
6566
peliasCsvFiles: [],
6667
user: null

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ Object {
115115
"otpCommit": null,
116116
"otpVersion": null,
117117
"peliasCsvFiles": Array [],
118+
"peliasReset": null,
118119
"peliasUpdate": null,
119120
"peliasWebhookUrl": null,
120121
"pinnedfeedVersionIds": Array [],

lib/manager/components/deployment/PeliasPanel.js

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from 'react-bootstrap'
1414

1515
import SelectFileModal from '../../../common/components/SelectFileModal'
16+
import ConfirmModal from '../../../common/components/ConfirmModal'
1617
import { updateDeployment, uploadPeliasWebhookCsvFile } from '../../actions/deployments'
1718
import { setErrorMessage } from '../../actions/status'
1819
import type { Deployment, Project } from '../../../types'
@@ -52,6 +53,14 @@ class PeliasPanel extends Component<Props, State> {
5253
peliasUpdate: !this.props.deployment.peliasUpdate
5354
});
5455

56+
/**
57+
* Method fired when Pelias Update checkbox is checked
58+
*/
59+
_onChangeResetPelias = () =>
60+
this._updateDeployment({
61+
peliasReset: !this.props.deployment.peliasReset
62+
});
63+
5564
/**
5665
* Updates state on input changes. Does not persist changes to deployment
5766
*/
@@ -181,13 +190,13 @@ class PeliasPanel extends Component<Props, State> {
181190
<Panel
182191
header={
183192
<h3>
184-
<Icon type='map-marker' /> Custom Geocoder Settings
193+
<Icon type='map-marker' /> Local Places Index Settings
185194
</h3>
186195
}
187196
>
188197
<ListGroup fill>
189198
<ListGroupItem>
190-
<h5>Custom Geocoder Webhook URL</h5>
199+
<h5>Local Places Index Webhook URL</h5>
191200
<FormControl
192201
type='url'
193202
id='peliasWebhookUrl'
@@ -198,13 +207,26 @@ class PeliasPanel extends Component<Props, State> {
198207
/>
199208
</ListGroupItem>
200209
<ListGroupItem>
201-
<h5>Send GTFS feeds to custom geocoder</h5>
210+
<h5>Send GTFS feeds to local places index when deploying</h5>
202211
<Checkbox
203212
disabled={!optionsEnabled}
204213
checked={deployment.peliasUpdate}
205214
onChange={this._onChangeUpdatePelias}
206215
>
207-
Update Custom Geocoder
216+
Update Local Places Index
217+
</Checkbox>
218+
<ConfirmModal
219+
ref='reInitLpiModal'
220+
title='Are you sure you want to re-initialize the LPI database?'
221+
body='This will cause custom geocoder responses to be unavailable for about 1 - 5 minutes after deploying. Non-LPI responses will continue to be available. This will also cause any feeds not deployed to be deleted from the LPI.'
222+
onConfirm={this._onChangeResetPelias}
223+
/>
224+
<Checkbox
225+
disabled={!optionsEnabled}
226+
checked={deployment.peliasReset}
227+
onClick={() => deployment.peliasReset ? this._onChangeResetPelias() : this.refs.reInitLpiModal.open()}
228+
>
229+
Re-initialize LPI Database
208230
</Checkbox>
209231
</ListGroupItem>
210232
<ListGroupItem>
@@ -214,7 +236,9 @@ class PeliasPanel extends Component<Props, State> {
214236
title='Upload CSV File'
215237
body='Select a CSV file of POIs to upload:'
216238
onConfirm={async (files) => this._onConfirmUpload(files)}
217-
onCancel={() => this.setState({fileToDeleteOnSuccesfulUpload: null})}
239+
onCancel={() =>
240+
this.setState({ fileToDeleteOnSuccesfulUpload: null })
241+
}
218242
errorMessage='Uploaded file must be a valid csv file (.csv).'
219243
/>
220244
<ul>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
128128
"otpCommit": null,
129129
"otpVersion": null,
130130
"peliasCsvFiles": Array [],
131+
"peliasReset": null,
131132
"peliasUpdate": null,
132133
"peliasWebhookUrl": null,
133134
"pinnedfeedVersionIds": Array [],
@@ -163,6 +164,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
163164
"otpCommit": null,
164165
"otpVersion": null,
165166
"peliasCsvFiles": Array [],
167+
"peliasReset": null,
166168
"peliasUpdate": null,
167169
"peliasWebhookUrl": null,
168170
"pinnedfeedVersionIds": Array [],
@@ -363,6 +365,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
363365
"otpCommit": null,
364366
"otpVersion": null,
365367
"peliasCsvFiles": Array [],
368+
"peliasReset": null,
366369
"peliasUpdate": null,
367370
"peliasWebhookUrl": null,
368371
"pinnedfeedVersionIds": Array [],
@@ -398,6 +401,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
398401
"otpCommit": null,
399402
"otpVersion": null,
400403
"peliasCsvFiles": Array [],
404+
"peliasReset": null,
401405
"peliasUpdate": null,
402406
"peliasWebhookUrl": null,
403407
"pinnedfeedVersionIds": Array [],
@@ -650,6 +654,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
650654
"otpCommit": null,
651655
"otpVersion": null,
652656
"peliasCsvFiles": Array [],
657+
"peliasReset": null,
653658
"peliasUpdate": null,
654659
"peliasWebhookUrl": null,
655660
"pinnedfeedVersionIds": Array [],
@@ -685,6 +690,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
685690
"otpCommit": null,
686691
"otpVersion": null,
687692
"peliasCsvFiles": Array [],
693+
"peliasReset": null,
688694
"peliasUpdate": null,
689695
"peliasWebhookUrl": null,
690696
"pinnedfeedVersionIds": Array [],
@@ -814,6 +820,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
814820
"otpCommit": null,
815821
"otpVersion": null,
816822
"peliasCsvFiles": Array [],
823+
"peliasReset": null,
817824
"peliasUpdate": null,
818825
"peliasWebhookUrl": null,
819826
"pinnedfeedVersionIds": Array [],
@@ -849,6 +856,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
849856
"otpCommit": null,
850857
"otpVersion": null,
851858
"peliasCsvFiles": Array [],
859+
"peliasReset": null,
852860
"peliasUpdate": null,
853861
"peliasWebhookUrl": null,
854862
"pinnedfeedVersionIds": Array [],
@@ -1191,6 +1199,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
11911199
"otpCommit": null,
11921200
"otpVersion": null,
11931201
"peliasCsvFiles": Array [],
1202+
"peliasReset": null,
11941203
"peliasUpdate": null,
11951204
"peliasWebhookUrl": null,
11961205
"pinnedfeedVersionIds": Array [],
@@ -1320,6 +1329,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
13201329
"otpCommit": null,
13211330
"otpVersion": null,
13221331
"peliasCsvFiles": Array [],
1332+
"peliasReset": null,
13231333
"peliasUpdate": null,
13241334
"peliasWebhookUrl": null,
13251335
"pinnedfeedVersionIds": Array [],
@@ -1355,6 +1365,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
13551365
"otpCommit": null,
13561366
"otpVersion": null,
13571367
"peliasCsvFiles": Array [],
1368+
"peliasReset": null,
13581369
"peliasUpdate": null,
13591370
"peliasWebhookUrl": null,
13601371
"pinnedfeedVersionIds": Array [],
@@ -1602,6 +1613,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
16021613
"otpCommit": null,
16031614
"otpVersion": null,
16041615
"peliasCsvFiles": Array [],
1616+
"peliasReset": null,
16051617
"peliasUpdate": null,
16061618
"peliasWebhookUrl": null,
16071619
"pinnedfeedVersionIds": Array [],
@@ -1731,6 +1743,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
17311743
"otpCommit": null,
17321744
"otpVersion": null,
17331745
"peliasCsvFiles": Array [],
1746+
"peliasReset": null,
17341747
"peliasUpdate": null,
17351748
"peliasWebhookUrl": null,
17361749
"pinnedfeedVersionIds": Array [],
@@ -1766,6 +1779,7 @@ exports[`lib > manager > DeploymentsPanel should render with the list of deploym
17661779
"otpCommit": null,
17671780
"otpVersion": null,
17681781
"peliasCsvFiles": Array [],
1782+
"peliasReset": null,
17691783
"peliasUpdate": null,
17701784
"peliasWebhookUrl": null,
17711785
"pinnedfeedVersionIds": Array [],

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ exports[`lib > manager > FeedSourceTable should render with a project with feeds
127127
"otpCommit": null,
128128
"otpVersion": null,
129129
"peliasCsvFiles": Array [],
130+
"peliasReset": null,
130131
"peliasUpdate": null,
131132
"peliasWebhookUrl": null,
132133
"pinnedfeedVersionIds": Array [],
@@ -425,6 +426,7 @@ exports[`lib > manager > FeedSourceTable should render with a project with feeds
425426
"otpCommit": null,
426427
"otpVersion": null,
427428
"peliasCsvFiles": Array [],
429+
"peliasReset": null,
428430
"peliasUpdate": null,
429431
"peliasWebhookUrl": null,
430432
"pinnedfeedVersionIds": Array [],
@@ -700,6 +702,7 @@ exports[`lib > manager > FeedSourceTable should render with a project with feeds
700702
"otpCommit": null,
701703
"otpVersion": null,
702704
"peliasCsvFiles": Array [],
705+
"peliasReset": null,
703706
"peliasUpdate": null,
704707
"peliasWebhookUrl": null,
705708
"pinnedfeedVersionIds": Array [],
@@ -906,6 +909,7 @@ exports[`lib > manager > FeedSourceTable should render with a project with feeds
906909
"otpCommit": null,
907910
"otpVersion": null,
908911
"peliasCsvFiles": Array [],
912+
"peliasReset": null,
909913
"peliasUpdate": null,
910914
"peliasWebhookUrl": null,
911915
"pinnedfeedVersionIds": Array [],
@@ -1132,6 +1136,7 @@ exports[`lib > manager > FeedSourceTable should render with a project with feeds
11321136
"otpCommit": null,
11331137
"otpVersion": null,
11341138
"peliasCsvFiles": Array [],
1139+
"peliasReset": null,
11351140
"peliasUpdate": null,
11361141
"peliasWebhookUrl": null,
11371142
"pinnedfeedVersionIds": Array [],
@@ -3250,6 +3255,7 @@ exports[`lib > manager > FeedSourceTable should render with a project with feeds
32503255
"otpCommit": null,
32513256
"otpVersion": null,
32523257
"peliasCsvFiles": Array [],
3258+
"peliasReset": null,
32533259
"peliasUpdate": null,
32543260
"peliasWebhookUrl": null,
32553261
"pinnedfeedVersionIds": Array [],
@@ -3520,6 +3526,7 @@ exports[`lib > manager > FeedSourceTable should render with a project with feeds
35203526
"otpCommit": null,
35213527
"otpVersion": null,
35223528
"peliasCsvFiles": Array [],
3529+
"peliasReset": null,
35233530
"peliasUpdate": null,
35243531
"peliasWebhookUrl": null,
35253532
"pinnedfeedVersionIds": Array [],
@@ -3845,6 +3852,7 @@ exports[`lib > manager > FeedSourceTable should render with a project with feeds
38453852
"otpCommit": null,
38463853
"otpVersion": null,
38473854
"peliasCsvFiles": Array [],
3855+
"peliasReset": null,
38483856
"peliasUpdate": null,
38493857
"peliasWebhookUrl": null,
38503858
"pinnedfeedVersionIds": Array [],
@@ -4244,6 +4252,7 @@ exports[`lib > manager > FeedSourceTable should render with a project with feeds
42444252
"otpCommit": null,
42454253
"otpVersion": null,
42464254
"peliasCsvFiles": Array [],
4255+
"peliasReset": null,
42474256
"peliasUpdate": null,
42484257
"peliasWebhookUrl": null,
42494258
"pinnedfeedVersionIds": Array [],
@@ -4652,6 +4661,7 @@ exports[`lib > manager > FeedSourceTable should render with a project with feeds
46524661
"otpCommit": null,
46534662
"otpVersion": null,
46544663
"peliasCsvFiles": Array [],
4664+
"peliasReset": null,
46554665
"peliasUpdate": null,
46564666
"peliasWebhookUrl": null,
46574667
"pinnedfeedVersionIds": Array [],

lib/types/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ export type Deployment = {
250250
osmExtractUrl: ?string,
251251
otpVersion: ?string,
252252
peliasCsvFiles: ?Array<string>,
253+
peliasReset: ?boolean,
253254
peliasUpdate: ?boolean,
254255
peliasWebhookUrl: ?string,
255256
pinnedfeedVersionIds: Array<string>,

0 commit comments

Comments
 (0)