Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring Checker statistics page #1686

Merged
merged 1 commit into from
Sep 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions www/scripts/codecheckerviewer/CheckerStatistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ function (declare, lang, ItemFileWriteStore, dom, Deferred, all, Memory,
this.structure = [
{ name : 'Checker', field : 'checker', width : '100%', formatter : checkerNameFormatter},
{ name : 'Severity', field : 'severity', styles : 'text-align: center;', width : '15%', formatter : severityFormatter},
{ name : '<span class="customIcon detection-status-unresolved"></span> All reports', field : 'reports', width : '20%', formatter : numberFormatter},
{ name : '<span class="customIcon detection-status-resolved"></span> Resolved', field : 'resolved', width : '20%', formatter : numberFormatter},
{ name : '<span class="customIcon review-status-unreviewed"></span> Unreviewed', field : 'unreviewed', width : '20%', formatter : numberFormatter},
{ name : '<span class="customIcon review-status-confirmed"></span>Confirmed bug', field : 'confirmed', width : '20%', formatter : numberFormatter},
{ name : '<span class="customIcon review-status-false-positive"></span> False positive', field : 'falsePositive', width : '20%', formatter : numberFormatter},
{ name : "<span class= \"customIcon review-status-intentional\"></span>Intentional", field : 'intentional', width : '20%', formatter : numberFormatter}
{ name : "<span class= \"customIcon review-status-intentional\"></span>Intentional", field : 'intentional', width : '20%', formatter : numberFormatter},
{ name : '<span class="customIcon detection-status-unresolved"></span> All reports', field : 'reports', width : '20%', formatter : numberFormatter}
];

this.focused = true;
Expand Down Expand Up @@ -101,12 +100,6 @@ function (declare, lang, ItemFileWriteStore, dom, Deferred, all, Memory,
filter._severityFilter.select(
filter._severityFilter.stateConverter(item.severity[0]));
break;
case 'resolved':
if (!item.resolved[0]) return;

detectionFilter.select(detectionFilter.stateConverter(
CC_OBJECTS.DetectionStatus.RESOLVED));
break;
case 'unreviewed':
if (!item.unreviewed[0]) return;

Expand Down Expand Up @@ -164,8 +157,7 @@ function (declare, lang, ItemFileWriteStore, dom, Deferred, all, Memory,
{field : 'reviewStatus', values : [CC_OBJECTS.ReviewStatus.UNREVIEWED]},
{field : 'reviewStatus', values : [CC_OBJECTS.ReviewStatus.CONFIRMED]},
{field : 'reviewStatus', values : [CC_OBJECTS.ReviewStatus.FALSE_POSITIVE]},
{field : 'reviewStatus', values : [CC_OBJECTS.ReviewStatus.INTENTIONAL]},
{field : 'detectionStatus', values : [CC_OBJECTS.DetectionStatus.RESOLVED]}
{field : 'reviewStatus', values : [CC_OBJECTS.ReviewStatus.INTENTIONAL]}
].map(function (q) {
var deferred = new Deferred();

Expand Down Expand Up @@ -196,8 +188,7 @@ function (declare, lang, ItemFileWriteStore, dom, Deferred, all, Memory,
unreviewed : res[1][key] !== undefined ? res[1][key].count : 0,
confirmed : res[2][key] !== undefined ? res[2][key].count : 0,
falsePositive : res[3][key] !== undefined ? res[3][key].count : 0,
intentional : res[4][key] !== undefined ? res[4][key].count : 0,
resolved : res[5][key] !== undefined ? res[5][key].count : 0
intentional : res[4][key] !== undefined ? res[4][key].count : 0
});
});
that.sort();
Expand Down
38 changes: 36 additions & 2 deletions www/scripts/codecheckerviewer/CheckerStatisticsFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ define([
'codechecker/filter/CheckerMessageFilter',
'codechecker/filter/CheckerNameFilter',
'codechecker/filter/DateFilter',
'codechecker/filter/DetectionStatusFilter',
'codechecker/filter/FileFilter',
'codechecker/filter/ReportCount',
'codechecker/filter/RunBaseFilter',
'codechecker/filter/RunHistoryTagFilter',
'codechecker/filter/SeverityFilter',
'codechecker/filter/SourceComponentFilter',
'codechecker/filter/UniqueFilter'],
function (declare, lang, dom, Button, hashHelper, BugFilterView,
CheckerMessageFilter, CheckerNameFilter, DateFilter, FileFilter, ReportCount,
RunBaseFilter, RunHistoryTagFilter, SourceComponentFilter, UniqueFilter) {
CheckerMessageFilter, CheckerNameFilter, DateFilter, DetectionStatusFilter,
FileFilter, ReportCount, RunBaseFilter, RunHistoryTagFilter, SeverityFilter,
SourceComponentFilter, UniqueFilter) {

return declare(BugFilterView, {
postCreate : function () {
Expand Down Expand Up @@ -53,6 +56,11 @@ function (declare, lang, dom, Button, hashHelper, BugFilterView,
},
updateReportFilter : function (isUnique) {
that.reportFilter.isUnique = isUnique;

if (isUnique)
that._detectionStatusFilter.notAvailable();
else
that._detectionStatusFilter.available();
}
});
this.register(this._uniqueFilter);
Expand Down Expand Up @@ -99,6 +107,32 @@ function (declare, lang, dom, Button, hashHelper, BugFilterView,
this.register(this._runHistoryTagFilter);
this.addChild(this._runHistoryTagFilter);

//--- Detection status filter ---//

this._detectionStatusFilter = new DetectionStatusFilter({
class : 'detection-status',
title : 'Detection status',
parent : this,
updateReportFilter : function (detectionStatuses) {
that.reportFilter.detectionStatus = detectionStatuses;
}
});
this.register(this._detectionStatusFilter);
this.addChild(this._detectionStatusFilter);

//--- Severity filter ---//

this._severityFilter = new SeverityFilter({
class : 'severity',
title : 'Severity',
parent : this,
updateReportFilter : function (severities) {
that.reportFilter.severity = severities;
}
});
this.register(this._severityFilter);
this.addChild(this._severityFilter);

//--- Detection date filter ---//

this._detectionDateFilter = new DateFilter({
Expand Down
82 changes: 7 additions & 75 deletions www/scripts/codecheckerviewer/filter/BugFilterView.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@ define([
'codechecker/filter/FileFilter',
'codechecker/filter/ReportCount',
'codechecker/filter/ReportHashFilter',
'codechecker/filter/ReviewStatusFilter',
'codechecker/filter/RunBaseFilter',
'codechecker/filter/RunHistoryTagFilter',
'codechecker/filter/SelectFilter',
'codechecker/filter/SeverityFilter',
'codechecker/filter/SourceComponentFilter',
'codechecker/filter/UniqueFilter',
'codechecker/util'],
function (declare, lang, Deferred, domClass, dom, domStyle, topic,
ConfirmDialog, Dialog, Button, ContentPane, hashHelper, CheckerMessageFilter,
CheckerNameFilter, DateFilter, DetectionStatusFilter, DiffTypeFilter,
FileFilter, ReportCount, ReportHashFilter, RunBaseFilter, RunHistoryTagFilter,
SelectFilter, SourceComponentFilter, UniqueFilter, util) {
FileFilter, ReportCount, ReportHashFilter, ReviewStatusFilter, RunBaseFilter,
RunHistoryTagFilter, SelectFilter, SeverityFilter, SourceComponentFilter,
UniqueFilter, util) {

var FilterToggle = declare(ContentPane, {
class : 'filter-toggle',
Expand Down Expand Up @@ -312,51 +315,12 @@ function (declare, lang, Deferred, domClass, dom, domStyle, topic,

//--- Review status filter ---//

this._reviewStatusFilter = new SelectFilter({
this._reviewStatusFilter = new ReviewStatusFilter({
class : 'review-status',
title : 'Review status',
parent : this,
updateReportFilter : function (reviewStatuses) {
that.reportFilter.reviewStatus = reviewStatuses;
},
stateConverter : function (value) {
var status = util.enumValueToKey(
CC_OBJECTS.ReviewStatus, parseInt(value)).replace('_', ' ');
return status.charAt(0).toUpperCase() + status.slice(1).toLowerCase();
},
stateDecoder : function (key) {
return CC_OBJECTS.ReviewStatus[key.replace(' ', '_').toUpperCase()];
},
defaultValues : function () {
var state = {};
state[this.class] = [
CC_OBJECTS.ReviewStatus.UNREVIEWED,
CC_OBJECTS.ReviewStatus.CONFIRMED
].map(this.stateConverter);

return state;
},
getIconClass : function (value) {
var statusCode = this.stateDecoder(value);
return 'customIcon ' + util.reviewStatusCssClass(statusCode);
},
getItems : function (opt) {
opt = that.initReportFilterOptions(opt);
opt.reportFilter.reviewStatus = null;

var deferred = new Deferred();
CC_SERVICE.getReviewStatusCounts(opt.runIds, opt.reportFilter,
opt.cmpData, function (res) {
deferred.resolve(Object.keys(CC_OBJECTS.ReviewStatus).map(
function (key) {
var value = CC_OBJECTS.ReviewStatus[key];
return {
value : util.reviewStatusFromCodeToString(value),
count : res[value] !== undefined ? res[value] : 0
};
}));
});
return deferred;
}
});
this.register(this._reviewStatusFilter);
Expand All @@ -377,44 +341,12 @@ function (declare, lang, Deferred, domClass, dom, domStyle, topic,

//--- Severity filter ---//

this._severityFilter = new SelectFilter({
this._severityFilter = new SeverityFilter({
class : 'severity',
title : 'Severity',
parent : this,
updateReportFilter : function (severities) {
that.reportFilter.severity = severities;
},
stateConverter : function (value) {
var status = util.enumValueToKey(
CC_OBJECTS.Severity, parseInt(value));
return status.charAt(0).toUpperCase() + status.slice(1).toLowerCase();
},
stateDecoder : function (key) {
return CC_OBJECTS.Severity[key.toUpperCase()];
},
getIconClass : function (value) {
return 'customIcon icon-severity-' + value.toLowerCase();
},
getItems : function (opt) {
opt = that.initReportFilterOptions(opt);
opt.reportFilter.severity = null;

var deferred = new Deferred();
CC_SERVICE.getSeverityCounts(opt.runIds, opt.reportFilter,
opt.cmpData, function (res) {
deferred.resolve(Object.keys(CC_OBJECTS.Severity).sort(
function (a, b) {
return CC_OBJECTS.Severity[a] < CC_OBJECTS.Severity[b];
}).map(function (key) {
var value = CC_OBJECTS.Severity[key];
return {
value : key[0] + key.slice(1).toLowerCase(),
count : res[value] !== undefined ? res[value] : 0
};
}));
});

return deferred;
}
});
this.register(this._severityFilter);
Expand Down
54 changes: 54 additions & 0 deletions www/scripts/codecheckerviewer/filter/ReviewStatusFilter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// -------------------------------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add the review status filter as it appears as column in the statistics table.

Remove the "Resolved" column from the table and add the "detection status" as a filter among the filters.
This way one can show the distribution of the review status for the "currently outstanding" or for the "fixed bugs".

// The CodeChecker Infrastructure
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// -------------------------------------------------------------------------

define([
'dojo/_base/declare',
'dojo/Deferred',
'codechecker/filter/SelectFilter',
'codechecker/util'],
function (declare, Deferred, SelectFilter, util) {
return declare(SelectFilter, {
stateConverter : function (value) {
var status = util.enumValueToKey(
CC_OBJECTS.ReviewStatus, parseInt(value)).replace('_', ' ');
return status.charAt(0).toUpperCase() + status.slice(1).toLowerCase();
},
stateDecoder : function (key) {
return CC_OBJECTS.ReviewStatus[key.replace(' ', '_').toUpperCase()];
},
defaultValues : function () {
var state = {};
state[this.class] = [
CC_OBJECTS.ReviewStatus.UNREVIEWED,
CC_OBJECTS.ReviewStatus.CONFIRMED
].map(this.stateConverter);

return state;
},
getIconClass : function (value) {
var statusCode = this.stateDecoder(value);
return 'customIcon ' + util.reviewStatusCssClass(statusCode);
},
getItems : function (opt) {
opt = this.parent.initReportFilterOptions(opt);
opt.reportFilter.reviewStatus = null;

var deferred = new Deferred();
CC_SERVICE.getReviewStatusCounts(opt.runIds, opt.reportFilter,
opt.cmpData, function (res) {
deferred.resolve(Object.keys(CC_OBJECTS.ReviewStatus).map(
function (key) {
var value = CC_OBJECTS.ReviewStatus[key];
return {
value : util.reviewStatusFromCodeToString(value),
count : res[value] !== undefined ? res[value] : 0
};
}));
});
return deferred;
}
});
});
47 changes: 47 additions & 0 deletions www/scripts/codecheckerviewer/filter/SeverityFilter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// -------------------------------------------------------------------------
// The CodeChecker Infrastructure
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// -------------------------------------------------------------------------

define([
'dojo/_base/declare',
'dojo/Deferred',
'codechecker/filter/SelectFilter',
'codechecker/util'],
function (declare, Deferred, SelectFilter, util) {
return declare(SelectFilter, {
stateConverter : function (value) {
var status = util.enumValueToKey(
CC_OBJECTS.Severity, parseInt(value));
return status.charAt(0).toUpperCase() + status.slice(1).toLowerCase();
},
stateDecoder : function (key) {
return CC_OBJECTS.Severity[key.toUpperCase()];
},
getIconClass : function (value) {
return 'customIcon icon-severity-' + value.toLowerCase();
},
getItems : function (opt) {
opt = this.parent.initReportFilterOptions(opt);
opt.reportFilter.severity = null;

var deferred = new Deferred();
CC_SERVICE.getSeverityCounts(opt.runIds, opt.reportFilter,
opt.cmpData, function (res) {
deferred.resolve(Object.keys(CC_OBJECTS.Severity).sort(
function (a, b) {
return CC_OBJECTS.Severity[a] < CC_OBJECTS.Severity[b];
}).map(function (key) {
var value = CC_OBJECTS.Severity[key];
return {
value : key[0] + key.slice(1).toLowerCase(),
count : res[value] !== undefined ? res[value] : 0
};
}));
});

return deferred;
}
});
});