2021-05-26 16:26:01 +02:00
|
|
|
import 'bootstrap';
|
|
|
|
|
2021-05-24 14:08:30 +02:00
|
|
|
$(function() {
|
|
|
|
initDeleteButtons();
|
2021-06-01 20:21:47 +02:00
|
|
|
initRunNowButtons();
|
2021-05-24 14:08:30 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
function initDeleteButtons() {
|
|
|
|
$('.delete-btn').on('click', function() {
|
|
|
|
let me = $(this)
|
|
|
|
let href = me.data('href');
|
|
|
|
let confirmation = me.data('confirmation');
|
|
|
|
|
|
|
|
if(confirm(confirmation)) {
|
|
|
|
$.ajax({
|
|
|
|
url: href,
|
|
|
|
method: 'DELETE',
|
|
|
|
success: function(data) {
|
|
|
|
window.location.href = data.return_path;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
2021-06-01 20:21:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function initRunNowButtons() {
|
|
|
|
$('.runnow').on('click', function() {
|
|
|
|
let me = $(this)
|
|
|
|
let href = me.data('href');
|
|
|
|
$.ajax({
|
|
|
|
url: href,
|
|
|
|
method: 'GET',
|
|
|
|
success: function(data) {
|
|
|
|
let modal = $('#runnow_result');
|
|
|
|
modal.find('.modal-title').html(data.title);
|
|
|
|
if (data.status == 'deferred') {
|
|
|
|
modal.find('.modal-body').html(data.message);
|
|
|
|
} else if (data.status == 'ran') {
|
2021-07-02 21:03:21 +02:00
|
|
|
let content = '<p>Cronjob ran in ' + data.runtime.toFixed(3) + ' seconds with exit code ' + data.exitcode +'</p>'
|
2021-06-01 20:21:47 +02:00
|
|
|
content += '<pre>' + data.output + '</pre>'
|
|
|
|
|
|
|
|
modal.find('.modal-body').html(content);
|
|
|
|
}
|
|
|
|
|
|
|
|
modal.modal({show: true})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
2021-05-24 14:08:30 +02:00
|
|
|
}
|