Skip to content

Commit

Permalink
Create tooltip for some table column
Browse files Browse the repository at this point in the history
Create tooltip for the following table columns:
  * version tag
  * detection status
  * number of unresolved reports
  • Loading branch information
csordasmarton committed May 15, 2018
1 parent 8312bd6 commit 1b5ea3b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion www/scripts/codecheckerviewer/ListOfBugs.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function (declare, dom, style, Deferred, ObjectStore, Store, QueryResults,
{ name : 'Severity', field : 'severity', cellClasses : 'severity', width : '15%', formatter : severityFormatter },
{ name : 'Bug path length', field : 'bugPathLength', cellClasses : 'bug-path-length', width : '15%', formatter : bugPathLengthFormatter },
{ name : 'Review status', field : 'reviewStatus', cellClasses : 'review-status', width : '15%', formatter : reviewStatusFormatter },
{ name : 'Detection status', field : 'detectionStatus', cellClasses : 'detection-status', width : '15%', formatter : detectionStatusFormatter }
{ name : '<span title="' + util.getTooltip('detectionStatus') + '">Detection status</span>', field : 'detectionStatus', cellClasses : 'detection-status', width : '15%', formatter : detectionStatusFormatter }
];

this.focused = true;
Expand Down
15 changes: 11 additions & 4 deletions www/scripts/codecheckerviewer/ListOfRuns.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,17 @@ function (declare, dom, ItemFileWriteStore, topic, Dialog, Button,
}

function versionTagFormatter(param) {
var versionTag = util.createRunTag(param.runName, param.versionTag);
var versionTag = util.createRunTag(param.runName, param.versionTag,
util.getTooltip('versionTag'));

return versionTag ? versionTag.outerHTML : '';
}

function numberOfUnresolvedBugsFormatter (num) {
return '<span title="' + util.getTooltip('numOfUnresolved') + '">'
+ num + '</span>'
}

var ListOfRunsGrid = declare(DataGrid, {
constructor : function () {
this.store = new ItemFileWriteStore({
Expand All @@ -78,12 +85,12 @@ function (declare, dom, ItemFileWriteStore, topic, Dialog, Button,
this.structure = [
{ name : 'Diff', field : 'diff', styles : 'text-align: center;', formatter : diffBtnFormatter},
{ name : 'Name', field : 'name', styles : 'text-align: left;', width : '100%' },
{ name : 'Number of unresolved reports', field : 'numberofbugs', styles : 'text-align: center;', width : '20%' },
{ name : '<span title="' + util.getTooltip('numOfUnresolved') + '">Number of unresolved reports</span>', field : 'numberofbugs', formatter: numberOfUnresolvedBugsFormatter, styles : 'text-align: center;', width : '20%' },
{ name : 'Storage date', field : 'date', styles : 'text-align: center;', width : '30%' },
{ name : 'Analysis duration', field : 'duration', styles : 'text-align: center;' },
{ name : 'Check command', field : 'checkcmd', styles : 'text-align: center;' },
{ name : 'Detection status', field : 'detectionstatus', styles : 'text-align: center;', width : '30%' },
{ name : 'Version tag', field : 'versionTag', formatter : versionTagFormatter },
{ name : '<span title="' + util.getTooltip('detectionStatus') + '">Detection status</span>', field : 'detectionstatus', styles : 'text-align: center;', width : '30%' },
{ name : '<span title="' + util.getTooltip('versionTag') + '">Version tag</span>', field : 'versionTag', formatter : versionTagFormatter },
{ name : 'Delete', field : 'del', styles : 'text-align: center;', type : 'dojox.grid.cells.Bool', editable : true }
];

Expand Down
25 changes: 23 additions & 2 deletions www/scripts/codecheckerviewer/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ function (locale, dom, style, json) {
'July', 'August', 'September', 'October', 'November', 'December'
];

var tooltips = {
detectionStatus : "Detection statuses are calculated based on the previous "
+ "detection status values when the reports are stored "
+ "again with the same run name. When storing the results "
+ "of a run from scratch then each report will have "
+ "detection status of 'New'.",
numOfUnresolved : "Number of unresolved reports are calculated on the "
+ "following way: 'Non unique reports' - 'Resolved' "
+ "- 'False positive' - 'Intentional'",
versionTag : "Latest version tag of this run."
};

return {
/**
* This function returns the first element of the given array for which the
Expand Down Expand Up @@ -314,10 +326,15 @@ function (locale, dom, style, json) {
* @param runName {string} - Name of the run.
* @param tag {string} - Tag of the run.
*/
createRunTag : function (runName, tag) {
createRunTag : function (runName, tag, tooltip) {
if (!tag) return;

var tagWrapper = dom.create('span', { class : 'tag-wrapper', title: 'Version tag' });
if (tooltip === undefined)
tooltip = 'Version tag';

var tagWrapper =
dom.create('span', { class : 'tag-wrapper', title: tooltip });

dom.create('span', {
class : 'customIcon tag',
style : 'color:' + this.strToColor(runName + ':' + tag)
Expand Down Expand Up @@ -451,6 +468,10 @@ function (locale, dom, style, json) {

link.click();
document.body.removeChild(link);
},

getTooltip : function (name) {
return tooltips[name] ? tooltips[name] : '';
}
};
});

0 comments on commit 1b5ea3b

Please sign in to comment.