Skip to content

Commit

Permalink
Merge pull request #1582 from csordasmarton/tbl-column-tooltips
Browse files Browse the repository at this point in the history
Create tooltip for some table column
  • Loading branch information
gyorb authored May 15, 2018
2 parents 9f8bbe2 + 4540669 commit 70c9817
Show file tree
Hide file tree
Showing 3 changed files with 34 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
24 changes: 22 additions & 2 deletions www/scripts/codecheckerviewer/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ function (locale, dom, style, json) {
'July', 'August', 'September', 'October', 'November', 'December'
];

var tooltips = {
detectionStatus : "Detection statuses are calculated based on the "
+ "detection status values from the previous store where "
+ "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 non unique reports excluding Resolved, "
+ "False positive and Intentional reports",
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 +325,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 @@ -463,6 +479,10 @@ function (locale, dom, style, json) {
+ '"Unique reports" a report appears only once even if it is found '
+ 'on several paths.'
}, uniqueCheckBox.domNode, 'after');
},

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

0 comments on commit 70c9817

Please sign in to comment.