Update schedule process to allow toggling/triggering via UI

This commit is contained in:
Dane Everitt 2018-01-08 21:43:10 -06:00
parent 02fe49892d
commit 036bea2b94
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
18 changed files with 280 additions and 221 deletions

View file

@ -19,6 +19,7 @@
// SOFTWARE.
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$('[data-action="delete-schedule"]').click(function () {
var self = $(this);
swal({
@ -59,6 +60,45 @@ $(document).ready(function () {
});
});
$('[data-action="trigger-schedule"]').click(function (event) {
event.preventDefault();
var self = $(this);
swal({
type: 'info',
title: 'Trigger Schedule',
text: 'This will run the selected schedule now.',
showCancelButton: true,
allowOutsideClick: true,
closeOnConfirm: false,
confirmButtonText: 'Continue',
showLoaderOnConfirm: true
}, function () {
$.ajax({
method: 'POST',
url: Router.route('server.schedules.trigger', {
server: Pterodactyl.server.uuidShort,
schedule: self.data('schedule-id'),
}),
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content'),
},
}).done(function (data) {
swal({
type: 'success',
title: '',
text: 'Schedule has been added to the next-run queue.'
});
}).fail(function (jqXHR) {
console.error(jqXHR);
swal({
type: 'error',
title: 'Whoops!',
text: 'An error occured while attempting to trigger this schedule.'
});
});
});
});
$('[data-action="toggle-schedule"]').click(function (event) {
var self = $(this);
swal({