diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html
index ff64e960..bcd260f5 100644
--- a/kfet/templates/kfet/kpsul.html
+++ b/kfet/templates/kfet/kpsul.html
@@ -116,6 +116,9 @@ $(document).ready(function() {
// General
// -----
+ // Lock to avoid multiple requests
+ lock = 0;
+
// Retrieve settings
settings = {}
@@ -369,6 +372,9 @@ $(document).ready(function() {
var operations = $('#operation_formset');
function performOperations(password = '') {
+ if (lock == 1)
+ return false;
+ lock = 1;
var data = operationGroup.serialize() + '&' + operations.serialize();
$.ajax({
dataType: "json",
@@ -383,6 +389,7 @@ $(document).ready(function() {
})
.done(function(data) {
coolReset();
+ lock = 0;
})
.fail(function($xhr) {
var data = $xhr.responseJSON;
@@ -398,6 +405,7 @@ $(document).ready(function() {
}
break;
}
+ lock = 0;
});
}
@@ -414,6 +422,9 @@ $(document).ready(function() {
var cancelForm = $('#cancel_form');
function cancelOperations(opes_array, password = '') {
+ if (lock == 1)
+ return false
+ lock = 1;
var data = { 'operations' : opes_array }
$.ajax({
dataType: "json",
@@ -429,6 +440,7 @@ $(document).ready(function() {
})
.done(function(data) {
coolReset();
+ lock = 0;
})
.fail(function($xhr) {
var data = $xhr.responseJSON;
@@ -442,7 +454,7 @@ $(document).ready(function() {
displayErrors(getErrorsHtml(data));
break;
}
-
+ lock = 0;
});
}