Merge branch 'ent-9683-bug-en-leyenda-de-graficas-snmp' into 'develop'

fix interfaces charts pandora_enterprise#9683

pandora_enterprise#9683

See merge request artica/pandorafms!5278
This commit is contained in:
Jimmy Olano 2022-11-22 00:32:10 +00:00
commit eaae19ab41
7 changed files with 27 additions and 35 deletions

View File

@ -1416,7 +1416,7 @@ function graphic_combined_module(
} }
} }
if (isset($sources) && is_array($sources)) { if (isset($sources) === true && is_array($sources) === true) {
$weights = []; $weights = [];
$labels = []; $labels = [];
$modules = []; $modules = [];
@ -1498,6 +1498,10 @@ function graphic_combined_module(
} }
} }
if ((bool) $params_combined['from_interface'] === true) {
$labels = [];
}
if ($module_list) { if ($module_list) {
$params_combined['modules_id'] = $module_list; $params_combined['modules_id'] = $module_list;
} else { } else {

View File

@ -5980,11 +5980,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
include_once '../../include/graphs/functions_gd.php'; include_once '../../include/graphs/functions_gd.php';
} }
$max_value = count($events); $period = SECONDS_1DAY;
if (is_metaconsole()) {
$max_value = SECONDS_1HOUR;
}
if (!$text_header_event) { if (!$text_header_event) {
$text_header_event = __('Events info (1hr.)'); $text_header_event = __('Events info (1hr.)');
@ -6057,7 +6053,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
} else { } else {
$graph_data[] = [ $graph_data[] = [
'data' => $color, 'data' => $color,
'utimestamp' => 1, 'utimestamp' => SECONDS_1DAY,
]; ];
} }
} }
@ -6076,9 +6072,9 @@ function reporting_get_event_histogram($events, $text_header_event=false)
$slicebar = flot_slicesbar_graph( $slicebar = flot_slicesbar_graph(
$graph_data, $graph_data,
$max_value, $period,
'450px;border:0', '400px;border:0',
25, 40,
$full_legend, $full_legend,
$colors, $colors,
$config['fontpath'], $config['fontpath'],
@ -6091,7 +6087,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
[], [],
true, true,
1, 1,
false, 450,
true true
); );

View File

