From ac9452583a6103eaa8134f747f0f55812bc063f3 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Mon, 25 Feb 2019 16:50:27 +0100 Subject: [PATCH] Added no data to show to some graphs where id not found Former-commit-id: 1697a482e80521666f679eb18d2f44fc3975e304 --- pandora_console/include/functions_graph.php | 25 ++++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index cbdada69b9..71049d7804 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -549,12 +549,6 @@ function grafico_modulo_sparse($params) return false; } - if (!isset($params['agent_module_id'])) { - return false; - } else { - $agent_module_id = $params['agent_module_id']; - } - if (!isset($params['period'])) { return false; } @@ -710,6 +704,12 @@ function grafico_modulo_sparse($params) $params['projection'] = false; } + if (!isset($params['agent_module_id'])) { + return graph_nodata_image($params['width'], $params['height']); + } else { + $agent_module_id = $params['agent_module_id']; + } + // XXXX Configurable $params['grid_color'] = '#C1C1C1'; $params['legend_color'] = '#636363'; @@ -1318,6 +1318,10 @@ function graphic_combined_module( $array_data = []; foreach ($module_list as $key => $agent_module_id) { + if ((bool) $agent_module_id === false) { + continue; + } + if (is_metaconsole() && $params_combined['type_report'] == 'automatic_graph') { $server = metaconsole_get_connection_by_id($agent_module_id['server']); if (metaconsole_connect($server) != NOERR) { @@ -1394,6 +1398,15 @@ function graphic_combined_module( } } + if (empty($array_data)) { + if ($params_combined['return']) { + return graph_nodata_image($width, $height); + } + + echo graph_nodata_image($width, $height); + return false; + } + if ($params_combined['projection']) { // If projection doesn't have data then don't draw graph if ($output_projection != null) {