mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
WebUI: make error messages user dismissible
Fixes #1171 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -26,8 +26,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
{{end}}
|
||||
|
||||
{{define "page_body"}}
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="card shadow mb-4">
|
||||
@@ -100,11 +103,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<script type="text/javascript">
|
||||
|
||||
function deleteAction() {
|
||||
var table = $('#dataTable').DataTable();
|
||||
let table = $('#dataTable').DataTable();
|
||||
table.button('delete:name').enable(false);
|
||||
var groupName = table.row({ selected: true }).data()[0];
|
||||
var path = '{{.GroupURL}}' + "/" + fixedEncodeURIComponent(groupName);
|
||||
let groupName = table.row({ selected: true }).data()[0];
|
||||
let path = '{{.GroupURL}}' + "/" + fixedEncodeURIComponent(groupName);
|
||||
$('#deleteModal').modal('hide');
|
||||
$('#errorMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE',
|
||||
@@ -128,9 +133,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user