@@ -40,7 +40,8 @@ type ProjectModel = {
4040 bounds ?: Bounds ,
4141 defaultTimeZone ?: string ,
4242 id ?: string ,
43- name ?: string
43+ name ?: string ,
44+ peliasWebhookUrl ?: string
4445}
4546
4647type Props = {
@@ -58,7 +59,8 @@ type State = {
5859 validation : {
5960 bounds : boolean ,
6061 defaultLocation : boolean ,
61- name : boolean
62+ name : boolean ,
63+ webhookUrl : boolean
6264 }
6365}
6466
@@ -71,7 +73,8 @@ export default class ProjectSettingsForm extends Component<Props, State> {
7173 validation : {
7274 bounds : true ,
7375 defaultLocation : true ,
74- name : true
76+ name : true ,
77+ webhookUrl : true
7578 }
7679 }
7780
@@ -181,13 +184,16 @@ export default class ProjectSettingsForm extends Component<Props, State> {
181184 this . setState ( update ( this . state , { model : { $merge : { defaultTimeZone} } } ) )
182185 }
183186
184- _onChangeName = ( { target} : { target : HTMLInputElement } ) => {
187+ _onChangeTextInput = ( { target} : { target : HTMLInputElement } ) => {
185188 const { name, value} = target
186189 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+ )
191197 )
192198 }
193199
@@ -266,20 +272,19 @@ export default class ProjectSettingsForm extends Component<Props, State> {
266272 )
267273 }
268274 return (
269- < div >
275+ ( < div >
270276 < ConfirmModal ref = 'confirm' />
271277 < Panel header = { < h4 > { this . messages ( 'title' ) } </ h4 > } >
272278 < ListGroup fill >
273279 < ListGroupItem >
274280 < FormGroup
275281 data-test-id = 'project-name-input-container'
276- validationState = { validationState ( validation . name ) }
277- >
282+ validationState = { validationState ( validation . name ) } >
278283 < ControlLabel > { this . messages ( 'fields.name' ) } </ ControlLabel >
279284 < FormControl
280285 value = { model . name || '' }
281286 name = { 'name' }
282- onChange = { this . _onChangeName }
287+ onChange = { this . _onChangeTextInput }
283288 />
284289 < FormControl . Feedback />
285290 < HelpBlock > Required.</ HelpBlock >
@@ -300,19 +305,17 @@ export default class ProjectSettingsForm extends Component<Props, State> {
300305 </ Checkbox >
301306 { autoFetchChecked
302307 ? < 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 }
312315 mode = 'time'
313- onChange = { this . _onChangeDateTime } />
314- : null
315- }
316+ onChange = { this . _onChangeDateTime }
317+ />
318+ : null }
316319 </ FormGroup >
317320 </ ListGroupItem >
318321 </ ListGroup >
@@ -330,22 +333,18 @@ export default class ProjectSettingsForm extends Component<Props, State> {
330333 type = 'text'
331334 defaultValue = { model . bounds
332335 ? `${ model . bounds . west } ,${ model . bounds . south } ,${ model . bounds . east } ,${ model . bounds . north } `
333- : ''
334- }
336+ : '' }
335337 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 > }
349348 </ InputGroup >
350349 </ FormGroup >
351350 </ ListGroupItem >
@@ -356,53 +355,61 @@ export default class ProjectSettingsForm extends Component<Props, State> {
356355 </ ControlLabel >
357356 < TimezoneSelect
358357 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 >
360375 </ ListGroupItem >
361376 </ ListGroup >
362377 </ Panel >
363378 { 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 > }
381394 < Row >
382395 < 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 } } >
388398 { this . messages ( 'cancel' ) }
389399 </ Button >
390- { /* Save button */ }
400+ { }
391401 < Button
392402 bsStyle = 'primary'
393403 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 ( ) }
399406 onClick = { this . _onSaveSettings } >
400407 { this . messages ( 'save' ) }
401408 </ Button >
402409 </ Col >
403410 </ Row >
404411 < MapModal ref = 'mapModal' />
405- </ div >
412+ </ div > )
406413 )
407414 }
408415}
0 commit comments