add agent, add ability to delete user/pool, change order of power buttons

This commit is contained in:
Jordan Rodgers 2017-12-18 20:19:57 -05:00
parent 125fd58b27
commit 8161d97f21
7 changed files with 85 additions and 10 deletions

View file

@ -654,7 +654,7 @@ $(".edit-limit").click(function(){
}
});
}).then(() => {
window.location = `/limits`;
window.location = "/";
});
}
}).catch(err => {
@ -692,7 +692,7 @@ $(".reset-limit").click(function(){
icon: "success",
});
}).then(() => {
window.location = `/limits`;
window.location = "/";
}).catch(err => {
if (err) {
swal("Uh oh...", `Unable to reset the usage limits for ${user}. Please try again later.`, "error");
@ -704,3 +704,41 @@ $(".reset-limit").click(function(){
}
});
});
$(".delete-user").click(function(){
const user = $(this).data('user')
swal({
title: `Are you sure you want to delete the pool for ${user}?`,
icon: "warning",
buttons: {
cancel: true,
delete: {
text: "delete",
closeModal: false,
className: "swal-button--danger",
}
},
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
fetch(`/user/${user}/delete`, {
credentials: 'same-origin',
method: 'post'
}).then((response) => {
return swal(`The pool for ${user} has been deleted!`, {
icon: "success",
});
}).then(() => {
window.location = "/";
}).catch(err => {
if (err) {
swal("Uh oh...", `Unable to delete the pool for ${user}. Please try again later.`, "error");
} else {
swal.stopLoading();
swal.close();
}
});
}
});
});