summaryrefslogtreecommitdiffstats
path: root/extensions/MozReview/web
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
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')
-rw-r--r--extensions/MozReview/web/js/mozreview.js34
-rw-r--r--extensions/MozReview/web/style/mozreview.css5
2 files changed, 27 insertions, 12 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)))
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 */