summaryrefslogtreecommitdiffstats
path: root/extensions/MozReview/web/js
diff options
context:
space:
mode:
authorMark Côté <mcote@alumni.uwaterloo.ca>2016-08-03 17:59:23 +0200
committerMark Côté <mcote@alumni.uwaterloo.ca>2016-08-03 17:59:23 +0200
commitdf005eaa61f55b352751dda0f3efb319c3b40981 (patch)
treea39ef9b771e25fc0588c80aca472af02555497d8 /extensions/MozReview/web/js
parent04eaf299e8e5670b93f08f99950cd02db532fb30 (diff)
downloadbugzilla-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/MozReview/web/js')
-rw-r--r--extensions/MozReview/web/js/mozreview.js34
1 files changed, 24 insertions, 10 deletions
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)))