Merge "provide time in queue in zuul ui"

This commit is contained in:
Jenkins 2014-01-18 00:10:01 +00:00 committed by Gerrit Code Review
commit aa4d760170
2 changed files with 55 additions and 18 deletions

View File

@ -85,7 +85,7 @@ td.tree {
.change > .header {
background: #E2ECEF;
color: black;
margin: -2px -2px 2px -2px;
margin: -2px;
padding: 4px;
}
.change > .header > .changeid {
@ -97,6 +97,9 @@ td.tree {
.change > .hover {
background: #F3FDFF;
}
.jobs {
padding-top: 4px;
}
.jobwrapper {
display: table;
width: 100%;
@ -111,12 +114,19 @@ td.tree {
.result_success {
color: #007f00;
}
.queue_bad,
.result_failure {
color: #cf2f19;
}
.queue_warn,
.result_unstable {
color: #e39f00;
}
.queue_good {
color: #888888;
}
#graph-container img {
margin-left: 10px;
}

View File

@ -16,6 +16,20 @@ window.zuul_enable_status_updates = true;
window.zuul_filter = [];
window.zuul_collapsed_exceptions = [];
function format_enqueue_time(time) {
var hours = 60 * 60 * 1000;
var now = Date.now();
var delta = now - time;
var status = "queue_good";
var text = format_time(delta, true);
if (delta > (4 * hours)) {
status = "queue_bad";
} else if (delta > (2 * hours)) {
status = "queue_warn";
}
return '<span class="' + status + '">' + text + '</span>';
}
function format_time(ms, words) {
if (ms == null) {
return "unknown";
@ -235,21 +249,6 @@ function format_change(change, change_queue) {
'onmouseout="$(this).removeClass(\'hover\')">';
html += '<span class="project">' + change['project'] + '</span>';
var id = change['id'];
var url = change['url'];
if (id !== null) {
if (id.length == 40) {
id = id.substr(0,7);
}
html += '<span class="changeid">';
if (url !== null) {
html += '<a href="'+url+'">';
}
html += id;
if (url !== null) {
html += '</a>';
}
}
display = $('#expandByDefault').is(':checked');
safe_change_id = safe_id(change['id']);
@ -259,9 +258,37 @@ function format_change(change, change_queue) {
display = !display;
}
html += '</span><span class="time">';
html += '<span class="time">';
html += format_time(change['remaining_time'], true);
html += '</span></div><div class="jobs"';
html += '</span><br/>';
// Row #2 of the header (change id and enqueue time)
html += '<span class="changeid"> ';
var id = change['id'];
var url = change['url'];
if (id !== null) {
if (id.length == 40) {
id = id.substr(0,7);
}
if (url !== null) {
html += '<a href="'+url+'">';
}
html += id;
if (url !== null) {
html += '</a>';
}
} else {
// if there is not changeset we still need forced content, otherwise
// the layout doesn't work
html += '&nbsp;';
}
html += '</span>';
html += '<span class="time">' + format_enqueue_time(change['enqueue_time']) + '</span>';
html += '</div>';
// Job listing from here down
html += '<div class="jobs"';
if (display == false) {
html += ' style="display: none;"'
}