From 23d09a3c46eabe56d2ef5d493ddb77096af07d06 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 13 Jun 2019 20:09:55 +0200 Subject: [PATCH] wip massive event operations --- .../include/javascript/pandora_events.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index b93a36b43b..f13f3d8ca4 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -1,4 +1,4 @@ -/*global jQuery,$,forced_title_callback,Base64, dt_event*/ +/*global jQuery,$,forced_title_callback,Base64, dt_events*/ // Show the modal window of an event function show_event_dialog(event_id, group_rep, dialog_page, result) { @@ -669,6 +669,7 @@ function show_event_response_command_dialog(id, response, total_checked) { }); } +var processing = 0; function update_event(table, id_evento, type, row) { var inputs = $("#events_form :input"); var values = {}; @@ -678,6 +679,7 @@ function update_event(table, id_evento, type, row) { }); var t1 = new Date(); + processing += 1; // Update events matching current filters and id_evento selected. $.ajax({ type: "POST", @@ -691,17 +693,19 @@ function update_event(table, id_evento, type, row) { filter: values }, success: function(data) { - console.log("[" + data + "]"); var t2 = new Date(); var diff_g = t2.getTime() - t1.getTime(); var diff_s = diff_g / 1000; // If operation takes less than 2 seconds, redraw. + processing -= 1; if (diff_s < 2) { redraw = true; } if (redraw) { - table.draw(false); + if (processing == 0) { + table.draw(false); + } } else { $(row) .closest("tr") @@ -802,23 +806,26 @@ function execute_event_response(event_list_btn) { case "in_progress_selected": $(".chk_val").each(function() { if ($(this).is(":checked")) { - in_progress_event(dt_event, $(this).val(), this); + in_process_event(dt_events, $(this).val(), this.parentElement); } }); + dt_events.draw(false); break; case "validate_selected": $(".chk_val").each(function() { if ($(this).is(":checked")) { - validate_event(dt_event, $(this).val(), this); + validate_event(dt_events, $(this).val(), this.parentElement); } }); + dt_events.draw(false); break; case "delete_selected": $(".chk_val").each(function() { if ($(this).is(":checked")) { - delete_event(dt_event, $(this).val(), this); + delete_event(dt_events, $(this).val(), this.parentElement); } }); + dt_events.draw(false); break; } }