Merge "Show a count of changes in each pipeline on the status page"

This commit is contained in:
Jenkins 2013-08-17 15:37:28 +00:00 committed by Gerrit Code Review
commit 0ef6a1d0a6
2 changed files with 26 additions and 5 deletions

View File

@ -24,6 +24,12 @@
.change > .header > .time { .change > .header > .time {
float: right; float: right;
} }
.pipeline > .subhead > .count {
float: right;
margin-right: 1em;
color: #535353;
font-size: 11pt;
}
.job { .job {
display: block; display: block;
} }

View File

@ -29,7 +29,7 @@ function format_time(ms, words) {
r += hours; r += hours;
r += ' hr '; r += ' hr ';
} }
r += minutes + ' min' r += minutes + ' min';
} else { } else {
if (hours < 10) r += '0'; if (hours < 10) r += '0';
r += hours + ':'; r += hours + ':';
@ -62,9 +62,24 @@ function is_hide_project(project) {
return project.indexOf(filter) == -1; return project.indexOf(filter) == -1;
} }
function count_changes(pipeline) {
var count = 0;
$.each(pipeline['change_queues'], function(change_queue_i, change_queue) {
$.each(change_queue['heads'], function(head_i, head) {
count += head.length;
});
});
return count;
}
function format_pipeline(data) { function format_pipeline(data) {
var count = count_changes(data);
var html = '<div class="pipeline"><h3 class="subhead">'+ var html = '<div class="pipeline"><h3 class="subhead">'+
data['name']+'</h3>'; data['name'];
if (count > 0) {
html += ' <span class="count">(' + count + ')</span>';
}
html += '</h3>';
if (data['description'] != null) { if (data['description'] != null) {
html += '<p>'+data['description']+'</p>'; html += '<p>'+data['description']+'</p>';
} }
@ -88,11 +103,11 @@ function format_pipeline(data) {
if (name.length > 32) { if (name.length > 32) {
name = name.substr(0,32) + '...'; name = name.substr(0,32) + '...';
} }
html += name + '</a></div>' html += name + '</a></div>';
} }
$.each(head, function(change_i, change) { $.each(head, function(change_i, change) {
if (change_i > 0) { if (change_i > 0) {
html += '<div class="arrow">&uarr;</div>' html += '<div class="arrow">&uarr;</div>';
} }
html += format_change(change); html += format_change(change);
}); });
@ -218,7 +233,7 @@ function update() {
function update_graphs() { function update_graphs() {
$('.graph').each(function(i, img) { $('.graph').each(function(i, img) {
var newimg = new Image() var newimg = new Image();
var parts = img.src.split('#'); var parts = img.src.split('#');
newimg.src = parts[0] + '#' + new Date().getTime(); newimg.src = parts[0] + '#' + new Date().getTime();
$(newimg).load(function (x) { $(newimg).load(function (x) {