Zuul is a pipeline oriented project gating and automation
- system. Each of the sections below is a separate pipeline
- configured to automate some portion of the testing or
- operation of the OpenStack project. For more information, please see
- the Zuul reference manual.
-
';
- $.each(head, function(change_i, change) {
- html += format_change(change, change_queue);
- });
- html += '
';
- });
- });
-
- html += '
';
- return html;
-}
-
-function safe_id(id) {
- if (id === null) {
- return "null";
- }
- return id.replace(',', '_');
-}
-
-function format_change(change, change_queue) {
- var html = '
';
-
- safe_change_id = safe_id(change['id']);
- display = $('#expandByDefault').is(':checked');
- collapsed_index = window.zuul_collapsed_exceptions.indexOf(safe_change_id);
- if (collapsed_index > -1) {
- /* listed as an exception to the current default */
- display = !display;
- }
-
- for (var i=0; i';
- if (i == change['_tree_index']) {
- if (change['active'] != true) {
- html += '';
- } else if (change.live != true) {
- html += '';
- } else if (change['failing_reasons'] && change['failing_reasons'].length > 0) {
- var reason = change['failing_reasons'].join(', ');
- var image = 'red.png';
- if (reason.match(/merge conflict/)) {
- image = 'black.png';
- }
- html += '';
- } else {
- html += '';
- }
- }
- if (change['_tree_branches'].indexOf(i) != -1) {
- if (change['_tree_branches'].indexOf(i) == change['_tree_branches'].length-1)
- html += '';
- else
- html += '';
- }
- html += '';
- }
-
- html += '
';
- html += '
' +
- '
';
-
- // Row #1 of the header (project and remaining time)
- html += '' + change['project'] + '';
- if (change.live === true) {
- html += '';
- html += format_time(change['remaining_time'], true);
- html += '';
- }
- html += ' ';
-
- // Row #2 of the header (change id and enqueue time)
- html += ' ';
- var id = change['id'];
- var url = change['url'];
- if (id !== null) {
- if (id.length == 40) {
- id = id.substr(0,7);
- }
- if (url !== null) {
- html += '';
- }
- html += id;
- if (url !== null) {
- html += '';
- }
- } else {
- // if there is not changeset we still need forced content, otherwise
- // the layout doesn't work
- html += ' ';
- }
- html += '';
- if (change.live === true) {
- html += '';
- html += format_enqueue_time(change['enqueue_time']) + '';
- }
- html += '
';
-
- // Job listing from here down
- html += '
';
-
- $.each(change['jobs'], function(i, job) {
- result = job['result'];
- var result_class = "result";
- if (result === null) {
- if (job['url'] !== null) {
- result = 'in progress';
- } else {
- result = 'queued';
- }
- } else if (result == 'SUCCESS') {
- result_class += " result_success";
- } else if (result == 'FAILURE') {
- result_class += " result_failure";
- } else if (result == 'LOST') {
- result_class += " result_unstable";
- } else if (result == 'UNSTABLE') {
- result_class += " result_unstable";
- }
- html += '';
- if (job['result'] !== null && job['report_url'] !== null) {
- html += '';
- html += job['name'];
- html += '';
- } else if (job['url'] !== null) {
- html += '';
- html += job['name'];
- html += '';
- } else {
- html += job['name'];
- }
- 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)';
- }
- html += '';
- });
-
- html += '
';
- return html;
-}
-
-function toggle_display_jobs(e, _header) {
- e = e || window.event; // standards compliant || IE
- var header = $(_header);
- var target = $(e.target || e.srcElement);
- var link = header.find("a");
- if (target.is(link)) {
- return true;
- }
-
- content = header.next("div");
- content.slideToggle(100, function () {
- changeid = header.parent().attr('id');
- collapsed_index = window.zuul_collapsed_exceptions.indexOf(changeid);
- expand_by_default = $('#expandByDefault').is(':checked');
- visible = content.is(":visible");
- if (expand_by_default != visible && collapsed_index == -1) {
- /* now an exception to the default */
- window.zuul_collapsed_exceptions.push(changeid);
- } else if (collapsed_index > -1) {
- window.zuul_collapsed_exceptions.splice(collapsed_index, 1);
- }
- });
-}
-
-function toggle_expand_by_default(_checkbox) {
- var checkbox = $(_checkbox);
- expand_by_default = checkbox.is(':checked');
- set_cookie('zuul-expand-by-default', expand_by_default ? 'true' : 'false');
- window.zuul_collapsed_exceptions = [];
- $.each($('div.change'), function(i, _change) {
- change = $(_change);
- content = change.children('div').next('div');
- if (expand_by_default) {
- content.show(0);
- } else {
- content.hide(0);
- }
- });
-}
-
-function update_timeout() {
- if (!window.zuul_enable_status_updates) {
- setTimeout(update_timeout, 5000);
- return;
- }
-
- window.zuul_graph_update_count += 1;
-
- update();
- /* Only update graphs every minute */
- if (window.zuul_graph_update_count > 11) {
- window.zuul_graph_update_count = 0;
- update_graphs();
- }
-
- setTimeout(update_timeout, 5000);
-}
-
-function clean_changes_lists() {
- new_collapsed_exceptions = [];
-
- $.each($('div.change'), function(i, change) {
- collapsed_index = window.zuul_collapsed_exceptions.indexOf(change.id);
- if (collapsed_index > -1) {
- new_collapsed_exceptions.push(change.id);
- return;
- }
- });
-
- window.zuul_collapsed_exceptions = new_collapsed_exceptions;
-}
-
-function update_zuul_info(data) {
- if ('zuul_version' in data) {
- $('#zuul-version').text(data['zuul_version']);
- }
- if ('last_reconfigured' in data) {
- var last_reconfigured = new Date(data['last_reconfigured']);
- $('#last-reconfigured-span').text(last_reconfigured.toString());
- }
-}
-
-function update() {
- var html = '';
-
- $.getJSON('http://zuul.openstack.org/status.json', function(data) {
- update_zuul_info(data);
-
- if ('message' in data) {
- $("#message").attr('class', 'alertbox');
- $("#message").html(data['message']);
- } else {
- $("#message").removeClass('alertbox');
- $("#message").html('');
- }
-
- html += ' ';
-
- $.each(data['pipelines'], function(i, pipeline) {
- html = html + format_pipeline(pipeline);
- });
-
- html += ' ';
- $("#pipeline-container").html(html);
-
- $("#trigger_event_queue_length").html(
- data['trigger_event_queue']['length']);
- $("#result_event_queue_length").html(
- data['result_event_queue']['length']);
- });
-
- clean_changes_lists();
-}
-
-function update_graphs() {
- $('.graph').each(function(i, img) {
- var newimg = new Image();
- var parts = img.src.split('#');
- newimg.src = parts[0] + '#' + new Date().getTime();
- $(newimg).load(function (x) {
- img.src = newimg.src;
- });
- });
-
- $.each(window.zuul_sparkline_urls, function(name, url) {
- var newimg = new Image();
- var parts = url.split('#');
- newimg.src = parts[0] + '#' + new Date().getTime();
- $(newimg).load(function (x) {
- window.zuul_sparkline_urls[name] = newimg.src;
- });
- });
-}
-
-function save_filter() {
- var name = 'zuul-filter';
- var value = $('#filter').val().trim();
- set_cookie(name, value);
- $('img.filter-saved').removeClass('hidden');
- window.setTimeout(function(){
- $('img.filter-saved').addClass('hidden');
- }, 1500);
-}
-
-function set_cookie(name, value) {
- document.cookie = name + "=" + value + "; path=/";
-}
-
-function read_cookie(name) {
- var nameEQ = name + "=";
- var ca = document.cookie.split(';');
- for(var i=0;i < ca.length;i++) {
- var c = ca[i];
- while (c.charAt(0)==' ') c = c.substring(1,c.length);
- if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
- }
- return null;
-}
-
-$(function() {
- window.zuul_graph_update_count = 0;
- window.zuul_sparkline_urls = {};
- update_timeout();
-
- $(document).on({
- 'show.visibility': function() {
- window.zuul_enable_status_updates = true;
- update();
- update_graphs();
- },
- 'hide.visibility': function() {
- window.zuul_enable_status_updates = false;
- }
- });
-
- $('#filter').live('keyup change', function () {
- window.zuul_filter = $('#filter').val().trim().split(/[\s,]+/);
- window.zuul_filter = window.zuul_filter.filter(function(n){
- return n;
- });
- $.each($('div[project]'), function (idx, val) {
- val = $(val);
- var project = val.attr('project');
- var change_id = val.attr('change_id');
- if (is_hidden(project, change_id)) {
- val.hide(100);
- } else {
- val.show(100);
- }
- });
- }).live('keyup', function () {
- $('a.save-filter')
- .removeClass('hidden')
- .live('click', function(e){
- e.preventDefault();
- $(this).addClass('hidden');
- save_filter();
- });
- });
- var cookie = read_cookie('zuul-filter');
- if(cookie)
- $('#filter').val(cookie).change();
- cookie = read_cookie('zuul-expand-by-default');
- if(cookie)
- $('#expandByDefault').prop('checked', cookie == 'true' ? true : false);
-});