Improve zuul status page efficiency.
Don't poll server when page isn't visible. Install and use the jquery-visibility plugin. Change-Id: I377f2ebe2385668a93d46d31ddf2ec5744f8d26b Reviewed-on: https://review.openstack.org/18606 Approved: Jeremy Stanley <fungi@yuggoth.org> Reviewed-by: Jeremy Stanley <fungi@yuggoth.org> Tested-by: Jenkins
This commit is contained in:
parent
8eb46312cb
commit
0b2cba4e99
@ -43,6 +43,7 @@
|
||||
<TITLE>Zuul Status</TITLE>
|
||||
|
||||
<script type="text/javascript" src="jquery.min.js"></script>
|
||||
<script type="text/javascript" src="jquery-visibility.min.js"></script>
|
||||
<script type="text/javascript" src="status.js"></script>
|
||||
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
// License for the specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
window.zuul_enable_status_updates = true;
|
||||
|
||||
function format_pipeline(data) {
|
||||
var html = '<div class="pipeline"><h3 class="subhead">'+
|
||||
data['name']+'</h3>';
|
||||
@ -90,6 +92,11 @@ function format_change(change) {
|
||||
function update() {
|
||||
var html = '';
|
||||
|
||||
if (!window.zuul_enable_status_updates) {
|
||||
setTimeout(update, 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
$.getJSON('http://zuul.openstack.org/status.json', function(data) {
|
||||
if ('message' in data) {
|
||||
$("#message-container").attr('class', 'topMessage');
|
||||
@ -113,4 +120,14 @@ function update() {
|
||||
|
||||
$(function() {
|
||||
update();
|
||||
|
||||
$(document).on({
|
||||
'show.visibility': function() {
|
||||
window.zuul_enable_status_updates = true;
|
||||
},
|
||||
'hide.visibility': function() {
|
||||
window.zuul_enable_status_updates = false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -80,7 +80,8 @@ class openstack_project::zuul(
|
||||
file { '/var/lib/zuul/www/jquery.min.js':
|
||||
ensure => link,
|
||||
target => '/usr/share/javascript/jquery/jquery.min.js',
|
||||
require => Package['libjs-jquery'],
|
||||
require => [File['/var/lib/zuul/www'],
|
||||
Package['libjs-jquery']],
|
||||
}
|
||||
|
||||
file { '/var/lib/zuul/www/status.js':
|
||||
@ -88,4 +89,17 @@ class openstack_project::zuul(
|
||||
source => 'puppet:///modules/openstack_project/zuul/status.js',
|
||||
require => File['/var/lib/zuul/www'],
|
||||
}
|
||||
|
||||
vcsrepo { '/opt/jquery-visibility':
|
||||
ensure => latest,
|
||||
provider => git,
|
||||
revision => 'master',
|
||||
source => 'https://github.com/mathiasbynens/jquery-visibility.git',
|
||||
}
|
||||
|
||||
file { '/var/lib/zuul/www/jquery-visibility.min.js':
|
||||
ensure => link,
|
||||
target => '/opt/jquery-visibility/jquery-visibility.min.js',
|
||||
require => File['/var/lib/zuul/www'],
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user