diff options
author | Mark Côté <mcote@alumni.uwaterloo.ca> | 2016-08-03 17:59:23 +0200 |
---|---|---|
committer | Mark Côté <mcote@alumni.uwaterloo.ca> | 2016-08-03 17:59:23 +0200 |
commit | df005eaa61f55b352751dda0f3efb319c3b40981 (patch) | |
tree | a39ef9b771e25fc0588c80aca472af02555497d8 /extensions | |
parent | 04eaf299e8e5670b93f08f99950cd02db532fb30 (diff) | |
download | bugzilla-df005eaa61f55b352751dda0f3efb319c3b40981.tar.gz bugzilla-df005eaa61f55b352751dda0f3efb319c3b40981.tar.xz |
Bug 1286027 - Display MozReview diff stats r=glob
Now that MozReview's ReviewRequestSummary API has diff stats (lines added
and removed), we can display that in BMO's MozReview table.
I also removed the commit ID and made the summary link to the diff, since
the former doesn't seem to be particularly useful.
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/MozReview/template/en/default/moz_review/table.html.tmpl | 2 | ||||
-rw-r--r-- | extensions/MozReview/web/js/mozreview.js | 34 | ||||
-rw-r--r-- | extensions/MozReview/web/style/mozreview.css | 5 |
3 files changed, 28 insertions, 13 deletions
diff --git a/extensions/MozReview/template/en/default/moz_review/table.html.tmpl b/extensions/MozReview/template/en/default/moz_review/table.html.tmpl index 7f5c3a89d..84b7add47 100644 --- a/extensions/MozReview/template/en/default/moz_review/table.html.tmpl +++ b/extensions/MozReview/template/en/default/moz_review/table.html.tmpl @@ -11,7 +11,7 @@ <tr> <th>Submitter</th> <th>Diff</th> - <th>Reviews</th> + <th>Changes</th> <th>Open Issues</th> <th>Last Updated</th> </tr> diff --git a/extensions/MozReview/web/js/mozreview.js b/extensions/MozReview/web/js/mozreview.js index 22ef4c5f1..6fe51f53b 100644 --- a/extensions/MozReview/web/js/mozreview.js +++ b/extensions/MozReview/web/js/mozreview.js @@ -27,32 +27,46 @@ MozReview.getReviewRequest = function() { return rrUrl(rrId) + 'diff/#index_header'; } + function humanizedInt(i) { + if (i > 1000) { + return (i / 1000).toFixed(1) + 'k'; + } else { + return '' + i; + } + } + function rrCommitRow(rr, firstCommit) { var trCommit = tr.clone(); var tdSubmitter = td.clone(); - var tdRev = td.clone(); var tdSummary = td.clone(); var diffLink = link.clone(); - var reviewLink = link.clone(); + var diffStat = ''; if (firstCommit) { tdSubmitter.text(rr.submitter); } + tdSummary.addClass('mozreview-summary'); diffLink.attr('href', rrDiffUrl(rr.id)); - diffLink.text(rr.commit.substr(0, 12)); - diffLink.addClass('mozreview-diff-link'); - tdRev.append(diffLink); + diffLink.text(rr.summary); + tdSummary.append(diffLink); - tdSummary.addClass('mozreview-summary'); - reviewLink.attr('href', rrUrl(rr.id)); - reviewLink.text(rr.summary); - tdSummary.append(reviewLink); + if (rr.diff.insert > 0) { + diffStat = '+' + humanizedInt(rr.diff.insert); + } + + if (rr.diff.delete > 0) { + if (diffStat.length > 0) { + diffStat += ' / '; + } + diffStat += '-' + humanizedInt(rr.diff.delete); + } trCommit.append( tdSubmitter, - tdRev, tdSummary, + td.clone().text(diffStat) + .addClass('mozreview-diffstat'), td.clone().text(rr.issue_open_count) .addClass('mozreview-open-issues'), td.clone().text(timeAgo(new Date(rr.last_updated))) diff --git a/extensions/MozReview/web/style/mozreview.css b/extensions/MozReview/web/style/mozreview.css index 4a288d927..a2263fc11 100644 --- a/extensions/MozReview/web/style/mozreview.css +++ b/extensions/MozReview/web/style/mozreview.css @@ -50,8 +50,9 @@ text-align: center; } -.mozreview-diff-link { - font-family: monospace; +.mozreview-requests .mozreview-diffstat { + text-align: center; + white-space: nowrap; } /* bug-modal specific */ |