Skip to content

Commit

Permalink
Merge pull request #186 from bioinformatics-ua/imp/webapp/clean_lint_…
Browse files Browse the repository at this point in the history
…warnings00

Clean linting warnings in webapp + browserify error logging
  • Loading branch information
bastiao committed Jan 26, 2016
2 parents 9ea9242 + b23fec8 commit b0f781c
Show file tree
Hide file tree
Showing 18 changed files with 85 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
"react"
],
"rules": {
"no-alert": 1,
"no-console": 0,
"quotes": 0,
"camelcase": 0,
"curly": 0,
"key-spacing": 1,
"new-cap": 0,
"eqeqeq": 1,
"no-alert": 1,
"key-spacing": 1,
"no-unused-vars": [1, {"vars": "all", "args": "none"}],
"comma-spacing": 1,
"space-infix-ops": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@ gulp.task('lint', function () {
.pipe(eslint.failAfterError());
});

function handleBundlingError(e) {
gutil.log('' + e);
}

gulp.task('js', ['lint'], function () {
return createBrowserify(false, false)
.bundle()
.on('error', handleBundlingError)
.pipe(source('bundle.min.js'))
.pipe(buffer())
.pipe(uglify({compress: {
Expand All @@ -74,7 +79,7 @@ gulp.task('js', ['lint'], function () {
gulp.task('js-debug', ['lint'], function () {
return createBrowserify(true, false)
.bundle()
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.on('error', handleBundlingError)
.pipe(source('bundle.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
Expand All @@ -87,10 +92,10 @@ gulp.task('js:watch', function () {
var b = createBrowserify(true, true);
b.on('update', bundle); // on any dep update, runs the bundler
b.on('log', gutil.log); // output build logs to terminal
b.on('error', gutil.log.bind(gutil, 'Browserify Error'))

function bundle() {
return b.bundle()
.on('error', handleBundlingError)
.pipe(source('bundle.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true})) // loads map from browserify file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


var Reflux = require('reflux');
var StorageActions = exports;
StorageActions.get = Reflux.createAction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const DirectDumpView = React.createClass({
},

render() {
if(this.state.status == "loading") {
if(this.state.status === "loading") {
return (<div className="loader-inner ball-pulse"/>);
}
var obj = this.state.data.data.results.fields;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var LoadingView = React.createClass({
{
this.history.replaceState(null, '/search');
}
else if(data.isLoggedIn == false){
else if(data.isLoggedIn === false){
this.history.replaceState(null, '/login');
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var LoginView = React.createClass({
},
_onChange: function(data){
console.log(data);
if(data.failed == true)
if(data.failed === true)
{
this.setState({failed: true});
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const IndexerView = React.createClass({
this.setState({currentWatch: !this.state.currentWatch});
},
render: function() {
if(this.state.status == "loading"){
if(this.state.status === "loading"){
return (<div className="loader-inner ball-pulse">
<div/><div/><div/>
</div>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {UserStore} from '../../stores/userStore';
var UserMixin = {
mixins: [Router.Navigation],
componentWillMount: function() {
if(UserStore.getLogginState() == false)
if(UserStore.getLogginState() === false)
{
console.log("usermixin", "NOOOO");
this.transitionTo('loading');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ var AdvancedSearch = React.createClass({
}

//DATE
if(document.getElementById("datepicker").value != "")
if(document.getElementById("datepicker").value !== "")
{
var date = $('#datepicker').datepicker('getDate').getFullYear() + this.fix2($('#datepicker').datepicker('getDate').getMonth()) + this.fix2($('#datepicker').datepicker('getDate').getDate());

Expand All @@ -187,7 +187,7 @@ var AdvancedSearch = React.createClass({
var providerEl = document.getElementById("providersList");
var selectedId = providerEl.selectedIndex;
var provider = "";
if(selectedId == 0){
if(selectedId === 0){
provider = "all"
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var ImageView = React.createClass({
);
return (<div></div>);
},

handleSelect(item){
let {id} = item;
ResultSelectActions.select(item);
Expand All @@ -113,15 +113,15 @@ var ImageView = React.createClass({
</div>
);
},

sizePerPageListChange(sizePerPage){

},
sizePerPageListChange(sizePerPage){

onPageChange(page, sizePerPage) {
},

onPageChange(page, sizePerPage) {

},

},

onRowSelect: function(row) {
this.props.onItemClick(row);
},
Expand All @@ -130,8 +130,6 @@ var ImageView = React.createClass({
let self = this;
var resultArray = this.props.serie.images;

let sizeOptions = "20%"

var selectRowProp = {
clickToSelect: true,
mode: "none",
Expand All @@ -143,7 +141,7 @@ var ImageView = React.createClass({
<div>
<BootstrapTable data={resultArray} selectRow={selectRowProp}
pagination striped hover width="100%">
<TableHeaderColumn dataAlign="left" dataField="filename"
<TableHeaderColumn dataAlign="left" dataField="filename"
isKey={true} dataFormat={this.formatFileName} dataSort>
File Name
</TableHeaderColumn>
Expand All @@ -153,11 +151,11 @@ var ImageView = React.createClass({
</TableHeaderColumn>

<TableHeaderColumn dataAlign="center"
dataFormat={this.formatViewOptions} dataField="sopInstanceUID"
dataFormat={this.formatViewOptions} dataField="sopInstanceUID"
dataSort>View
</TableHeaderColumn>
<TableHeaderColumn dataAlign="center" dataField="sopInstanceUID"
dataFormat={this.formatThumbUrl}
dataFormat={this.formatThumbUrl}
dataSort>
Thumbnail
</TableHeaderColumn>
Expand Down Expand Up @@ -312,7 +310,7 @@ var PopOverView = React.createClass({
<TableHeaderColumn dataAlign="left"
dataField="field"
width="40%" isKey={false} dataSort>Field</TableHeaderColumn>

</BootstrapTable>
</div>
<div className='modal-footer'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ var SeriesView = React.createClass({
return (<div onClick={self.onSeriesClick.bind(this, item)} className="" style={{"cursor": "pointer"}}>&nbsp; {text}
</div>)
},
_wrapResult : function(result){
if (result===undefined)
result = "";

_wrapResult: function(result){
if (result === undefined)
result = "";
return result;
},
formatNumber: function(cell, item){
return this._wrapResult(this.formatGlobal(item.serieNumber, item));

},
formatModality: function(cell, item){
return this._wrapResult(this.formatGlobal(item.serieModality, item));
Expand All @@ -70,17 +71,17 @@ var SeriesView = React.createClass({
);
return (<div></div>);
},
handleSelect(item){
let {id} = item;
ResultSelectActions.select(item);
let value = this.refsClone[id].getValue();
this.setState({
resultsSelected: this.state.resultsSelected.concat(value)
});

handleSelect(item){
let {id} = item;
ResultSelectActions.select(item);
let value = this.refsClone[id].getValue();
this.setState({
resultsSelected: this.state.resultsSelected.concat(value)
});
},
handleRefs: function (id, input){
this.refsClone[id] = input;
this.refsClone[id] = input;
},
formatSelect: function (cell, item){
let {id} = item;
Expand All @@ -92,14 +93,14 @@ var SeriesView = React.createClass({
</div>
);
},
sizePerPageListChange(sizePerPage){
sizePerPageListChange(sizePerPage){

},

onPageChange(page, sizePerPage) {

},

onRowSelect: function(row){
this.props.onItemClick(row);
},
Expand All @@ -110,23 +111,22 @@ var SeriesView = React.createClass({
const self = this;

var resultArray = this.props.study.series;
let sizeOptions = "20%"

var selectRowProp = {
clickToSelect: true,
mode: "none",
bgColor: "rgb(163, 210, 216)",
onSelect: this.onRowSelect
};
return (

return (
<div>
<BootstrapTable data={resultArray} selectRow={selectRowProp} pagination striped hover width="100%">
<TableHeaderColumn dataAlign="right" dataField="serieInstanceUID" isKey dataFormat={this.formatNumber} dataSort>Number</TableHeaderColumn>
<TableHeaderColumn dataAlign="left" dataField="serieModality" dataFormat={this.formatModality} isKey={false} dataSort>Modality</TableHeaderColumn>
<TableHeaderColumn dataAlign="center" dataField="serieDescription" dataFormat={this.formatDescription} dataSort>Description</TableHeaderColumn>
<TableHeaderColumn dataAlign="center" dataField="serieInstanceUID" dataFormat={this.formaImages} dataSort>#Images</TableHeaderColumn>
<TableHeaderColumn hidden={!this.props.enableAdvancedSearch} dataAlign="center" dataField="serieInstanceUID" isKey={false} dataSort={false} dataFormat={this.formatOptions}>Options</TableHeaderColumn>
<TableHeaderColumn dataAlign="right" dataField="serieInstanceUID" isKey dataFormat={this.formatNumber} dataSort>Number</TableHeaderColumn>
<TableHeaderColumn dataAlign="left" dataField="serieModality" dataFormat={this.formatModality} isKey={false} dataSort>Modality</TableHeaderColumn>
<TableHeaderColumn dataAlign="center" dataField="serieDescription" dataFormat={this.formatDescription} dataSort>Description</TableHeaderColumn>
<TableHeaderColumn dataAlign="center" dataField="serieInstanceUID" dataFormat={this.formaImages} dataSort>#Images</TableHeaderColumn>
<TableHeaderColumn hidden={!this.props.enableAdvancedSearch} dataAlign="center" dataField="serieInstanceUID" isKey={false} dataSort={false} dataFormat={this.formatOptions}>Options</TableHeaderColumn>
<TableHeaderColumn hidden={!this.props.enableAdvancedSearch} dataAlign="center" dataField="serieInstanceUID" dataSort dataFormat={this.formatSelect}>#S</TableHeaderColumn>
</BootstrapTable>
<ConfirmModal show={self.state.unindexSelected !== null}
Expand All @@ -140,41 +140,39 @@ var SeriesView = React.createClass({
);
},
hideUnindex () {
if (this.isMounted())
this.setState({
unindexSelected: null
});
if (this.isMounted())
this.setState({
unindexSelected: null
});
},
showUnindex (item) {
if (this.isMounted())
this.setState({
unindexSelected: item
});
if (this.isMounted())
this.setState({
unindexSelected: item
});
},
hideRemove () {
if (this.isMounted())
this.setState({
removeSelected: null
});
if (this.isMounted())
this.setState({
removeSelected: null
});
},
showRemove (item) {
if (this.isMounted())
this.setState({
removeSelected: item
});
if (this.isMounted())
this.setState({
removeSelected: item
});
},
extractURISFromData: function(item){
var uris = [];
let uris = [];
for(let i in item.images)
uris.push(item.images[i].uri);
return uris;
},
onUnindexConfirm: function(item){
console.log(item)
var uris = this.extractURISFromData(item);

let uris = this.extractURISFromData(item);
let p = this.props.provider;

ActionCreators.unindex(uris, p);
},
onRemoveConfirm: function(item){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ var StudyView = React.createClass({
</div>);
return (<div></div>);
},
handleSelect(item){

handleSelect(item){
let {id} = item;
ResultSelectActions.select(item);
let value = this.refsClone[id].getValue();
Expand All @@ -87,8 +87,8 @@ var StudyView = React.createClass({
</div>
);
},
sizePerPageListChange(sizePerPage){

sizePerPageListChange(sizePerPage){

},

Expand All @@ -100,8 +100,6 @@ var StudyView = React.createClass({
var self = this;
var resultArray = this.props.patient.studies;

let sizeOptions = "20%"

var selectRowProp = {
clickToSelect: true,
mode: "none",
Expand All @@ -113,10 +111,10 @@ var StudyView = React.createClass({
<div>
<BootstrapTable data={resultArray} selectRow={selectRowProp} pagination striped hover width="100%">
<TableHeaderColumn dataAlign="right" dataField="studyInstanceUID" isKey dataFormat={this.formatStudyDate} dataSort>Date</TableHeaderColumn>
<TableHeaderColumn dataAlign="left" dataField="studyDescription" dataFormat={this.formatStudyDescription} isKey={false} dataSort>Description</TableHeaderColumn>
<TableHeaderColumn dataAlign="left" dataField="studyDescription" dataFormat={this.formatStudyDescription} isKey dataSort>Description</TableHeaderColumn>
<TableHeaderColumn dataAlign="center" dataField="institutionName" dataFormat={this.formatInstitutionName}dataSort>Institution</TableHeaderColumn>
<TableHeaderColumn dataAlign="center" dataField="modalities" dataFormat={this.formatModalities} dataSort={true}>Modality</TableHeaderColumn>
<TableHeaderColumn hidden={!this.props.enableAdvancedSearch} dataAlign="center" dataField="Opts" isKey={false} dataSort={false} dataFormat={this.formatOptions}>Options</TableHeaderColumn>
<TableHeaderColumn dataAlign="center" dataField="modalities" dataFormat={this.formatModalities} dataSort>Modality</TableHeaderColumn>
<TableHeaderColumn hidden={!this.props.enableAdvancedSearch} dataAlign="center" dataField="Opts" isKey={false} dataSort={false} dataFormat={this.formatOptions}>Options</TableHeaderColumn>
<TableHeaderColumn hidden={!this.props.enableAdvancedSearch} dataAlign="center" dataField="Select" dataSort dataFormat={this.formatSelect}>#S</TableHeaderColumn>
</BootstrapTable>
<ConfirmModal show={self.state.unindexSelected !== null}
Expand Down
Loading

0 comments on commit b0f781c

Please sign in to comment.