Merge branch 'ent-4541-Comportamiento_erroneo_en_Metaconsola' into 'develop'

fixed event view metaconsole

See merge request artica/pandorafms!2677
This commit is contained in:
Alejandro Fraguas 2019-08-23 13:19:30 +02:00
commit 51f2baa0dd
4 changed files with 17 additions and 15 deletions

View File

@ -1290,12 +1290,14 @@ if ($get_extended_event) {
$details = events_page_details($event, $server);
if ($meta) {
metaconsole_restore_db();
}
if (events_has_extended_info($event['id_evento']) === true) {
$related = events_page_related($event, $server);
}
// Juanma (09/05/2014) Fix: Needs to reconnect to node, in previous funct
// node connection was lost.
if ($meta) {
$server = metaconsole_get_connection_by_id($server_id);
metaconsole_connect($server);
@ -1574,7 +1576,6 @@ if ($get_list_events_agents) {
$date_from = get_parameter('date_from');
$date_to = get_parameter('date_to');
$id_user = $config['id_user'];
$server_id = get_parameter('server_id');
$returned_sql = events_sql_events_grouped_agents(
$id_agent,
@ -1810,4 +1811,3 @@ if ($get_events_fired) {
echo io_json_mb_encode($return);
}

View File

@ -878,9 +878,11 @@ function events_get_all(
$agent_join_filters = [];
$tagente_table = 'tagente';
$tagente_field = 'id_agente';
$conditionMetaconsole = '';
if (is_metaconsole()) {
$tagente_table = 'tmetaconsole_agent';
$tagente_field = 'id_tagente';
$conditionMetaconsole = ' AND ta.id_tmetaconsole_setup = te.server_id ';
}
// Agent alias.
@ -1214,12 +1216,12 @@ function events_get_all(
$server_join = '';
if (is_metaconsole()) {
$server_join = ' INNER JOIN tmetaconsole_setup ts
ON ts.id = te.server_id AND ts.server_name = ta.server_name';
$server_join = ' LEFT JOIN tmetaconsole_setup ts
ON ts.id = te.server_id';
if (!empty($filter['server_id'])) {
$server_join = sprintf(
' INNER JOIN tmetaconsole_setup ts
ON ts.id = te.server_id AND ts.server_name = ta.server_name AND ts.id= %d',
' LEFT JOIN tmetaconsole_setup ts
ON ts.id = te.server_id AND ts.id= %d',
$filter['server_id']
);
}
@ -1254,6 +1256,7 @@ function events_get_all(
%s JOIN %s ta
ON ta.%s = te.id_agente
%s
%s
%s JOIN tgrupo tg
ON te.id_grupo = tg.id_grupo
%s
@ -1273,6 +1276,7 @@ function events_get_all(
$tagente_join,
$tagente_table,
$tagente_field,
$conditionMetaconsole,
join(' ', $agent_join_filters),
$tgrupo_join,
join(' ', $tgrupo_join_filters),
@ -3883,7 +3887,7 @@ function events_page_details($event, $server='')
global $config;
// If server is provided, get the hash parameters.
if (!empty($server) && defined('METACONSOLE')) {
if (!empty($server) && is_metaconsole()) {
$hashdata = metaconsole_get_server_hashdata($server);
$hashstring = '&loginhash=auto&loginhash_data='.$hashdata.'&loginhash_user='.str_rot13($config['id_user']);
$serverstring = $server['server_url'].'/';
@ -4185,10 +4189,6 @@ function events_page_details($event, $server='')
$details = '<div id="extended_event_details_page" class="extended_event_pages">'.html_print_table($table_details, true).'</div>';
if (!empty($server) && defined('METACONSOLE')) {
metaconsole_restore_db();
}
return $details;
}

View File

@ -1487,7 +1487,7 @@ function ui_require_javascript_file($name, $path='include/javascript/', $echo_ta
$filename = $path.$name.'.js';
if ($echo_tag) {
echo '<script type="text/javascript" src="'.ui_get_full_url(false, false, false, false).$filename.'"></script>';
echo '<script type="text/javascript" src="'.ui_get_full_url($filename, false, false, false).'"></script>';
return null;
}
@ -1504,7 +1504,7 @@ function ui_require_javascript_file($name, $path='include/javascript/', $echo_ta
return false;
}
if (defined('METACONSOLE')) {
if (is_metaconsole()) {
$config['js'][$name] = '../../'.$filename;
} else {
$config['js'][$name] = $filename;

View File

@ -246,6 +246,8 @@ if (is_ajax()) {
$fields[] = 'ta.server_name as server_name';
} else {
$fields[] = 'ts.server_name as server_name';
$fields[] = 'te.id_agentmodule';
$fields[] = 'te.server_id';
}
$events = events_get_all(