@@ -40,7 +40,8 @@ type ProjectModel = {
40
40
bounds ?: Bounds ,
41
41
defaultTimeZone ?: string ,
42
42
id ?: string ,
43
- name ?: string
43
+ name ?: string ,
44
+ peliasWebhookUrl ?: string
44
45
}
45
46
46
47
type Props = {
@@ -58,7 +59,8 @@ type State = {
58
59
validation : {
59
60
bounds : boolean ,
60
61
defaultLocation : boolean ,
61
- name : boolean
62
+ name : boolean ,
63
+ webhookUrl : boolean
62
64
}
63
65
}
64
66
@@ -71,7 +73,8 @@ export default class ProjectSettingsForm extends Component<Props, State> {
71
73
validation : {
72
74
bounds : true ,
73
75
defaultLocation : true ,
74
- name : true
76
+ name : true ,
77
+ webhookUrl : true
75
78
}
76
79
}
77
80
@@ -181,13 +184,16 @@ export default class ProjectSettingsForm extends Component<Props, State> {
181
184
this . setState ( update ( this . state , { model : { $merge : { defaultTimeZone} } } ) )
182
185
}
183
186
184
- _onChangeName = ( { target} : { target : HTMLInputElement } ) => {
187
+ _onChangeTextInput = ( { target} : { target : HTMLInputElement } ) => {
185
188
const { name, value} = target
186
189
this . setState (
187
- update ( this . state , {
188
- model : { $merge : { [ name ] : value } } ,
189
- validation : { [ name ] : { $set : value && value . length > 0 } }
190
- } )
190
+ update (
191
+ this . state ,
192
+ {
193
+ model : { $merge : { [ name ] : value } } ,
194
+ validation : { [ name ] : { $set : value && value . length > 0 } }
195
+ }
196
+ )
191
197
)
192
198
}
193
199
@@ -266,20 +272,19 @@ export default class ProjectSettingsForm extends Component<Props, State> {
266
272
)
267
273
}
268
274
return (
269
- < div >
275
+ ( < div >
270
276
< ConfirmModal ref = 'confirm' />
271
277
< Panel header = { < h4 > { this . messages ( 'title' ) } </ h4 > } >
272
278
< ListGroup fill >
273
279
< ListGroupItem >
274
280
< FormGroup
275
281
data-test-id = 'project-name-input-container'
276
- validationState = { validationState ( validation . name ) }
277
- >
282
+ validationState = { validationState ( validation . name ) } >
278
283
< ControlLabel > { this . messages ( 'fields.name' ) } </ ControlLabel >
279
284
< FormControl
280
285
value = { model . name || '' }
281
286
name = { 'name' }
282
- onChange = { this . _onChangeName }
287
+ onChange = { this . _onChangeTextInput }
283
288
/>
284
289
< FormControl . Feedback />
285
290
< HelpBlock > Required.</ HelpBlock >
@@ -300,19 +305,17 @@ export default class ProjectSettingsForm extends Component<Props, State> {
300
305
</ Checkbox >
301
306
{ autoFetchChecked
302
307
? < DateTimeField
303
- dateTime = { (
304
- typeof autoFetchMinute === 'number' &&
305
- typeof autoFetchHour === 'number'
306
- )
307
- ? + moment ( ) . startOf ( 'day' )
308
- . add ( autoFetchHour , 'hours' )
309
- . add ( autoFetchMinute , 'minutes' )
310
- : DEFAULT_FETCH_TIME
311
- }
308
+ dateTime = { typeof autoFetchMinute === 'number' &&
309
+ typeof autoFetchHour === 'number'
310
+ ? + moment ( ) . startOf ( 'day' ) . add ( autoFetchHour , 'hours' ) . add (
311
+ autoFetchMinute ,
312
+ 'minutes'
313
+ )
314
+ : DEFAULT_FETCH_TIME }
312
315
mode = 'time'
313
- onChange = { this . _onChangeDateTime } />
314
- : null
315
- }
316
+ onChange = { this . _onChangeDateTime }
317
+ />
318
+ : null }
316
319
</ FormGroup >
317
320
</ ListGroupItem >
318
321
</ ListGroup >
@@ -330,22 +333,18 @@ export default class ProjectSettingsForm extends Component<Props, State> {
330
333
type = 'text'
331
334
defaultValue = { model . bounds
332
335
? `${ model . bounds . west } ,${ model . bounds . south } ,${ model . bounds . east } ,${ model . bounds . north } `
333
- : ''
334
- }
336
+ : '' }
335
337
ref = 'boundingBox'
336
- placeholder = { this . messages ( 'fields.location.boundingBoxPlaceHolder' ) }
337
- onChange = { this . _onChangeBounds } />
338
- {
339
- < InputGroup . Button >
340
- < Button
341
- // TODO: wait for react-leaflet-draw to update library
342
- // to re-enable bounds select
343
- disabled
344
- onClick = { this . _onOpenMapBoundsModal } >
345
- < Glyphicon glyph = 'fullscreen' />
346
- </ Button >
347
- </ InputGroup . Button >
348
- }
338
+ placeholder = { this . messages (
339
+ 'fields.location.boundingBoxPlaceHolder'
340
+ ) }
341
+ onChange = { this . _onChangeBounds }
342
+ />
343
+ { < InputGroup . Button >
344
+ < Button disabled onClick = { this . _onOpenMapBoundsModal } >
345
+ < Glyphicon glyph = 'fullscreen' />
346
+ </ Button >
347
+ </ InputGroup . Button > }
349
348
</ InputGroup >
350
349
</ FormGroup >
351
350
</ ListGroupItem >
@@ -356,53 +355,61 @@ export default class ProjectSettingsForm extends Component<Props, State> {
356
355
</ ControlLabel >
357
356
< TimezoneSelect
358
357
value = { model . defaultTimeZone }
359
- onChange = { this . _onChangeTimeZone } />
358
+ onChange = { this . _onChangeTimeZone }
359
+ />
360
+ </ ListGroupItem >
361
+ </ ListGroup >
362
+ </ Panel >
363
+ < Panel header = { < h4 > Local Places Index</ h4 > } >
364
+ < ListGroup fill >
365
+ < ListGroupItem >
366
+ < FormGroup validationState = { validationState ( validation . webhookUrl ) } >
367
+ < ControlLabel > Webhook URL</ ControlLabel >
368
+ < FormControl
369
+ value = { model . peliasWebhookUrl || '' }
370
+ name = { 'peliasWebhookUrl' }
371
+ onChange = { this . _onChangeTextInput }
372
+ />
373
+ < FormControl . Feedback />
374
+ </ FormGroup >
360
375
</ ListGroupItem >
361
376
</ ListGroup >
362
377
</ Panel >
363
378
{ showDangerZone &&
364
- < Panel bsStyle = 'danger' header = { < h3 > Danger zone</ h3 > } >
365
- < ListGroup fill >
366
- < ListGroupItem >
367
- < Button
368
- bsStyle = 'danger'
369
- className = 'pull-right'
370
- data-test-id = 'delete-project-button'
371
- onClick = { this . _onDeleteProject }
372
- >
373
- < Icon type = 'trash' /> Delete project
374
- </ Button >
375
- < h4 > Delete this project.</ h4 >
376
- < p > Once you delete an project, the project and all feed sources it contains cannot be recovered.</ p >
377
- </ ListGroupItem >
378
- </ ListGroup >
379
- </ Panel >
380
- }
379
+ < Panel bsStyle = 'danger' header = { < h3 > Danger zone</ h3 > } >
380
+ < ListGroup fill >
381
+ < ListGroupItem >
382
+ < Button
383
+ bsStyle = 'danger'
384
+ className = 'pull-right'
385
+ data-test-id = 'delete-project-button'
386
+ onClick = { this . _onDeleteProject } >
387
+ < Icon type = 'trash' /> Delete project
388
+ </ Button >
389
+ < h4 > Delete this project.</ h4 >
390
+ < p > Once you delete an project, the project and all feed sources it contains cannot be recovered.</ p >
391
+ </ ListGroupItem >
392
+ </ ListGroup >
393
+ </ Panel > }
381
394
< Row >
382
395
< Col xs = { 12 } >
383
- { /* Cancel button */ }
384
- < Button
385
- onClick = { this . _onCancel }
386
- style = { { marginRight : 10 } }
387
- >
396
+ { }
397
+ < Button onClick = { this . _onCancel } style = { { marginRight : 10 } } >
388
398
{ this . messages ( 'cancel' ) }
389
399
</ Button >
390
- { /* Save button */ }
400
+ { }
391
401
< Button
392
402
bsStyle = 'primary'
393
403
data-test-id = 'project-settings-form-save-button'
394
- disabled = {
395
- editDisabled ||
396
- this . _settingsAreUnedited ( ) ||
397
- ! this . _formIsValid ( )
398
- }
404
+ disabled = { editDisabled || this . _settingsAreUnedited ( ) ||
405
+ ! this . _formIsValid ( ) }
399
406
onClick = { this . _onSaveSettings } >
400
407
{ this . messages ( 'save' ) }
401
408
</ Button >
402
409
</ Col >
403
410
</ Row >
404
411
< MapModal ref = 'mapModal' />
405
- </ div >
412
+ </ div > )
406
413
)
407
414
}
408
415
}
0 commit comments