Private
Public Access
1
0

added brochure but doesn't show up

This commit is contained in:
Sander Roosendaal
2017-05-05 08:35:38 +02:00
parent 177c3cad74
commit 4727c1fafb
1333 changed files with 65521 additions and 215 deletions

84
rq/rqdashboard.js Normal file
View File

@@ -0,0 +1,84 @@
(function($) {
var POLL_INTERVAL = 2500;
var error = function(xhr, textStatus, errorThrown) {
var html = $('script[name=error-row]').html()
var tbody = $('#queues tbody');
tbody.empty();
tbody.append(html)
var tbody = $('#workers tbody');
tbody.empty();
tbody.append(html)
var tbody = $('#scheduled tbody');
tbody.empty();
tbody.append(html)
}
var success = function(data, textStatus, xhr) {
if (textStatus != 'success') {
return;
}
var tbody = $('#queues tbody');
tbody.empty();
if (data.queues.length > 0) {
var template = _.template($('script[name=queue-row]').html());
$.each(data.queues, function(i, queue) {
queue.klass = i % 2 == 0 ? 'row2' : 'row1';
var html = template(queue);
tbody.append($(html));
});
} else {
tbody.append($('script[name=no-queue-row]').html())
}
var tbody = $('#workers tbody');
tbody.empty();
if (data.workers.length > 0) {
var template = _.template($('script[name=worker-row]').html())
$.each(data.workers, function(i, worker) {
worker.klass = i % 2 == 0 ? 'row2' : 'row1';
worker.queues = worker.queues.join(', ');
var html = template(worker);
tbody.append($(html));
});
} else {
tbody.append($('script[name=no-worker-row]').html())
}
var tbody = $('#scheduled tbody');
tbody.empty();
if (data.scheduled_queues.length > 0) {
var template = _.template($('script[name=scheduled-row]').html())
$.each(data.scheduled_queues, function(i, queue) {
queue.klass = i % 2 == 0 ? 'row2' : 'row1';
var html = template(queue);
tbody.append($(html));
});
} else {
tbody.append($('script[name=no-scheduled-row]').html())
}
};
var refresh = function() {
$.ajax({
url: window.location.href,
dataType: 'json',
success: success,
error: error,
});
};
$(document).ready(function() {
setInterval(refresh, POLL_INTERVAL);
});
})($)