diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index e6032de2f6..bb06d3a800 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -1932,33 +1932,8 @@ if (is_metaconsole() === true) {
|
$a) {
- if ($index == 0) {
- $sql_log .= ' AND (id_agente = '.$key;
- } else {
- $sql_log .= ' OR id_agente = '.$key;
- }
-
- $index++;
- }
-
- $sql_log .= ')';
- }
-
- html_print_select_from_sql(
- $sql_log,
+ html_print_select(
+ [],
'source',
$source,
'onselect=source_change_agents();',
@@ -1966,7 +1941,7 @@ if (is_metaconsole() === true) {
'',
false,
false,
- false
+ false,
);
?>
|
@@ -6702,68 +6677,41 @@ function loadGeneralAgents(agent_group) {
function loadLogAgents() {
var params = [];
- params.push("get_log_agents=1");
- params.push("source=");
- params.push('id_agents=');
- params.push("page=include/ajax/reporting.ajax");
+ let source = '';
+ let agent = '';
+ agent = JSON.parse(agent);
- $('#id_agents3')
- .find('option')
- .remove();
+ var params = {};
+ params["get_agent_source"] = 1;
+ params["log_alert"] = 1;
+ params["page"] = "enterprise/include/ajax/log_viewer.ajax";
- $('#id_agents3')
- .append('');
-
- jQuery.ajax ({
- data: params.join ("&"),
- type: 'POST',
- url: action=
-
- + "/ajax.php",
- timeout: 300000,
- dataType: 'json',
- success: function (data) {
- if (data['correct']) {
- $('#id_agents3')
- .find('option')
- .remove();
-
- var selectElements = [];
- var selectedStr = 'selected="selected"';
-
- if (data['select_agents'] === null) {
- return;
- }
-
- if (Array.isArray(data['select_agents'])) {
- data['select_agents'].forEach(function(agentAlias, agentID) {
- var optionAttr = '';
- if (typeof data['agents_selected'][agentID] !== 'undefined') {
- optionAttr = ' selected="selected"';
- }
-
- $('#id_agents3')
- .append('');
- });
+ jQuery.ajax({
+ data: params,
+ dataType: "json",
+ type: "POST",
+ url: "ajax.php",
+ async: true,
+ success: function(data) {
+ $('#id_agents3')
+ .find('option')
+ .remove();
+ $.each(data['source'],function(key,value) {
+ if (value === source) {
+ $('#source').append( ``);
} else {
- for (const [agentID, agentAlias] of Object.entries(data['select_agents'])) {
- var optionAttr = '';
- if (typeof data['agents_selected'][agentID] !== 'undefined') {
- optionAttr = ' selected="selected"';
- }
-
- $('#id_agents3')
- .append('');
- }
+ $('#source').append( ``);
}
- }
+ });
+
+ $.each(data['agent'],function(key,value) {
+ const result = agent.includes(key);
+ if (result === true) {
+ $('#id_agents3').append( ``);
+ } else {
+ $('#id_agents3').append( ``);
+ }
+ });
}
});
}
@@ -7948,23 +7896,46 @@ function set_last_value_period() {
}
function source_change_agents() {
- $("#id_agents3").empty();
- $("#spinner_hack").show();
- jQuery.post ("ajax.php",
- {"page" : "operation/agentes/ver_agente",
- "get_agents_source_json" : 1,
- "source" : $("#source").val()
- },
- function (data, status) {
- for (var clave in data) {
- $("#id_agents3").append(
- ''
- );
+ const source = $("#source").val();
+ if (source === '') {
+ $("#id_agents3 option[value!=0]").attr("style","display:");
+ } else {
+ $("#spinner_hack").show();
+ $("#id_agents3 option").attr("style","display:none");
+
+ var params = {};
+ params["get_agent_source"] = 1;
+ params["page"] = "enterprise/include/ajax/log_viewer.ajax";
+
+ jQuery.ajax({
+ data: params,
+ dataType: "json",
+ type: "POST",
+ url: "ajax.php",
+ async: true,
+ success: function(data) {
+ let source_array = [];
+ $.each(data['source'],function(key,value) {
+ if (value === source) {
+ const split = key.split('-');
+ source_array.push(split[1]);
+ }
+ });
+
+ $.each(data['agent'],function(key,value) {
+ const result = source_array.includes(key);
+ if (result === true) {
+ $(`#id_agents3 option[value*='${key}']`).attr("style","display:");
+ }
+ });
+
+ $("#spinner_hack").hide();
+ },
+ error: function(error){
+ $("#spinner_hack").hide();
}
- $("#spinner_hack").hide();
- },
- "json"
- );
+ });
+ }
}
function dialog_message(message_id) {