diff --git a/modules/openstack_project/files/zuul/status.js b/modules/openstack_project/files/zuul/status.js index e789065d68..ad88187e87 100644 --- a/modules/openstack_project/files/zuul/status.js +++ b/modules/openstack_project/files/zuul/status.js @@ -1,4 +1,4 @@ -// Copyright 2012 OpenStack Foundation +// Copyright 2012-2013 OpenStack Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); you may // not use this file except in compliance with the License. You may obtain @@ -78,14 +78,37 @@ function count_changes(pipeline) { return count; } +function get_sparkline_url(pipeline_name) { + if (!(pipeline_name in window.zuul_sparkline_urls)) { + window.zuul_sparkline_urls[pipeline_name] = $.fn.graphite.geturl({ + url: "http://graphite.openstack.org/render/", + from: "-8hours", + width: 100, + height: 16, + margin: 0, + hideLegend: true, + hideAxes: true, + hideGrid: true, + target: [ + "color(stats.gauges.zuul.pipeline."+pipeline_name+".current_changes, '6b8182')", + ], + }); + } + return window.zuul_sparkline_urls[pipeline_name]; +} + function format_pipeline(data) { var count = count_changes(data); var html = '
'+data['description']+'
'; } @@ -246,10 +269,20 @@ function update_graphs() { 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() { window.zuul_graph_update_count = 0; + window.zuul_sparkline_urls = {}; update_timeout(); $(document).on({