Skip to content

Commit f7a7ada

Browse files
committed
Bring up to date with deps
1 parent 2d0472e commit f7a7ada

File tree

7 files changed

+11416
-108
lines changed

7 files changed

+11416
-108
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
pnacl_test*.*
33
build/
44
node_modules/
5+
*.iml
6+
.idea/

gulpfile.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ var connect = require('connect');
2121
var http = require('http');
2222
var open = require('open');
2323
var path = require('path');
24+
var logger = require('morgan');
25+
var serveStatic = require('serve-static');
2426

2527
var execFile = require('child_process').execFile;
2628
var fs = require('fs');
@@ -86,16 +88,17 @@ gulp.task('resources', function() {
8688
gulp.task('lint', function (){
8789
return gulp.src(paths.sources)
8890
.pipe(jshint({
89-
"smarttabs": true
91+
"smarttabs": true,
92+
"linter": require("jshint-jsx").JSXHINT
9093
}))
9194
.pipe(jshint.reporter('default'));
9295
});
9396

9497
var startServer = function(path, cb) {
9598
var devApp, devServer, devAddress, devHost, url, log=gutil.log, colors=gutil.colors;
9699
devApp = connect();
97-
devApp.use(connect.logger('dev'));
98-
devApp.use(connect.static(path));
100+
devApp.use(logger());
101+
devApp.use(serveStatic(path));
99102
devServer = http.createServer(devApp).listen(8000);
100103
devServer.on('error', function(error) {
101104
log(colors.underline(colors.red('ERROR'))+' Unable to start server!');
@@ -134,18 +137,11 @@ gulp.task('watch', ['build'], function() {
134137
});
135138

136139
gulp.task('livereload', ['watch'], function() {
137-
var server = livereload();
138-
return gulp.watch(path.join(paths.build, "/**/*"), function(evt) {
139-
server.changed(evt.path);
140-
});
140+
livereload.listen();
141141
});
142142

143143
gulp.task('livereload-tests', ['watch-specs'], function() {
144-
var server = livereload();
145-
146-
return gulp.watch("test/build/**/*", function(evt) {
147-
server.changed(evt.path);
148-
});
144+
livereload.listen();
149145
});
150146

151147
gulp.task('bad-scripts', function() {

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ <h5>Pick your own or click the dropdown for some examples</h5>
7474
<div id="creditsLink">
7575
<a data-toggle="modal" href="#" data-target="#creditsPage">Data Credits</a>
7676
</div>
77+
<!--
7778
<div id="gh-container">
7879
<h5>Open a Greyhound Source</h5>
7980
<div id="openGreyhoundButton"></div>
8081
</div>
82+
-->
8183
</div>
8284

8385
<div class="labeled-controls">

js/controls.js

Lines changed: 97 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @jsx React.DOM */
22

33
var React = require('react');
4-
React.addons = require('react-addons');
4+
var classNames = require('classnames');
55

66
var ReactBootstrap = require('react-bootstrap');
77
var $ = require('jquery');
@@ -10,6 +10,7 @@ var _ = require('lodash');
1010

1111
var util = require('./util');
1212

13+
React.createClass = require('create-react-class');
1314

1415
// Import some react-bootstrap componenets
1516
//
@@ -20,8 +21,11 @@ var Button = ReactBootstrap.Button,
2021
Row = ReactBootstrap.Row,
2122
Col = ReactBootstrap.Col,
2223
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);
2529

2630
var withRefresh = require('./util').withRefresh;
2731

@@ -80,7 +84,7 @@ var withRefresh = require('./util').withRefresh;
8084
},
8185

8286
render: function() {
83-
var classes = React.addons.classSet({
87+
var classes = classNames({
8488
'btn btn-block btn-sm': true,
8589
'btn-default': !this.state.enabled,
8690
'btn-success active': this.state.enabled
@@ -89,23 +93,23 @@ var withRefresh = require('./util').withRefresh;
8993
var additionControls = this.state.enabled ?
9094
(<div>
9195
<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>
9397
<div id="inun-opacity"/>
9498
</div>) :
95-
<div />
99+
<div /> ;
96100

97101

98-
return (
99-
<div>
100-
<button type="button"
102+
return (
103+
<div>
104+
<button type="button"
101105
className={classes}
102106
style={{marginBottom: '15px'}}
103107
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+
);
109113
},
110114

111115
toggle: function() {
@@ -179,26 +183,26 @@ var withRefresh = require('./util').withRefresh;
179183
<div className="its-empty">No Measurement Segments</div>
180184
);
181185

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+
);
196200
}
197201
});
198202

199203
var RegionViewport = React.createClass({
200204
render: function() {
201-
var classes = React.addons.classSet({
205+
var classes = classNames({
202206
'btn btn-block btn-sm': true,
203207
'btn-default': !this.props.region.active,
204208
'btn-success active': this.props.region.active
@@ -239,7 +243,7 @@ var withRefresh = require('./util').withRefresh;
239243

240244
var Region = React.createClass({
241245
render: function() {
242-
var cx = React.addons.classSet;
246+
var cx = classNames;
243247
var classesFor = function(active) {
244248
return cx({
245249
'btn': true,
@@ -344,17 +348,17 @@ var withRefresh = require('./util').withRefresh;
344348
toggle: o.toggle });
345349
});
346350

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+
);
358362
},
359363

360364
setRibbon: withRefresh(function(i) {
@@ -473,16 +477,18 @@ var withRefresh = require('./util').withRefresh;
473477
</Col>
474478
</Row> ) : <span /> ;
475479

476-
return this.transferPropsTo(
477-
<Modal title="Open a Greyhound Pipeline">
480+
return (
481+
<div>
478482
<div className="modal-body">
479483
<Grid fluid={true}>
480484
<Row>
481485
<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>
486492
</Col>
487493
</Row>
488494
<Row>
@@ -492,16 +498,18 @@ var withRefresh = require('./util').withRefresh;
492498
</Row>
493499
<Row>
494500
<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>
499506
</Col>
500507
<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>
505513
</Col>
506514
</Row>
507515
<Row>
@@ -528,16 +536,44 @@ var withRefresh = require('./util').withRefresh;
528536
<Button onClick={this.props.onRequestHide} bsStyle="warning">Cancel</Button>
529537
<Button onClick={this.handleOpen} bsStyle="success" disabled={!this.state.canOpen}>Open Pipeline</Button>
530538
</div>
531-
</Modal>
539+
</div>
532540
);
533541
}
534542
});
535543

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+
});
541577

542578
// export stuff
543579
scope.InundationControls = InundationControls;

js/ui.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/** @jsx React.DOM */
2+
13
// ui.js
24
// All UI stuff goes here
35
//
@@ -7,6 +9,7 @@ var Promise = require("bluebird"),
79
render = require("./render"),
810
laslaz = require('./laslaz'),
911
React = require('react'),
12+
ReactDOM = require('react-dom'),
1013
_ = require('lodash'),
1114
controls = require('./controls');
1215
withRefresh = require('./util').withRefresh;
@@ -647,7 +650,8 @@ var Promise = require("bluebird"),
647650
});
648651
}));
649652

650-
React.renderComponent(controls.openGreyhoundPipelineButton, $("#openGreyhoundButton").get(0));
653+
// TODO: May be enable again one day?
654+
//ReactDOM.render(<controls.openGreyhoundPipelineButton />, $("#openGreyhoundButton").get(0));
651655
};
652656

653657
var cancellableLoad = function(fDataLoader, files, name) {
@@ -779,7 +783,7 @@ var Promise = require("bluebird"),
779783

780784
var setupSliders = function() {
781785
// Mount any React components
782-
React.renderComponent(controls.InundationControls(), $("#inun-container").get(0));
786+
ReactDOM.render(<controls.InundationControls />, $("#inun-container").get(0));
783787

784788
// Setup UI sliders
785789
$("#loadFidelity").noUiSlider({
@@ -1070,7 +1074,7 @@ var Promise = require("bluebird"),
10701074

10711075
scope.currentZScale = function() {
10721076
return $("#zscale").val();
1073-
}
1077+
};
10741078

10751079
scope.currentColorClamp = currentColorClamp;
10761080
scope.currentPlaybackRate = currentPlaybackRate;
@@ -1332,7 +1336,7 @@ var Promise = require("bluebird"),
13321336
}
13331337
});
13341338

1335-
React.renderComponent(controls.LineSegmentsBox({}), $("#points-list-table").get(0));
1339+
ReactDOM.render(<controls.LineSegmentsBox />, $("#points-list-table").get(0));
13361340
};
13371341

13381342
function nameToScale(name) {
@@ -1408,7 +1412,7 @@ var Promise = require("bluebird"),
14081412
render.createNewRegion(p1, p2);
14091413
});
14101414

1411-
React.renderComponent(controls.RegionsBox({}), $("#clipping-regions").get(0));
1415+
ReactDOM.render(<controls.RegionsBox />, $("#clipping-regions").get(0));
14121416
};
14131417

14141418
var setupDocHandlers = function() {

0 commit comments

Comments
 (0)