From 0a8c478c473afb960cff1c0b59f7c05f3ba8b559 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 8 Mar 2021 17:48:59 +0100 Subject: [PATCH] visual fixes in agent view graphs --- pandora_console/include/ajax/graph.ajax.php | 8 +++++++- pandora_console/include/functions.php | 12 ++++++++++++ pandora_console/operation/agentes/graphs.php | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/ajax/graph.ajax.php b/pandora_console/include/ajax/graph.ajax.php index 09c4355b57..554f8c8118 100644 --- a/pandora_console/include/ajax/graph.ajax.php +++ b/pandora_console/include/ajax/graph.ajax.php @@ -55,9 +55,15 @@ if ($save_custom_graph) { if ($print_custom_graph) { ob_clean(); + $width_value = (int) get_parameter('width', CHART_DEFAULT_WIDTH); + + if ($width_value === -1) { + $width_value = ''; + } + $params = [ 'period' => (int) get_parameter('period', SECONDS_5MINUTES), - 'width' => (int) get_parameter('width', CHART_DEFAULT_WIDTH), + 'width' => $width_value, 'height' => (int) get_parameter('height', CHART_DEFAULT_HEIGHT), 'unit_name' => get_parameter('unit_list', []), 'date' => (int) get_parameter('date', time()), diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index accda15dd8..0896912edd 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -3910,6 +3910,18 @@ function series_type_graph_array($data, $show_elements_graph) $name_legend = $show_elements_graph['labels'][$value['agent_module_id']][$label_interfaces[$value['agent_module_id']]].': '; } else if (is_array($show_elements_graph['labels'][$value['agent_module_id']]) === true) { $name_legend = 'Avg: '; + + if (array_key_exists('agent_alias', $value) + && array_key_exists('module_name', $value) + && array_key_exists('unit', $value) + ) { + $name_legend .= $value['agent_alias']; + $name_legend .= ' / '; + $name_legend .= $value['module_name']; + $name_legend .= ' / '; + $name_legend .= __('Unit ').' '; + $name_legend .= $value['unit'].': '; + } } else { $name_legend = $show_elements_graph['labels'][$value['agent_module_id']].': '; } diff --git a/pandora_console/operation/agentes/graphs.php b/pandora_console/operation/agentes/graphs.php index 279661e02e..d33298b014 100644 --- a/pandora_console/operation/agentes/graphs.php +++ b/pandora_console/operation/agentes/graphs.php @@ -516,7 +516,7 @@ echo "
"; $container.html($errorMessage.html()); } - requestCustomGraph(0, width, height, period, stacked, date, modules) + requestCustomGraph(0, -1, height, period, stacked, date, modules) .done(handleSuccess) .fail(handleError); }