From 54ba66e72a43bf26f5bc9ac1b51afed720cbc845 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 1 Jun 2023 14:53:45 +0200 Subject: [PATCH] #11418 change graph in agent view --- pandora_console/include/ajax/graph.ajax.php | 6 ++++-- pandora_console/operation/agentes/graphs.php | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/ajax/graph.ajax.php b/pandora_console/include/ajax/graph.ajax.php index 7b96d1e85b..39e119f49f 100644 --- a/pandora_console/include/ajax/graph.ajax.php +++ b/pandora_console/include/ajax/graph.ajax.php @@ -17,6 +17,8 @@ $save_custom_graph = (bool) get_parameter('save_custom_graph'); $print_custom_graph = (bool) get_parameter('print_custom_graph', false); $print_sparse_graph = (bool) get_parameter('print_sparse_graph'); $get_graphs = (bool) get_parameter('get_graphs_container'); +$width = get_parameter('width', 0); +$height = get_parameter('height', 0); if ($save_custom_graph) { $return = []; @@ -25,8 +27,6 @@ if ($save_custom_graph) { $name = get_parameter('name', ''); $description = get_parameter('description', ''); $stacked = get_parameter('stacked', CUSTOM_GRAPH_LINE); - $width = get_parameter('width', 0); - $height = get_parameter('height', 0); $events = get_parameter('events', 0); $period = get_parameter('period', 0); $fullscale = get_parameter('fullscale', 0); @@ -126,6 +126,8 @@ if ($print_sparse_graph) { 'force_interval' => '', 'time_interval' => 300, 'array_data_create' => 0, + 'height' => $height, + 'width' => $width, ]; echo grafico_modulo_sparse($params); diff --git a/pandora_console/operation/agentes/graphs.php b/pandora_console/operation/agentes/graphs.php index f0da16847f..f976d21001 100644 --- a/pandora_console/operation/agentes/graphs.php +++ b/pandora_console/operation/agentes/graphs.php @@ -45,7 +45,7 @@ if ((bool) check_acl($config['id_user'], $id_grupo, 'AR') === false && (bool) ch require_once $config['homedir'].'/include/functions_graph.php'; $draw_alerts = get_parameter('draw_alerts', 0); -$period = get_parameter('period', SECONDS_1HOUR); +$period = (string) get_parameter('period', SECONDS_2HOUR); $width = get_parameter('width', 555); $height = get_parameter('height', 245); $label = get_parameter('label', ''); @@ -53,8 +53,8 @@ $start_date = get_parameter('start_date', date('Y-m-d')); $draw_events = get_parameter('draw_events', 0); $modules = get_parameter('modules', []); $filter = get_parameter('filter', 0); -$combined = get_parameter('combined', 1); -$option_type = get_parameter('option_type', 0); +$combined = get_parameter('combined', 0); +$option_type = get_parameter('option_type', 2); // ---------------------------------------------------------------------- // Get modules of agent sorted as: @@ -176,11 +176,12 @@ foreach ($modules_boolean as $i => $m) { $list_modules = ($modules_networkmap_no_proc + $modules_others + $modules_boolean); +sort($list_modules); // ---------------------------------------------------------------------- if (empty($modules)) { // Selected the first 6 modules. $module_ids = array_keys($list_modules); - $module_ids = array_slice($module_ids, 0, 6); + $module_ids = array_slice($module_ids, 0, 12); $modules = $module_ids; } @@ -301,7 +302,7 @@ $htmlForm .= html_print_div( $htmlForm .= ''; -ui_toggle($htmlForm, __('Filter graphs'), __('Toggle filter(s)'), '', false); +ui_toggle($htmlForm, __('Filter graphs'), __('Toggle filter(s)'), '', true); $utime = get_system_time(); $current = date('Y-m-d', $utime); @@ -316,13 +317,17 @@ if ($combined) { // Pass the $modules before the ajax call. echo '
'.html_print_image('images/spinner.gif', true).'
'; } else { + echo '
'; foreach ($modules as $id_module) { $title = modules_get_agentmodule_name($id_module); $unit = modules_get_unit($id_module); - + echo '
'; echo '

'.$title.'

'; - echo '
'.html_print_image('images/spinner.gif', true).'
'; + echo '
'.html_print_image('images/spinner.gif', true).'
'; + echo '
'; } + + echo '
'; } echo "
";