mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge branch 'ent-12349-porblema-con-csv-de-logs' into 'develop'
Ent 12349 porblema con csv de logs See merge request artica/pandorafms!6608
This commit is contained in:
commit
6e3e2534b2
@ -1932,33 +1932,8 @@ if (is_metaconsole() === true) {
|
|||||||
<td class="bolder"><?php echo __('Source'); ?></td>
|
<td class="bolder"><?php echo __('Source'); ?></td>
|
||||||
<td >
|
<td >
|
||||||
<?php
|
<?php
|
||||||
$agents = agents_get_group_agents($group);
|
html_print_select(
|
||||||
if ((empty($agents)) || $agents == -1) {
|
[],
|
||||||
$agents = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql_log = 'SELECT source AS k, source AS v
|
|
||||||
FROM tagente,tagent_module_log
|
|
||||||
WHERE tagente.id_agente = tagent_module_log.id_agent
|
|
||||||
AND tagente.disabled = 0';
|
|
||||||
|
|
||||||
if (!empty($agents)) {
|
|
||||||
$index = 0;
|
|
||||||
foreach ($agents as $key => $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,
|
|
||||||
'source',
|
'source',
|
||||||
$source,
|
$source,
|
||||||
'onselect=source_change_agents();',
|
'onselect=source_change_agents();',
|
||||||
@ -1966,7 +1941,7 @@ if (is_metaconsole() === true) {
|
|||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
@ -6702,68 +6677,41 @@ function loadGeneralAgents(agent_group) {
|
|||||||
function loadLogAgents() {
|
function loadLogAgents() {
|
||||||
var params = [];
|
var params = [];
|
||||||
|
|
||||||
params.push("get_log_agents=1");
|
let source = '<?php echo $source; ?>';
|
||||||
params.push("source=<?php echo $source; ?>");
|
let agent = '<?php echo json_encode($id_agents); ?>';
|
||||||
params.push('id_agents=<?php echo json_encode($id_agents); ?>');
|
agent = JSON.parse(agent);
|
||||||
params.push("page=include/ajax/reporting.ajax");
|
|
||||||
|
|
||||||
$('#id_agents3')
|
var params = {};
|
||||||
.find('option')
|
params["get_agent_source"] = 1;
|
||||||
.remove();
|
params["log_alert"] = 1;
|
||||||
|
params["page"] = "enterprise/include/ajax/log_viewer.ajax";
|
||||||
|
|
||||||
$('#id_agents3')
|
jQuery.ajax({
|
||||||
.append('<option>Loading agents...</option>');
|
data: params,
|
||||||
|
dataType: "json",
|
||||||
jQuery.ajax ({
|
type: "POST",
|
||||||
data: params.join ("&"),
|
url: "ajax.php",
|
||||||
type: 'POST',
|
async: true,
|
||||||
url: action=
|
success: function(data) {
|
||||||
<?php
|
$('#id_agents3')
|
||||||
echo '"'.ui_get_full_url(
|
.find('option')
|
||||||
false,
|
.remove();
|
||||||
false,
|
$.each(data['source'],function(key,value) {
|
||||||
false,
|
if (value === source) {
|
||||||
false
|
$('#source').append( `<option selected='selected' value='${key}'>${value}</option>`);
|
||||||
).'"';
|
|
||||||
?>
|
|
||||||
+ "/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('<option value="'+agentID+'" '+optionAttr+'>'+agentAlias+'</option>');
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
for (const [agentID, agentAlias] of Object.entries(data['select_agents'])) {
|
$('#source').append( `<option value='${key}'>${value}</option>`);
|
||||||
var optionAttr = '';
|
|
||||||
if (typeof data['agents_selected'][agentID] !== 'undefined') {
|
|
||||||
optionAttr = ' selected="selected"';
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#id_agents3')
|
|
||||||
.append('<option value="'+agentID+'" '+optionAttr+'>'+agentAlias+'</option>');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
$.each(data['agent'],function(key,value) {
|
||||||
|
const result = agent.includes(key);
|
||||||
|
if (result === true) {
|
||||||
|
$('#id_agents3').append( `<option selected='selected' value='${key}'>${value}</option>`);
|
||||||
|
} else {
|
||||||
|
$('#id_agents3').append( `<option value='${key}'>${value}</option>`);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -7948,23 +7896,46 @@ function set_last_value_period() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function source_change_agents() {
|
function source_change_agents() {
|
||||||
$("#id_agents3").empty();
|
const source = $("#source").val();
|
||||||
$("#spinner_hack").show();
|
if (source === '') {
|
||||||
jQuery.post ("ajax.php",
|
$("#id_agents3 option[value!=0]").attr("style","display:");
|
||||||
{"page" : "operation/agentes/ver_agente",
|
} else {
|
||||||
"get_agents_source_json" : 1,
|
$("#spinner_hack").show();
|
||||||
"source" : $("#source").val()
|
$("#id_agents3 option").attr("style","display:none");
|
||||||
},
|
|
||||||
function (data, status) {
|
var params = {};
|
||||||
for (var clave in data) {
|
params["get_agent_source"] = 1;
|
||||||
$("#id_agents3").append(
|
params["page"] = "enterprise/include/ajax/log_viewer.ajax";
|
||||||
'<option value="'+clave+'">'+data[clave]+'</option>'
|
|
||||||
);
|
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) {
|
function dialog_message(message_id) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user