Show nicer alerts for file deletion
This commit is contained in:
parent
54bef1e7d5
commit
abed57546b
|
@ -84,22 +84,36 @@
|
||||||
var clicked = $(this);
|
var clicked = $(this);
|
||||||
var deleteItemPath = $(this).attr('href');
|
var deleteItemPath = $(this).attr('href');
|
||||||
|
|
||||||
if (!confirm('Are you sure you want to delete /home/container/' + deleteItemPath + '? There is no reversing this action.')) {
|
swal({
|
||||||
return;
|
type: 'warning',
|
||||||
}
|
title: 'Really Delete this File?',
|
||||||
|
showCancelButton: true,
|
||||||
$.ajax({
|
showConfirmButton: true,
|
||||||
type: 'DELETE',
|
closeOnConfirm: false,
|
||||||
url: '{{ $node->scheme }}://{{ $node->fqdn }}:{{ $node->daemonListen }}/server/file/' + deleteItemPath,
|
showLoaderOnConfirm: true
|
||||||
headers: {
|
}, function () {
|
||||||
'X-Access-Token': '{{ $server->daemonSecret }}',
|
$.ajax({
|
||||||
'X-Access-Server': '{{ $server->uuid }}'
|
type: 'DELETE',
|
||||||
}
|
url: '{{ $node->scheme }}://{{ $node->fqdn }}:{{ $node->daemonListen }}/server/file/' + deleteItemPath,
|
||||||
}).done(function (data) {
|
headers: {
|
||||||
clicked.parent().parent().parent().parent().fadeOut();
|
'X-Access-Token': '{{ $server->daemonSecret }}',
|
||||||
}).fail(function (jqXHR) {
|
'X-Access-Server': '{{ $server->uuid }}'
|
||||||
$("#internal_alert").html('<div class="alert alert-danger">An error occured while attempting to delete <code>/home/container/' + deleteItemPath + '</code>. Please try again.</div>').show();
|
}
|
||||||
console.log(jqXHR);
|
}).done(function (data) {
|
||||||
|
clicked.parent().parent().parent().parent().fadeOut();
|
||||||
|
swal({
|
||||||
|
type: 'success',
|
||||||
|
title: 'File Deleted'
|
||||||
|
});
|
||||||
|
}).fail(function (jqXHR) {
|
||||||
|
console.error(jqXHR);
|
||||||
|
swal({
|
||||||
|
type: 'error',
|
||||||
|
title: 'Whoops!',
|
||||||
|
html: true,
|
||||||
|
text: 'An error occured while attempting to delete this file. Please try again.',
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue