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(){
|
||||
const vncCleanupToken = $(this).data('vnc_cleanup_token');
|
||||
// let data = {'token': vncCleanupToken};
|
||||
|
||||
console.log(vncCleanupToken);
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append('token', vncCleanupToken);
|
||||
fetch(`/console/cleanup`, {
|
||||
method: 'post',
|
||||
credentials: 'same-origin',
|
||||
body: formData
|
||||
}).then(res => {
|
||||
console.log("Request complete! response:", res);
|
||||
swal({
|
||||
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.",
|
||||
icon: "warning",
|
||||
buttons: {
|
||||
cancel: true,
|
||||
action: {
|
||||
text: "Cleanup VNC Sessions",
|
||||
closeModal: false,
|
||||
className: "swal-button--danger",
|
||||
}
|
||||
},
|
||||
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