1
1
/** @jsx React.DOM */
2
2
3
3
var React = require ( 'react' ) ;
4
- React . addons = require ( 'react-addons ' ) ;
4
+ var classNames = require ( 'classnames ' ) ;
5
5
6
6
var ReactBootstrap = require ( 'react-bootstrap' ) ;
7
7
var $ = require ( 'jquery' ) ;
@@ -10,6 +10,7 @@ var _ = require('lodash');
10
10
11
11
var util = require ( './util' ) ;
12
12
13
+ React . createClass = require ( 'create-react-class' ) ;
13
14
14
15
// Import some react-bootstrap componenets
15
16
//
@@ -20,8 +21,11 @@ var Button = ReactBootstrap.Button,
20
21
Row = ReactBootstrap . Row ,
21
22
Col = ReactBootstrap . Col ,
22
23
Alert = ReactBootstrap . Alert ,
23
- Input = ReactBootstrap . Input ;
24
- OverlayMixin = ReactBootstrap . OverlayMixin ;
24
+ FormGroup = ReactBootstrap . FormGroup ,
25
+ FormControl = ReactBootstrap . FormControl ;
26
+
27
+
28
+ console . log ( ReactBootstrap ) ;
25
29
26
30
var withRefresh = require ( './util' ) . withRefresh ;
27
31
@@ -80,7 +84,7 @@ var withRefresh = require('./util').withRefresh;
80
84
} ,
81
85
82
86
render : function ( ) {
83
- var classes = React . addons . classSet ( {
87
+ var classes = classNames ( {
84
88
'btn btn-block btn-sm' : true ,
85
89
'btn-default' : ! this . state . enabled ,
86
90
'btn-success active' : this . state . enabled
@@ -89,23 +93,23 @@ var withRefresh = require('./util').withRefresh;
89
93
var additionControls = this . state . enabled ?
90
94
( < div >
91
95
< div id = "inun" />
92
- < h5 className = "not-first" > Adjust Opacity of Inundattion plane</ h5 >
96
+ < h5 className = "not-first" > Adjust Opacity of Inundation plane</ h5 >
93
97
< div id = "inun-opacity" />
94
98
</ div > ) :
95
- < div />
99
+ < div /> ;
96
100
97
101
98
- return (
99
- < div >
100
- < button type = "button"
102
+ return (
103
+ < div >
104
+ < button type = "button"
101
105
className = { classes }
102
106
style = { { marginBottom : '15px' } }
103
107
onClick = { withRefresh ( this . toggle ) } >
104
- { this . state . enabled ? "Disable" : "Enable" }
105
- </ button >
106
- { additionControls }
107
- </ div >
108
- ) ;
108
+ { this . state . enabled ? "Disable" : "Enable" }
109
+ </ button >
110
+ { additionControls }
111
+ </ div >
112
+ ) ;
109
113
} ,
110
114
111
115
toggle : function ( ) {
@@ -179,26 +183,26 @@ var withRefresh = require('./util').withRefresh;
179
183
< div className = "its-empty" > No Measurement Segments</ div >
180
184
) ;
181
185
182
- return (
183
- < table className = "table" >
184
- < thead >
185
- < tr >
186
- < td > Index</ td >
187
- < td style = { { textAlign : 'right' } } > Length</ td >
188
- < td > </ td >
189
- </ tr >
190
- </ thead >
191
- < tbody >
192
- { lines }
193
- </ tbody >
194
- </ table >
195
- ) ;
186
+ return (
187
+ < table className = "table" >
188
+ < thead >
189
+ < tr >
190
+ < td > Index</ td >
191
+ < td style = { { textAlign : 'right' } } > Length</ td >
192
+ < td > </ td >
193
+ </ tr >
194
+ </ thead >
195
+ < tbody >
196
+ { lines }
197
+ </ tbody >
198
+ </ table >
199
+ ) ;
196
200
}
197
201
} ) ;
198
202
199
203
var RegionViewport = React . createClass ( {
200
204
render : function ( ) {
201
- var classes = React . addons . classSet ( {
205
+ var classes = classNames ( {
202
206
'btn btn-block btn-sm' : true ,
203
207
'btn-default' : ! this . props . region . active ,
204
208
'btn-success active' : this . props . region . active
@@ -239,7 +243,7 @@ var withRefresh = require('./util').withRefresh;
239
243
240
244
var Region = React . createClass ( {
241
245
render : function ( ) {
242
- var cx = React . addons . classSet ;
246
+ var cx = classNames ;
243
247
var classesFor = function ( active ) {
244
248
return cx ( {
245
249
'btn' : true ,
@@ -344,17 +348,17 @@ var withRefresh = require('./util').withRefresh;
344
348
toggle : o . toggle } ) ;
345
349
} ) ;
346
350
347
- return (
348
- < div >
349
- < button
350
- className = 'btn btn-info btn-sm btn-block'
351
- style = { { marginBottom : '10px' } }
352
- onClick = { toggleClip } >
353
- Toggle Regions View (T)
354
- </ button >
355
- { regions }
356
- </ div >
357
- ) ;
351
+ return (
352
+ < div >
353
+ < button
354
+ className = 'btn btn-info btn-sm btn-block'
355
+ style = { { marginBottom : '10px' } }
356
+ onClick = { toggleClip } >
357
+ Toggle Regions View (T)
358
+ </ button >
359
+ { regions }
360
+ </ div >
361
+ ) ;
358
362
} ,
359
363
360
364
setRibbon : withRefresh ( function ( i ) {
@@ -473,16 +477,18 @@ var withRefresh = require('./util').withRefresh;
473
477
</ Col >
474
478
</ Row > ) : < span /> ;
475
479
476
- return this . transferPropsTo (
477
- < Modal title = "Open a Greyhound Pipeline" >
480
+ return (
481
+ < div >
478
482
< div className = "modal-body" >
479
483
< Grid fluid = { true } >
480
484
< Row >
481
485
< Col xs = { 12 } >
482
- < Input type = "text"
483
- placeholder = "pipeline-url"
484
- onChange = { this . updateControlState }
485
- ref = "pipelineUrl" autoFocus />
486
+ < FormGroup >
487
+ < FormControl type = "text" placeholder = "pipeline-url"
488
+ ref = "pipelineUrl"
489
+ autoFocus
490
+ onChange = { this . updateControlState } />
491
+ </ FormGroup >
486
492
</ Col >
487
493
</ Row >
488
494
< Row >
@@ -492,16 +498,18 @@ var withRefresh = require('./util').withRefresh;
492
498
</ Row >
493
499
< Row >
494
500
< Col xs = { 4 } >
495
- < Input type = "text"
496
- placeholder = "server-address"
497
- ref = "serverAddress"
498
- onChange = { this . updateControlState } />
501
+ < FormGroup >
502
+ < FormControl type = "text" placeholder = "server-address"
503
+ ref = "serverAddress"
504
+ onChange = { this . updateControlState } />
505
+ </ FormGroup >
499
506
</ Col >
500
507
< Col xs = { 8 } >
501
- < Input type = "text"
502
- ref = "pipelineId"
503
- placeholder = "pipeline-id"
504
- onChange = { this . updateControlState } />
508
+ < FormGroup >
509
+ < FormControl type = "text" placeholder = "pipeline-id"
510
+ ref = "pipelineId"
511
+ onChange = { this . updateControlState } />
512
+ </ FormGroup >
505
513
</ Col >
506
514
</ Row >
507
515
< Row >
@@ -528,16 +536,44 @@ var withRefresh = require('./util').withRefresh;
528
536
< Button onClick = { this . props . onRequestHide } bsStyle = "warning" > Cancel</ Button >
529
537
< Button onClick = { this . handleOpen } bsStyle = "success" disabled = { ! this . state . canOpen } > Open Pipeline</ Button >
530
538
</ div >
531
- </ Modal >
539
+ </ div >
532
540
) ;
533
541
}
534
542
} ) ;
535
543
536
- var openGreyhoundPipelineButton = (
537
- < ModalTrigger modal = { < OpenGreyhoundPipeline /> } >
538
- < Button bsStyle = "default" bsSize = "small" className = "btn-block" > Open</ Button >
539
- </ ModalTrigger >
540
- ) ;
544
+ var openGreyhoundPipelineButton = React . createClass ( {
545
+ getInitialState : function ( ) {
546
+ return { show : false } ;
547
+ } ,
548
+
549
+ render :function ( ) {
550
+ var o = this ;
551
+ var close = function ( ) { o . setState ( { show : false } ) ; } ;
552
+ var open = function ( ) { o . setState ( { show : true } ) ; } ;
553
+
554
+ return (
555
+ < div className = "modal-container" >
556
+ < Button
557
+ bsStyle = "default"
558
+ bsSize = "small"
559
+ className = "btn-block"
560
+ onClick = { open }
561
+ >
562
+ Open
563
+ </ Button >
564
+
565
+ < Modal
566
+ show = { this . state . show }
567
+ onHide = { close }
568
+ container = { this }
569
+ aria-labelledby = "contained-modal-title"
570
+ >
571
+ < OpenGreyhoundPipeline onRequestHide = { close } />
572
+ </ Modal >
573
+ </ div >
574
+ ) ;
575
+ } ,
576
+ } ) ;
541
577
542
578
// export stuff
543
579
scope . InundationControls = InundationControls ;
0 commit comments