fix interfaces charts pandora_enterprise#9683

This commit is contained in:
Daniel Barbero 2022-10-27 16:12:17 +02:00
parent 0f82209d7e
commit 6d19391c72
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 = [];
$labels = [];
$modules = [];
@ -1498,6 +1498,10 @@ function graphic_combined_module(
}
}
if ((bool) $params_combined['from_interface'] === true) {
$labels = [];
}
if ($module_list) {
$params_combined['modules_id'] = $module_list;
} else {

View File

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

View File

@ -4001,11 +4001,12 @@ function ui_toggle(
);
// Options.
$style = 'overflow:hidden;';
if ($hidden_default) {
$style = 'display:none';
$style .= 'height:0;';
$original = $img_b;
} else {
$style = '';
$style .= 'height:auto;';
$original = $img_a;
}
@ -4111,24 +4112,24 @@ function ui_toggle(
$output .= ' if (is_metaconsole == 0) {';
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\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 .= " else {\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 .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n";
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\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 .= " $('#checkbox-".$switch_name."').prop('checked', true);\n";
$output .= " }\n";
$output .= " else {\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 .= " $('#checkbox-".$switch_name."').prop('checked', false);\n";
$output .= " }\n";

View File

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

View File

@ -6,10 +6,6 @@ div#bullets_modules span {
font-weight: 700;
}
table#agent_interface_info .noresizevc.graph {
margin-bottom: 10px;
}
div.agent_details_agent_alias {
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_event_graph'] = 'width: 35%;padding-top:0px;padding-bottom:0px;';
$table_interface->align['interface_event_graph'] = 'right';
// $table_interface->style['interface_event_graph'] = 'width: 5%;padding-top:0px;padding-bottom:0px;';
$table_interface->align['interface_event_graph_text'] = 'left';
$table_interface->style['interface_name'] = 'width: 10%;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_event_graph'] = 'width: 3%;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_name'] = 'width: 30%;padding-top:0px;padding-bottom:0px;';
$table_interface->align['interface_name'] = 'left';
$table_interface->align['interface_ip'] = 'left';
$table_interface->align['last_contact'] = 'left';
@ -819,12 +818,6 @@ if (!empty($network_interfaces)) {
$data['interface_mac'] = $interface['mac'];
$data['last_contact'] = __('Last contact: ').$last_contact;
$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;
}
@ -939,7 +932,7 @@ if ($table_access_rate) {
echo $agent_incidents;
if (isset($table_interface)) {
if (isset($table_interface) === true) {
ui_toggle(
html_print_table($table_interface, true),
'<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>
<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/select2.min.css" type="text/css" />
<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.pandora.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
require_once $config['homedir'].'/include/graphs/functions_flot.php';
echo include_javascript_dependencies_flot_graph(true, '../');