Skip to content

Commit

Permalink
Merge pull request #1574 from csordasmarton/run-history-click-default…
Browse files Browse the repository at this point in the history
…-values

Set default filter values on run history click
  • Loading branch information
gyorb authored May 14, 2018
2 parents 70ac332 + a01daf2 commit ba95ead
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 3 additions & 9 deletions www/scripts/codecheckerviewer/RunHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,10 @@ function (declare, dom, topic, Dialog, Standby, ContentPane, hashHelper, util) {
if (filter._runBaseLineFilter)
filter._runBaseLineFilter.select(item.runName);

if (!item.versionTag) {
[
CC_OBJECTS.DetectionStatus.NEW,
CC_OBJECTS.DetectionStatus.UNRESOLVED,
CC_OBJECTS.DetectionStatus.REOPENED
].forEach(function (status) {
filter._detectionStatusFilter.select(
filter._detectionStatusFilter.stateConverter(status));
});
filter._detectionStatusFilter.selectDefaultValues();
filter._reviewStatusFilter.selectDefaultValues();

if (!item.versionTag) {
var date = new Date(item.time.replace(/ /g,'T'));
filter._detectionDateFilter.initFixedDateInterval(
this._formatDate(date));
Expand Down
12 changes: 12 additions & 0 deletions www/scripts/codecheckerviewer/filter/SelectFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ function (declare, dom, Standby, ContentPane, Tooltip, FilterBase,
return state;
},

defaultValues : function () { return {}; },

selectDefaultValues : function () {
var that = this;

var values = this.defaultValues();
var states = values[this.class];
if (!states) return;

states.forEach(function (status) { that.select(status); });
},

// Returns the selected filter item values.
getSelectedItemValues : function () {
var keys = Object.keys(this.selectedItems);
Expand Down

0 comments on commit ba95ead

Please sign in to comment.