diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php
index 18f8c12528..b60e58d940 100644
--- a/pandora_console/include/ajax/events.php
+++ b/pandora_console/include/ajax/events.php
@@ -55,6 +55,7 @@ if (! check_acl($config['id_user'], 0, 'ER')
return;
}
+$process_buffers = (bool) get_parameter('process_buffers', false);
$get_extended_event = (bool) get_parameter('get_extended_event');
$change_status = (bool) get_parameter('change_status');
$change_owner = (bool) get_parameter('change_owner');
@@ -2138,6 +2139,92 @@ if ($get_table_response_command) {
return;
}
+if ($process_buffers === true) {
+ $buffers = get_parameter('buffers', '');
+
+ $buffers = json_decode(io_safe_output($buffers), true);
+
+ $alert = false;
+ $content = '
';
+ foreach ($buffers['data'] as $node => $data) {
+ $content .= '- ';
+ $content .= '';
+ $content .= __('Events').': ';
+ $content .= $node;
+ $content .= '';
+
+ $class_total = 'info';
+ $str_total = '';
+ if ($buffers['settings']['total'] == $data) {
+ $alert = true;
+ $class_total .= ' danger';
+ $str_total = html_print_image(
+ 'images/error_red.png',
+ true,
+ [
+ 'title' => __('Total number of events in this node reached'),
+ 'class' => 'forced-title',
+ ]
+ );
+ }
+
+ if (isset($buffers['error'][$node]) === true) {
+ $alert = true;
+ $class_total .= ' danger';
+ $str_total = html_print_image(
+ 'images/error_red.png',
+ true,
+ [
+ 'title' => $buffers['error'][$node],
+ 'class' => 'forced-title',
+ ]
+ );
+ }
+
+ $content .= '';
+ $content .= $data;
+ if (empty($str_total) === false) {
+ $content .= '';
+ $content .= ' '.$str_total;
+ $content .= '';
+ }
+
+ $content .= '';
+
+ $content .= '
';
+ }
+
+ $content .= '
';
+
+ $title = __('Total Events per node').': (';
+ $title .= $buffers['settings']['total'].')';
+ if ($alert === true) {
+ $title .= html_print_image(
+ 'images/error_red.png',
+ true,
+ [
+ 'title' => __('Error'),
+ 'class' => 'forced-title',
+ 'style' => 'margin-top: -2px;',
+ ]
+ );
+ }
+
+ $output = ui_toggle(
+ $content,
+ $title,
+ '',
+ '',
+ true,
+ true,
+ 'white_box white_box_opened',
+ 'no-border flex-row'
+ );
+
+ echo $output;
+ return;
+}
+
if ($get_events_fired) {
global $config;
$id = get_parameter('id_row');
diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index 0d38b0cae4..b838500009 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -1582,13 +1582,7 @@ function events_get_all(
$data = [];
$buffers = [
'settings' => [
- 'total' => $config['max_number_of_events_per_node'],
- 'translate' => [
- 'tev' => __('Total Events'),
- 'nev' => __('Total Events per node'),
- 'ev' => __('Events'),
- 'tevn' => __('Total number of events in this node reached'),
- ],
+ 'total' => $config['max_number_of_events_per_node'],
],
'data' => [],
'error' => [],
diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js
index c132fa0873..ab276cda9e 100644
--- a/pandora_console/include/javascript/pandora_events.js
+++ b/pandora_console/include/javascript/pandora_events.js
@@ -1011,43 +1011,20 @@ function event_widget_options() {
function process_buffers(buffers) {
$("#events_buffers_display").empty();
if (buffers != null && buffers.settings != undefined && buffers.data) {
- var html = "" + buffers.settings.translate.nev;
- html += ": (" + buffers.settings.total + ")
";
- html += "";
- Object.entries(buffers.data).forEach(function(element) {
- html += "- ";
- html += "";
- html += buffers.settings.translate.ev + " ";
- html += element[0];
- html += ": ";
- html += "";
+ var params = [];
+ params.push("page=include/ajax/events");
+ params.push("process_buffers=1");
+ params.push("buffers=" + JSON.stringify(buffers));
- var class_total = "info";
- var str_total = "";
- if (buffers.settings.total == element[1]) {
- class_total += " danger";
- str_total = buffers.settings.translate.tevn;
+ jQuery.ajax({
+ data: params.join("&"),
+ type: "POST",
+ url: $("#hidden-ajax_file").val(),
+ async: true,
+ dataType: "html",
+ success: function(data) {
+ $("#events_buffers_display").html(data);
}
-
- if (buffers.error[element[0]] !== undefined) {
- class_total += " danger";
- str_total = buffers.error[element[0]];
- }
-
- html += '';
- html += element[1];
- if (str_total != "") {
- html += '';
- html += " " + str_total;
- html += "";
- }
-
- html += "";
-
- html += "
";
});
- html += "
";
-
- $("#events_buffers_display").html(html);
}
}
diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css
index a5944d0ce4..194bd81c70 100644
--- a/pandora_console/include/styles/events.css
+++ b/pandora_console/include/styles/events.css
@@ -348,10 +348,11 @@ div.multi-response-buttons {
#events_buffers_display {
margin-bottom: 10px;
width: fit-content;
+ min-width: 300px;
}
#events_buffers_display ul {
- min-width: 400px;
+ min-width: 300px;
}
#events_buffers_display li {
@@ -359,6 +360,8 @@ div.multi-response-buttons {
flex-direction: row;
justify-content: flex-start;
align-items: center;
+ position: relative;
+ height: 20px;
}
#events_buffers_display ul li span.info {
@@ -368,8 +371,20 @@ div.multi-response-buttons {
#events_buffers_display ul li span.danger {
color: red;
+ display: flex;
+ flex-direction: row;
+ justify-content: flex-end;
+ align-items: center;
}
+#events_buffers_display ul li span.danger img {
+ position: absolute;
+ top: -3px;
+}
#events_buffers_display ul li span.text {
color: #3f3f3f;
}
+
+.white_table_graph_header {
+ align-items: center;
+}