From 70519095198cdf55aa5158429ad8570a838b352a Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 25 Jul 2013 00:48:18 -0700 Subject: [PATCH] Add progress and estimated completion times to zuul status Change-Id: Ib19faae0a427b9c3a9b2e4009b2f8db630b092b6 --- .../openstack_project/files/zuul/status.html | 3 ++ .../openstack_project/files/zuul/status.js | 50 ++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/modules/openstack_project/files/zuul/status.html b/modules/openstack_project/files/zuul/status.html index 20f6932e6c..1c2ffe685b 100644 --- a/modules/openstack_project/files/zuul/status.html +++ b/modules/openstack_project/files/zuul/status.html @@ -19,6 +19,9 @@ padding: 4px; } .change > .header > .changeid { + margin: 1em; +} +.change > .header > .time { float: right; } .job { diff --git a/modules/openstack_project/files/zuul/status.js b/modules/openstack_project/files/zuul/status.js index 3c9e94c239..3d69ee9c1b 100644 --- a/modules/openstack_project/files/zuul/status.js +++ b/modules/openstack_project/files/zuul/status.js @@ -14,6 +14,45 @@ window.zuul_enable_status_updates = true; +function format_time(ms, words) { + if (ms == null) { + return "unknown"; + } + var seconds = (+ms)/1000; + var minutes = Math.floor((seconds/60)%60); + var hours = Math.floor(minutes/60); + seconds = Math.floor(seconds % 60); + r = ''; + if (words) { + if (hours) { + r += hours; + r += ' hr '; + } + r += minutes + ' min' + } else { + if (hours < 10) r += '0'; + r += hours + ':'; + if (minutes < 10) r += '0'; + r += minutes + ':'; + if (seconds < 10) r += '0'; + r += seconds; + } + return r; +} + +function format_progress(elapsed, remaining) { + if (remaining != null) { + total = elapsed + remaining; + } else { + total = null; + } + r = 'in progress'; + return r; +} + function format_pipeline(data) { var html = '

'+ data['name']+'

'; @@ -63,6 +102,9 @@ function format_change(change) { if (url != null) { html += ''; } + + html += ''; + html += format_time(change['remaining_time'], true); html += '
'; $.each(change['jobs'], function(i, job) { @@ -91,7 +133,13 @@ function format_change(change) { if (job['url'] != null) { html += ''; } - html += ': '+result+''; + html += ': '; + if (job['result'] == null && job['url'] != null) { + html += format_progress(job['elapsed_time'], job['remaining_time']); + } else { + html += ''+result+''; + } + if (job['voting'] == false) { html += ' (non-voting)'; }