Skip to content

Commit

Permalink
Merge pull request #991 from csordasmarton/checker_statistics_fix
Browse files Browse the repository at this point in the history
Fix checker statistics drop down
  • Loading branch information
gyorb authored Oct 4, 2017
2 parents 31d9f1a + e965d85 commit a3d8f81
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions www/scripts/codecheckerviewer/CheckerStatistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ function (declare, ItemFileWriteStore, Deferred, all, Memory, Observable,
this.inherited(arguments);

if(this.dropDown && this.dropDownButton){
var label = '';

this.options.forEach(function(option) {
if (option.selected)
label += (label.length ? ', ' : '') + option.label;
var selectedOptions = this.options.filter(function (opt) {
return opt.selected;
});

this.dropDownButton.set('label', label.length ? label : this.label);
var label = selectedOptions.length ? selectedOptions.length == 1
? selectedOptions[0].label : "Multiple runs"
: this.label;

this.dropDownButton.set('label', label);
}
}
});
Expand All @@ -67,15 +68,21 @@ function (declare, ItemFileWriteStore, Deferred, all, Memory, Observable,
dropDown : true,
onChange : function (state) {
that.selectedRuns = state;
this.changed = true;
},
onBlur : function () {
if (!this.changed)
return;

var runIds = [];
this.store.query({}).forEach(function (item) {
if (state.indexOf(item.label) !== -1)
if (that.selectedRuns.indexOf(item.label) !== -1)
runIds.push(item.value);
});

that.dataGrid.refreshGrid(runIds);
hashHelper.setStateValue('run', state);
hashHelper.setStateValue('run', that.selectedRuns);
this.changed = false;
}
});

Expand Down Expand Up @@ -112,10 +119,10 @@ function (declare, ItemFileWriteStore, Deferred, all, Memory, Observable,
});
});

if (!that.selectedRuns)
setTimeout(function () { that.dataGrid.refreshGrid(); }, 0);
else
if (that.selectedRuns)
that._runFilter.set('value', that.selectedRuns);

that.dataGrid.refreshGrid();
});
}
});
Expand Down Expand Up @@ -146,12 +153,6 @@ function (declare, ItemFileWriteStore, Deferred, all, Memory, Observable,
this.sortInfo = -2; // sort by severity
},

postCreate : function () {
this.inherited(arguments);

this._populateStatistics();
},

onRowClick : function (evt) {
var that = this;
var item = this.getItem(evt.rowIndex);
Expand Down

0 comments on commit a3d8f81

Please sign in to comment.