@ -4001,11 +4001,12 @@ function ui_toggle(
); );
// Options. // Options.
$style = 'overflow:hidden;';
if ($hidden_default) { if ($hidden_default) {
$style = 'display:none'; $style .= 'height:0;';
$original = $img_b; $original = $img_b;
} else { } else {
$style = ''; $style .= 'height:auto;';
$original = $img_a; $original = $img_a;
} }
@ -4111,24 +4112,24 @@ function ui_toggle(
$output .= ' if (is_metaconsole == 0) {'; $output .= ' if (is_metaconsole == 0) {';
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n"; $output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n"; $output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n"; $output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
$output .= " }\n"; $output .= " }\n";
$output .= " else {\n"; $output .= " else {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n"; $output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n"; $output .= " $('#tgl_div_".$uniqid."').css('height', 0);\n";
$output .= " }\n"; $output .= " }\n";
$output .= " }\n"; $output .= " }\n";
$output .= " });\n"; $output .= " });\n";
$output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n"; $output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n";
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n"; $output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n"; $output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n"; $output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
$output .= " $('#image_".$uniqid."').attr({src: '".$image_a."'});\n"; $output .= " $('#image_".$uniqid."').attr({src: '".$image_a."'});\n";
$output .= " $('#checkbox-".$switch_name."').prop('checked', true);\n"; $output .= " $('#checkbox-".$switch_name."').prop('checked', true);\n";
$output .= " }\n"; $output .= " }\n";
$output .= " else {\n"; $output .= " else {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n"; $output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n"; $output .= " $('#tgl_div_".$uniqid."').css('height', 0);\n";
$output .= " $('#image_".$uniqid."').attr({src: '".$image_b."'});\n"; $output .= " $('#image_".$uniqid."').attr({src: '".$image_b."'});\n";
$output .= " $('#checkbox-".$switch_name."').prop('checked', false);\n"; $output .= " $('#checkbox-".$switch_name."').prop('checked', false);\n";
$output .= " }\n"; $output .= " }\n";

View File

@ -2461,14 +2461,14 @@ function pandoraFlotArea(
); );
} else { } else {
$.each(update_legend, function(index, value) { $.each(update_legend, function(index, value) {
if (typeof value[x] !== "undefined") { if (typeof value[x - 1] !== "undefined") {
data_legend[index] = data_legend[index] =
" Min: " + " Min: " +
number_format(value[x].min, 0, unit, short_data, divisor) + number_format(value[x - 1].min, 0, unit, short_data, divisor) +
" Max: " + " Max: " +
number_format(value[x].max, 0, unit, short_data, divisor) + number_format(value[x - 1].max, 0, unit, short_data, divisor) +
" Avg: " + " Avg: " +
number_format(value[x].avg, 0, unit, short_data, divisor); number_format(value[x - 1].avg, 0, unit, short_data, divisor);
} else { } else {
data_legend[index] = " Min: " + 0 + " Max: " + 0 + " Avg: " + 0; data_legend[index] = " Min: " + 0 + " Max: " + 0 + " Avg: " + 0;
} }

View File

@ -6,10 +6,6 @@ div#bullets_modules span {
font-weight: 700; font-weight: 700;
} }
table#agent_interface_info .noresizevc.graph {
margin-bottom: 10px;
}
div.agent_details_agent_alias { div.agent_details_agent_alias {
flex: 1; flex: 1;
} }

View File

@ -681,9 +681,8 @@ if (!empty($network_interfaces)) {
$table_interface->style['interface_graph'] = 'width: 20px;padding-top:0px;padding-bottom:0px;'; $table_interface->style['interface_graph'] = 'width: 20px;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_event_graph'] = 'width: 35%;padding-top:0px;padding-bottom:0px;'; $table_interface->style['interface_event_graph'] = 'width: 35%;padding-top:0px;padding-bottom:0px;';
$table_interface->align['interface_event_graph'] = 'right'; $table_interface->align['interface_event_graph'] = 'right';
// $table_interface->style['interface_event_graph'] = 'width: 5%;padding-top:0px;padding-bottom:0px;'; $table_interface->style['interface_event_graph'] = 'width: 3%;padding-top:0px;padding-bottom:0px;';
$table_interface->align['interface_event_graph_text'] = 'left'; $table_interface->style['interface_name'] = 'width: 30%;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_name'] = 'width: 10%;padding-top:0px;padding-bottom:0px;';
$table_interface->align['interface_name'] = 'left'; $table_interface->align['interface_name'] = 'left';
$table_interface->align['interface_ip'] = 'left'; $table_interface->align['interface_ip'] = 'left';
$table_interface->align['last_contact'] = 'left'; $table_interface->align['last_contact'] = 'left';
@ -819,12 +818,6 @@ if (!empty($network_interfaces)) {
$data['interface_mac'] = $interface['mac']; $data['interface_mac'] = $interface['mac'];
$data['last_contact'] = __('Last contact: ').$last_contact; $data['last_contact'] = __('Last contact: ').$last_contact;
$data['interface_event_graph'] = $e_graph; $data['interface_event_graph'] = $e_graph;
if ($event_text_cont == 0) {
$data['interface_event_graph_text'] = ui_print_help_tip('Module events graph', true);
$event_text_cont++;
} else {
$data['interface_event_graph_text'] = '';
}
$table_interface->data[] = $data; $table_interface->data[] = $data;
} }
@ -939,7 +932,7 @@ if ($table_access_rate) {
echo $agent_incidents; echo $agent_incidents;
if (isset($table_interface)) { if (isset($table_interface) === true) {
ui_toggle( ui_toggle(
html_print_table($table_interface, true), html_print_table($table_interface, true),
'<b>'.__('Interface information (SNMP)').'</b>', '<b>'.__('Interface information (SNMP)').'</b>',

View File

@ -95,10 +95,12 @@ if ($refresh > 0) {
<title><?php echo __('%s Interface Graph', get_product_name()).' ('.agents_get_alias($agent_id).' - '.$interface_name; ?>)</title> <title><?php echo __('%s Interface Graph', get_product_name()).' ('.agents_get_alias($agent_id).' - '.$interface_name; ?>)</title>
<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" /> <link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/js/jquery-ui.min.css" type="text/css" /> <link rel="stylesheet" href="../../include/styles/js/jquery-ui.min.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/select2.min.css" type="text/css" />
<script type='text/javascript' src='../../include/javascript/pandora.js'></script> <script type='text/javascript' src='../../include/javascript/pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery.current.js'></script> <script type='text/javascript' src='../../include/javascript/jquery.current.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script> <script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script> <script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script>
<script type='text/javascript' src='../../include/javascript/select2.min.js'></script>
<?php <?php
require_once $config['homedir'].'/include/graphs/functions_flot.php'; require_once $config['homedir'].'/include/graphs/functions_flot.php';
echo include_javascript_dependencies_flot_graph(true, '../'); echo include_javascript_dependencies_flot_graph(true, '../');