| 1 |
|
| 2 |
function checkAll () { |
| 3 |
$('.checkall').click(function () { |
| 4 |
const name = $(this).data('check'); |
| 5 |
const input = $('input[type=checkbox][name=' + name + ']'); |
| 6 |
input.prop('checked', $(this).prop('checked')); |
| 7 |
}); |
| 8 |
} |
| 9 |
|
| 10 |
function humanTime () { |
| 11 |
$('.from-now').each(function () { |
| 12 |
const date = $(this); |
| 13 |
date.text(moment(date.text() * 1000).fromNow()); |
| 14 |
}); |
| 15 |
$('.duration').each(function () { |
| 16 |
const date = $(this); |
| 17 |
console.log(date.text() * 1000); |
| 18 |
date.text(moment.duration(date.text() * 1000).humanize()); |
| 19 |
}); |
| 20 |
} |
| 21 |
|
| 22 |
function pageStats (data) {} |
| 23 |
|
| 24 |
function pollStats (url) { |
| 25 |
$.get(url).done(function (data) { |
| 26 |
$('.minion-stats-active-jobs').html(data.active_jobs); |
| 27 |
$('.minion-stats-active-locks').html(data.active_locks); |
| 28 |
$('.minion-stats-failed-jobs').html(data.failed_jobs); |
| 29 |
$('.minion-stats-finished-jobs').html(data.finished_jobs); |
| 30 |
$('.minion-stats-inactive-jobs').html(data.inactive_jobs); |
| 31 |
$('.minion-stats-workers').html(data.active_workers + data.inactive_workers); |
| 32 |
pageStats(data); |
| 33 |
setTimeout(() => { pollStats(url); }, 3000); |
| 34 |
}).fail(() => { setTimeout(() => { pollStats(url); }, 3000); }); |
| 35 |
} |