mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
SweetAlert on "Cleanup VNC Sessions"
This commit is contained in:
parent
509ea616fc
commit
cd6bdba409
1 changed files with 38 additions and 12 deletions
|
@ -636,18 +636,44 @@ $("#process-expiring-vms-task-button").click(function(){
|
||||||
|
|
||||||
$("#cleanup-vnc-task-button").click(function(){
|
$("#cleanup-vnc-task-button").click(function(){
|
||||||
const vncCleanupToken = $(this).data('vnc_cleanup_token');
|
const vncCleanupToken = $(this).data('vnc_cleanup_token');
|
||||||
// let data = {'token': vncCleanupToken};
|
|
||||||
|
swal({
|
||||||
console.log(vncCleanupToken);
|
title: "Are you sure you want to clear VNC tokens?",
|
||||||
|
text: "This will clear the websockify targets file, and remove all entries from Redis. Ongoing VNC sessions may be disrupted.",
|
||||||
var formData = new FormData();
|
icon: "warning",
|
||||||
formData.append('token', vncCleanupToken);
|
buttons: {
|
||||||
fetch(`/console/cleanup`, {
|
cancel: true,
|
||||||
method: 'post',
|
action: {
|
||||||
credentials: 'same-origin',
|
text: "Cleanup VNC Sessions",
|
||||||
body: formData
|
closeModal: false,
|
||||||
}).then(res => {
|
className: "swal-button--danger",
|
||||||
console.log("Request complete! response:", res);
|
}
|
||||||
|
},
|
||||||
|
dangerMode: true,
|
||||||
|
})
|
||||||
|
.then((willComplete) => {
|
||||||
|
if (willComplete) {
|
||||||
|
var formData = new FormData();
|
||||||
|
formData.append('token', vncCleanupToken);
|
||||||
|
fetch(`/console/cleanup`, {
|
||||||
|
method: 'post',
|
||||||
|
credentials: 'same-origin',
|
||||||
|
body: formData
|
||||||
|
}).then((response) => {
|
||||||
|
return swal("VNC Sessions have been cleared", {
|
||||||
|
icon: "success",
|
||||||
|
});
|
||||||
|
}).then(() => {
|
||||||
|
window.location = location;
|
||||||
|
}).catch(err => {
|
||||||
|
if (err) {
|
||||||
|
swal("Uh oh...", "Unable to clear VNC sessions", "error");
|
||||||
|
} else {
|
||||||
|
swal.stopLoading();
|
||||||
|
swal.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue