From 0db539c444afbeeac9d8b12ab4f2d5f3ec86ce74 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 1 Oct 2020 15:29:54 +0200 Subject: [PATCH] fix visual windows charts --- pandora_console/extensions/agents_modules.php | 2 +- pandora_console/include/ajax/module.php | 2 +- pandora_console/include/functions_events.php | 2 +- pandora_console/include/functions_graph.php | 37 +- pandora_console/include/functions_modules.php | 2 +- .../include/functions_treeview.php | 8 +- .../include/graphs/flot/pandora.flot.js | 2 +- .../include/javascript/tree/TreeController.js | 4 +- pandora_console/include/styles/pandora.css | 27 +- .../agentes/estado_generalagente.php | 2 +- .../agentes/interface_traffic_graph_win.php | 467 +++++++++------ .../operation/agentes/stat_win.php | 551 ++++++++++-------- .../operation/agentes/status_monitor.php | 2 +- 13 files changed, 633 insertions(+), 475 deletions(-) diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 7d5cbc0c99..3c576fecf2 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -801,7 +801,7 @@ function mainAgentsModules() echo ""; $win_handle = dechex(crc32($module_id.$module['name'])); $graph_type = return_graphtype(modules_get_agentmodule_type($module_id)); - $link = "winopeng('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module_id.'&'.'refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."')"; + $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module_id.'&'.'refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."', 800, 480)"; echo ''; diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 15616dfc51..6dcb95afd3 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1084,7 +1084,7 @@ if (check_login()) { $draw_events = 0; } - $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&id='.$module['id_agente_modulo'].'&refresh='.SECONDS_10MINUTES.'&'."draw_events=$draw_events', 'day_".$win_handle."', 1000, 700)"; + $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&id='.$module['id_agente_modulo'].'&refresh='.SECONDS_10MINUTES.'&'."draw_events=$draw_events', 'day_".$win_handle."', 800, 480)"; if (!is_snapshot_data($module['datos'])) { $data[8] .= ''.html_print_image('images/chart_curve.png', true, ['border' => '0', 'alt' => '']).'   '; } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 77dee71bab..1fb4121454 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4228,7 +4228,7 @@ function events_page_details($event, $server='') $graph_params_str = http_build_query($graph_params); - $link = "winopeng('".$url.'?'.$graph_params_str."','".$win_handle."')"; + $link = "winopeng_var('".$url.'?'.$graph_params_str."','".$win_handle."', 800, 480)"; $data[1] = ''; $data[1] .= html_print_image('images/chart_curve.png', true); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index d30bc6b812..40b9ed0900 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -267,13 +267,13 @@ function grafico_modulo_sparse_data( || $data_module_graph['id_module_type'] == 31 || $data_module_graph['id_module_type'] == 100 ) { - $array_data = grafico_modulo_sparse_data_chart( - $agent_module_id, - $date_array, - $data_module_graph, - $params, - $series_suffix - ); + $array_data = grafico_modulo_sparse_data_chart( + $agent_module_id, + $date_array, + $data_module_graph, + $params, + $series_suffix + ); } else { $data_slice = ($date_array['period'] / (250 * $params['zoom']) + 100); $array_data = fullscale_data( @@ -289,6 +289,10 @@ function grafico_modulo_sparse_data( } } + if (empty($array_data) === true) { + return []; + } + if ($array_data === false && (!$params['graph_combined'] && !isset($array_data['sum1']['data'][0][1]) && !$params['baseline']) ) { @@ -1005,7 +1009,7 @@ function grafico_modulo_sparse($params, $server_name='') $return .= graph_nodata_image($params['width'], $params['height']); } } else { - if (!empty($array_data)) { + if (empty($array_data) === false) { $return = area_graph( $agent_module_id, $array_data, @@ -4168,6 +4172,10 @@ function fullscale_data( $data_slice ); + if ($data_uncompress === false) { + return []; + } + $data = []; $previous_data = 0; // Normal. @@ -4413,10 +4421,6 @@ function fullscale_data( $data['sum'.$series_suffix]['avg'] = ($sum_data_avg / $count_data_total); } } else { - if ($data_uncompress === false) { - $data_uncompress = []; - } - foreach ($data_uncompress as $k) { foreach ($k['data'] as $v) { if (isset($v['type']) && $v['type'] == 1) { @@ -4991,7 +4995,14 @@ function graph_nodata_image( if ($percent === true) { $div = $image_div; } else { - $style = 'width:'.$width.'px; height:'.$height.'px; background-color: white; margin: 0 auto;'; + if (strpos($width, '%') === false) { + $width = 'width: '.$width.'px;'; + } else { + $width = 'width: '.$width.';'; + } + + $style = $width.' height:'.$height.'px;'; + $style .= ' background-color: white; margin: 0 auto;'; $div = '
'.$image_div.'
'; } diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 81991face5..9a5ea93f92 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -3456,7 +3456,7 @@ function get_module_realtime_link_graph($module) $win_handle = 'realtime_'.dechex(crc32($module['id_agente_modulo'].$module['nombre'])); - $link_button = '
'.html_print_image( + $link_button = ''.html_print_image( 'images/realtime_shortcut.png', true, [ diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 96f8c0dfa9..25e0f67020 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -857,7 +857,13 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) $graph_url = "$url?params=$params_encoded"; $win_handle = dechex(crc32($interface['status_module_id'].$interface_name)); - $graph_link = "".html_print_image('images/chart_curve.png', true, ['title' => __('Interface traffic')]).''; + $graph_link = ""; + $graph_link .= html_print_image( + 'images/chart_curve.png', + true, + ['title' => __('Interface traffic')] + ); + $graph_link .= ''; } else { $graph_link = ''; } diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 1a100ba5c6..e764c6b20f 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -3030,7 +3030,7 @@ function number_format(number, force_integer, unit, short_data, divisor) { var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"]; var pos = 0; - while (number >= divisor) { + while (Math.abs(number) >= divisor) { // As long as the number can be divided by 1000 or 1024. pos++; number = number / divisor; diff --git a/pandora_console/include/javascript/tree/TreeController.js b/pandora_console/include/javascript/tree/TreeController.js index fdcf6421bb..f3e6ecec52 100644 --- a/pandora_console/include/javascript/tree/TreeController.js +++ b/pandora_console/include/javascript/tree/TreeController.js @@ -758,8 +758,8 @@ var TreeController = { winopeng_var( element.moduleGraph.url, element.moduleGraph.handle, - 1000, - 650 + 800, + 480 ); } catch (error) { // console.log(error); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 4cf03ca933..98963ee2a2 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -3077,6 +3077,18 @@ div.nodata_container { display: table; } +div#stat-win-module-graph div.nodata_container { + width: 30%; + height: 100%; + background-repeat: no-repeat; + background-position: center; + margin: auto auto; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + #snmp_data { width: 40%; position: absolute; @@ -5478,12 +5490,7 @@ table.info_table.policy_sub_table { * --------------------------------------------------------------------- */ .module_graph_menu_dropdown { - padding-top: 20px; - padding-bottom: 20px; - position: absolute; - top: 10px; width: 100%; - z-index: 1001; } .module_graph_menu_content, @@ -5501,7 +5508,7 @@ table.info_table.policy_sub_table { padding: 6px 10px; cursor: pointer; display: flex; - justify-content: space-between; + justify-content: flex-start; align-items: center; } @@ -5511,12 +5518,20 @@ table.info_table.policy_sub_table { } .module_graph_menu_content { + position: absolute; + left: 2.5%; + top: 41px; + z-index: 1001; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; padding: 15px; border-top: none; } +#stat-win-module-graph .flot-y-axis.flot-y1-axis.yAxis.y1Axis { + left: -10px !important; +} + /* * --------------------------------------------------------------------- * - AGENT VIEW diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 3bcad1291a..58df460112 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -647,7 +647,7 @@ if (!empty($network_interfaces)) { $win_handle = dechex(crc32($interface['status_module_id'].$interface_name)); $graph_link = ""; + $graph_link .= $win_handle."', 800, 480)\">"; $graph_link .= html_print_image( 'images/chart_curve.png', true, diff --git a/pandora_console/operation/agentes/interface_traffic_graph_win.php b/pandora_console/operation/agentes/interface_traffic_graph_win.php index 0f1675fdb0..b34c92efec 100644 --- a/pandora_console/operation/agentes/interface_traffic_graph_win.php +++ b/pandora_console/operation/agentes/interface_traffic_graph_win.php @@ -1,18 +1,31 @@ '; echo ''; - ui_print_error_message(__('There was a problem connecting with the node')); + ui_print_error_message( + __('There was a problem connecting with the node') + ); echo ''; echo ''; exit; @@ -48,7 +63,9 @@ if ($config['metaconsole'] && !empty($server_id)) { $user_language = get_user_language($config['id_user']); if (file_exists('../../include/languages/'.$user_language.'.mo')) { - $l10n = new gettext_reader(new CachedFileReader('../../include/languages/'.$user_language.'.mo')); + $l10n = new gettext_reader( + new CachedFileReader('../../include/languages/'.$user_language.'.mo') + ); $l10n->load_tables(); } @@ -65,59 +82,59 @@ $interface_traffic_modules = [ 0) { $query = ui_get_url_refresh(false); echo ''; } ?> - - <?php echo __('%s Interface Graph', get_product_name()).' ('.agents_get_alias($agent_id).' - '.$interface_name; ?>) - - - - - - - - - - + +<?php echo __('%s Interface Graph', get_product_name()).' ('.agents_get_alias($agent_id).' - '.$interface_name; ?>) + + + + + + + + + + $now) { $date = $now; } - $urlImage = ui_get_full_url(false); +$urlImage = ui_get_full_url(false); - // Graph. - echo '
'; +// FORM TABLE. +$table = html_get_predefined_table('transparent', 2); +$table->width = '100%'; +$table->id = 'stat_win_form_div'; +$table->style[0] = 'text-align:left;'; +$table->style[1] = 'text-align:left;'; +$table->styleTable = 'margin-bottom: 20px;'; +$table->class = 'table_modal_alternate'; - $height = 400; - $width = '90%'; +$data = []; +$data[0] = __('Refresh time'); +$data[1] = html_print_extended_select_for_time( + 'refresh', + $refresh, + '', + '', + 0, + 7, + true +); +$table->data[] = $data; +$table->rowclass[] = ''; - $params = [ - 'period' => $period, - 'width' => $width, - 'height' => $height, - 'unit_name' => array_fill(0, count($interface_traffic_modules), $config['interface_unit']), - 'date' => $date, - 'homeurl' => $config['homeurl'], - 'percentil' => (($show_percentil) ? $config['percentil'] : null), - 'fullscale' => $fullscale, - 'zoom' => $zoom, - ]; +$data = []; +$data[0] = __('Begin date'); +$data[1] = html_print_input_text( + 'start_date', + substr($start_date, 0, 10), + '', + 15, + 255, + true +); +$data[1] .= html_print_image( + '/images/calendar_view_day.png', + true, + [ + 'onclick' => "scwShow(scwID('text-start_date'),this);", + 'style' => 'vertical-align: bottom;', + ], + false, + false, + false, + true +); +$table->data[] = $data; +$table->rowclass[] = ''; - if (is_metaconsole()) { - $params['id_server'] = $server_id; - } +$data = []; +$data[0] = __('Begin time'); +$data[1] = html_print_input_text('start_time', $start_time, '', 10, 10, true); +$table->data[] = $data; +$table->rowclass[] = ''; - if ($config['type_interface_charts'] == 'line') { - $stacked = CUSTOM_GRAPH_LINE; - } else { - $stacked = CUSTOM_GRAPH_AREA; - } +$data = []; +$data[0] = __('Time range'); +$data[1] = html_print_extended_select_for_time( + 'period', + $period, + '', + '', + 0, + 7, + true +); +$table->data[] = $data; +$table->rowclass[] = ''; - $params_combined = [ - 'weight_list' => [], - 'projection' => false, - 'labels' => array_keys($interface_traffic_modules), - 'from_interface' => true, - 'modules_series' => array_values($interface_traffic_modules), - 'return' => 0, - 'stacked' => $stacked, - ]; +$data = []; +$data[0] = __('Show percentil'); +$data[1] = html_print_checkbox_switch( + 'show_percentil', + 1, + (bool) $show_percentil, + true +); +$table->data[] = $data; +$table->rowclass[] = ''; - graphic_combined_module( - array_values($interface_traffic_modules), - $params, - $params_combined - ); +$data = []; +$data[0] = __('Show full scale graph (TIP)').ui_print_help_tip( + __('This option may cause performance issues'), + true, + 'images/tip.png', + true +); +$data[1] = html_print_checkbox_switch('fullscale', 1, (bool) $fullscale, true); +$table->data[] = $data; +$table->rowclass[] = ''; - echo '
'; +$data = []; +$data[0] = __('Zoom factor'); +$options = []; +$options[$zoom] = 'x'.$zoom; +$options[1] = 'x1'; +$options[2] = 'x2'; +$options[3] = 'x3'; +$options[4] = 'x4'; +$options[5] = __('Full'); +$data[1] = html_print_select( + $options, + 'zoom', + $zoom, + '', + '', + 0, + true, + false, + false +); +$table->data[] = $data; +$table->rowclass[] = ''; - // FORM TABLE - $table = html_get_predefined_table('transparent', 2); - $table->width = '100%'; - $table->id = 'stat_win_form_div'; - $table->style[0] = 'text-align:left;'; - $table->style[1] = 'text-align:left;'; - $table->styleTable = 'margin-bottom: 20px;'; - $table->class = 'table_modal_alternate'; - - $data = []; - $data[0] = __('Refresh time'); - $data[1] = html_print_extended_select_for_time('refresh', $refresh, '', '', 0, 7, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Begin date'); - $data[1] = html_print_input_text('start_date', substr($start_date, 0, 10), '', 15, 255, true); - $data[1] .= html_print_image('/images/calendar_view_day.png', true, ['onclick' => "scwShow(scwID('text-start_date'),this);", 'style' => 'vertical-align: bottom;'], false, false, false, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Begin time'); - $data[1] = html_print_input_text('start_time', $start_time, '', 10, 10, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Time range'); - $data[1] = html_print_extended_select_for_time('period', $period, '', '', 0, 7, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Show percentil'); - $data[1] = html_print_checkbox_switch('show_percentil', 1, (bool) $show_percentil, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Show full scale graph (TIP)').ui_print_help_tip( - __('This option may cause performance issues'), - true, - 'images/tip.png', - true - ); - $data[1] = html_print_checkbox_switch('fullscale', 1, (bool) $fullscale, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Zoom factor'); - $options = []; - $options[$zoom] = 'x'.$zoom; - $options[1] = 'x1'; - $options[2] = 'x2'; - $options[3] = 'x3'; - $options[4] = 'x4'; - $options[5] = __('Full'); - $data[1] = html_print_select($options, 'zoom', $zoom, '', '', 0, true, false, false); - $table->data[] = $data; - $table->rowclass[] = ''; - - $form_table = html_print_table($table, true); - $form_table .= '
'.html_print_submit_button( - __('Reload'), - 'submit', - false, - 'class="sub upd"', - true - ).'
'; +$form_table = html_print_table($table, true); +$form_table .= '
'.html_print_submit_button( + __('Reload'), + 'submit', + false, + 'class="sub upd"', + true +).'
'; - // Menu. - $menu_form = "
".html_print_input_hidden('params', base64_encode($params_json), true); +// Menu. +$menu_form = "".html_print_input_hidden('params', base64_encode($params_json), true); - if (!empty($server_id)) { - $menu_form .= html_print_input_hidden('server', $server_id, true); - } +if (empty($server_id) === false) { + $menu_form .= html_print_input_hidden('server', $server_id, true); +} - echo $menu_form; - echo '
-
- '.html_print_image('images/arrow_down_green.png', true, ['class' => 'module_graph_menu_arrow', 'float' => 'left'], false, false, true).' - '.__('Graph configuration menu').' - '.html_print_image('images/config.png', true, ['float' => 'right'], false, false, true).' -
- -
'; - echo '
'; +echo $menu_form; +echo '
+
+ '.html_print_image('images/arrow_down_green.png', true, ['class' => 'module_graph_menu_arrow', 'float' => 'left'], false, false, true).' + '.__('Graph configuration menu').'
+ +
'; +echo ''; - // Hidden div to forced title - html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', 'hidden' => true]); - ?> +// Hidden div to forced title. +html_print_div( + [ + 'id' => 'forced_title_layer', + 'class' => 'forced_title_layer', + 'hidden' => true, + ] +); + +// Graph. +echo '
'; + +$height = 280; +$width = '90%'; + +$params = [ + 'period' => $period, + 'width' => $width, + 'height' => $height, + 'unit_name' => array_fill(0, count($interface_traffic_modules), $config['interface_unit']), + 'date' => $date, + 'homeurl' => $config['homeurl'], + 'percentil' => (($show_percentil) ? $config['percentil'] : null), + 'fullscale' => $fullscale, + 'zoom' => $zoom, +]; + +if (is_metaconsole()) { + $params['id_server'] = $server_id; +} + +if ($config['type_interface_charts'] == 'line') { + $stacked = CUSTOM_GRAPH_LINE; +} else { + $stacked = CUSTOM_GRAPH_AREA; +} + +$params_combined = [ + 'weight_list' => [], + 'projection' => false, + 'labels' => array_keys($interface_traffic_modules), + 'from_interface' => true, + 'modules_series' => array_values($interface_traffic_modules), + 'return' => 0, + 'stacked' => $stacked, +]; + +graphic_combined_module( + array_values($interface_traffic_modules), + $params, + $params_combined +); + +echo '
'; +?> - "; - echo '

'.__('The CSV export has been successful.').'

'; - echo ''; - // Module id + // Module id. $id = (int) get_parameter('id', 0); - // Agent id + // Agent id. $agent_id = (int) modules_get_agentmodule_agent($id); - if (empty($id) || empty($agent_id)) { - ui_print_error_message(__('There was a problem locating the source of the graph')); + if (empty($id) === true || empty($agent_id) === true) { + ui_print_error_message( + __('There was a problem locating the source of the graph') + ); exit; } - // ACL + // ACL. $all_groups = agents_get_all_groups_agent($agent_id); if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')) { include $config['homedir'].'/general/noaccess.php'; @@ -138,7 +154,9 @@ ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1. $fullscale_sent = get_parameter('fullscale_sent', 0); if (!$fullscale_sent) { - if (!isset($config['full_scale_option']) || $config['full_scale_option'] == 0) { + if (isset($config['full_scale_option']) === false + || $config['full_scale_option'] == 0 + ) { $fullscale = 0; } else if ($config['full_scale_option'] == 1) { $fullscale = 1; @@ -153,9 +171,6 @@ ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1. $fullscale = get_parameter('fullscale', 0); } - // To avoid the horizontal overflow - $width -= 20; - $time_compare = false; if ($time_compare_separated) { @@ -169,8 +184,8 @@ ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1. $width = ($width * ($zoom / 1.4)); } - // Build date - $date = strtotime("$start_date $start_time"); + // Build date. + $date = strtotime($start_date.' '.$start_time); $now = time(); if ($date > $now) { @@ -179,14 +194,222 @@ ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1. $urlImage = ui_get_full_url(false, false, false, false); - $unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $id); + $unit = db_get_value( + 'unit', + 'tagente_modulo', + 'id_agente_modulo', + $id + ); + // FORM TABLE. + $table = html_get_predefined_table('transparent', 2); + $table->width = '100%'; + $table->id = 'stat_win_form_div'; + $table->style[0] = 'text-align:left;'; + $table->style[1] = 'text-align:left;'; + $table->style[2] = 'text-align:left;font-weight: bold;'; + $table->style[3] = 'text-align:left;'; + $table->class = 'table_modal_alternate'; + + $table->data = []; + $table->data[0][0] = __('Refresh time'); + $table->data[0][1] = html_print_extended_select_for_time( + 'refresh', + $refresh, + '', + '', + 0, + 7, + true + ); + + $table->data[0][2] = __('Show events'); + $disabled = false; + if (isset($config['event_replication']) === true) { + if ($config['event_replication'] + && !$config['show_events_in_local'] + ) { + $disabled = true; + } + } + + $table->data[0][3] = html_print_checkbox_switch( + 'draw_events', + 1, + (bool) $draw_events, + true, + $disabled + ); + if ($disabled) { + $table->data[1] .= ui_print_help_tip( + __("'Show events' is disabled because this %s node is set to event replication.", get_product_name()), + true + ); + } + + $table->data[1][0] = __('Begin date'); + $table->data[1][1] = html_print_input_text( + 'start_date', + $start_date, + '', + 10, + 20, + true + ); + + $table->data[1][2] = __('Show alerts'); + $table->data[1][3] = html_print_checkbox_switch( + 'draw_alerts', + 1, + (bool) $draw_alerts, + true + ); + + $table->data[2][0] = __('Begin time'); + $table->data[2][1] = html_print_input_text( + 'start_time', + $start_time, + '', + 10, + 10, + true + ); + + $table->data[2][2] = __('Show unknown graph'); + $table->data[2][3] = html_print_checkbox_switch( + 'unknown_graph', + 1, + (bool) $unknown_graph, + true + ); + + $table->data[3][0] = __('Time range'); + $table->data[3][1] = html_print_extended_select_for_time( + 'period', + $period, + '', + '', + 0, + 7, + true + ); + + $table->data[3][2] = __('Show full scale graph (TIP)'); + $table->data[3][3] = html_print_checkbox_switch( + 'fullscale', + 1, + (bool) $fullscale, + true, + false + ); + + if (!modules_is_boolean($id)) { + $table->data[4][0] = __('Zoom'); + $options = []; + $options[$zoom] = 'x'.$zoom; + $options[1] = 'x1'; + $options[2] = 'x2'; + $options[3] = 'x3'; + $options[4] = 'x4'; + $options[5] = 'x5'; + $table->data[4][1] = html_print_select( + $options, + 'zoom', + $zoom, + '', + '', + 0, + true, + false, + false + ); + + $table->data[4][2] = __('Show percentil'); + $table->data[4][3] = html_print_checkbox_switch( + 'show_percentil', + 1, + (bool) $show_percentil, + true + ); + } + + $table->data[5][0] = __('Time compare (Overlapped)'); + $table->data[5][1] = html_print_checkbox_switch( + 'time_compare_overlapped', + 1, + (bool) $time_compare_overlapped, + true + ); + + $table->data[5][2] = __('Time compare (Separated)'); + $table->data[5][3] = html_print_checkbox_switch( + 'time_compare_separated', + 1, + (bool) $time_compare_separated, + true + ); + + $form_table = html_print_table($table, true); + $form_table .= '
'; + $form_table .= html_print_submit_button( + __('Reload'), + 'submit', + false, + 'class="sub upd"', + true + ); + $form_table .= '
'; + + // Menu. + $menu_form = "
"; + $menu_form .= html_print_input_hidden('id', $id, true); + $menu_form .= html_print_input_hidden('label', $label, true); + + if (empty($server_id) === false) { + $menu_form .= html_print_input_hidden('server', $server_id, true); + } + + if (isset($_GET['type']) === true) { + $type = get_parameter_get('type'); + $menu_form .= html_print_input_hidden('type', $type, true); + } + + $menu_form .= '
'; + $menu_form .= '
'; + $menu_form .= html_print_image( + 'images/arrow_down_green.png', + true, + [ + 'class' => 'module_graph_menu_arrow', + 'float' => 'left', + ], + false, + false, + true + ); + $menu_form .= ''; + $menu_form .= __('Graph configuration menu'); + $menu_form .= ''; + $menu_form .= '
'; + $menu_form .= ''; + $menu_form .= '
'; + $menu_form .= '
'; + + echo $menu_form; + + // Hidden div to forced title. + html_print_div( + [ + 'id' => 'forced_title_layer', + 'class' => 'forced_title_layer', + 'hidden' => true, + ] + ); // Graph. - echo '
'; - $width = '90%'; - $height = '450'; - + $output = '
'; switch ($graph_type) { case 'boolean': case 'sparse': @@ -209,12 +432,14 @@ ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1. 'type_graph' => $config['type_module_charts'], 'fullscale' => $fullscale, 'zoom' => $zoom, + 'height' => 300, ]; - echo grafico_modulo_sparse($params); - echo '
'; + $output .= grafico_modulo_sparse($params); + $output .= '
'; if ($show_events_graph) { $width = '500'; - echo graphic_module_events( + $height = '450'; + $output .= graphic_module_events( $id, $width, $height, @@ -229,200 +454,12 @@ ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1. break; default: - echo fs_error_image('../images'); + $output .= fs_error_image('../images'); break; } - echo '
'; - - - - // FORM TABLE. - $table = html_get_predefined_table('transparent', 2); - $table->width = '100%'; - $table->id = 'stat_win_form_div'; - $table->style[0] = 'text-align:left;'; - $table->style[1] = 'text-align:left;'; - $table->styleTable = 'margin-bottom: 20px;'; - $table->class = 'table_modal_alternate'; - - $data = []; - $data[0] = __('Refresh time'); - $data[1] = html_print_extended_select_for_time( - 'refresh', - $refresh, - '', - '', - 0, - 7, - true - ); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Begin date'); - $data[1] = html_print_input_text('start_date', $start_date, '', 10, 20, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Begin time'); - $data[1] = html_print_input_text('start_time', $start_time, '', 10, 10, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - if (!modules_is_boolean($id)) { - $data = []; - $data[0] = __('Zoom'); - $options = []; - $options[$zoom] = 'x'.$zoom; - $options[1] = 'x1'; - $options[2] = 'x2'; - $options[3] = 'x3'; - $options[4] = 'x4'; - $options[5] = 'x5'; - $data[1] = html_print_select($options, 'zoom', $zoom, '', '', 0, true, false, false); - $table->data[] = $data; - $table->rowclass[] = ''; - } - - $data = []; - $data[0] = __('Time range'); - $data[1] = html_print_extended_select_for_time( - 'period', - $period, - '', - '', - 0, - 7, - true - ); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Show events'); - $disabled = false; - if (isset($config['event_replication'])) { - if ($config['event_replication'] && !$config['show_events_in_local']) { - $disabled = true; - } - } - - $data[1] = html_print_checkbox_switch( - 'draw_events', - 1, - (bool) $draw_events, - true, - $disabled - ); - if ($disabled) { - $data[1] .= ui_print_help_tip( - __("'Show events' is disabled because this %s node is set to event replication.", get_product_name()), - true - ); - } - - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Show alerts'); - $data[1] = html_print_checkbox_switch('draw_alerts', 1, (bool) $draw_alerts, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - /* - $data = array(); - $data[0] = __('Show event graph'); - $data[1] = html_print_checkbox_switch ("show_events_graph", 1, (bool) $show_events_graph, true); - $table->data[] = $data; - $table->rowclass[] = ''; - */ - - switch ($graph_type) { - case 'boolean': - case 'sparse': - $data = []; - $data[0] = __('Show percentil'); - $data[1] = html_print_checkbox_switch('show_percentil', 1, (bool) $show_percentil, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Time compare (Overlapped)'); - $data[1] = html_print_checkbox_switch('time_compare_overlapped', 1, (bool) $time_compare_overlapped, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Time compare (Separated)'); - $data[1] = html_print_checkbox_switch('time_compare_separated', 1, (bool) $time_compare_separated, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Show unknown graph'); - $data[1] = html_print_checkbox_switch('unknown_graph', 1, (bool) $unknown_graph, true); - $table->data[] = $data; - $table->rowclass[] = ''; - break; - } - - $data = []; - $data[0] = __('Show full scale graph (TIP)'); - $data[1] = html_print_checkbox_switch( - 'fullscale', - 1, - (bool) $fullscale, - true, - false - ); - $table->data[] = $data; - $table->rowclass[] = ''; - - $form_table = html_print_table($table, true); - $form_table .= '
'.html_print_submit_button( - __('Reload'), - 'submit', - false, - 'class="sub upd"', - true - ).'
'; - - - // Menu. - $menu_form = "
".html_print_input_hidden('id', $id, true).html_print_input_hidden('label', $label, true); - - if (!empty($server_id)) { - $menu_form .= html_print_input_hidden('server', $server_id, true); - } - - if (isset($_GET['type'])) { - $type = get_parameter_get('type'); - $menu_form .= html_print_input_hidden('type', $type, true); - } - - echo $menu_form; - echo '
-
- '.html_print_image('images/arrow_down_green.png', true, ['class' => 'module_graph_menu_arrow', 'float' => 'left'], false, false, true).' - '.__('Graph configuration menu').' - '.html_print_image('images/config.png', true, ['float' => 'right'], false, false, true).' -
- -
'; - echo '
'; - - // Hidden div to forced title - html_print_div( - [ - 'id' => 'forced_title_layer', - 'class' => 'forced_title_layer', - 'hidden' => true, - ] - ); + $output .= '
'; + echo $output; ?> @@ -430,9 +467,14 @@ ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1. @@ -460,21 +502,26 @@ ui_include_time_picker(true); closeText: '' }); - $.datepicker.setDefaults($.datepicker.regional[""]); + $.datepicker.setDefaults( + $.datepicker.regional[""] + ); // Menu. $('#module_graph_menu_header').on('click', function(){ var arrow = $('#module_graph_menu_header .module_graph_menu_arrow'); var arrow_up = 'arrow_up_green'; var arrow_down = 'arrow_down_green'; - if( $('.module_graph_menu_content').hasClass('module_graph_menu_content_closed')){ + if( $('.module_graph_menu_content').hasClass( + 'module_graph_menu_content_closed')){ $('.module_graph_menu_content').show(); - $('.module_graph_menu_content').removeClass('module_graph_menu_content_closed'); + $('.module_graph_menu_content').removeClass( + 'module_graph_menu_content_closed'); arrow.attr('src',arrow.attr('src').replace(arrow_down, arrow_up)); } else{ $('.module_graph_menu_content').hide(); - $('.module_graph_menu_content').addClass('module_graph_menu_content_closed'); + $('.module_graph_menu_content').addClass( + 'module_graph_menu_content_closed'); arrow.attr('src',arrow.attr('src').replace(arrow_up, arrow_down)); } }); diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 16c6223041..a49db7b7f4 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -1545,7 +1545,7 @@ if (!empty($result)) { $graph_params_str = http_build_query($graph_params); - $link = 'winopeng_var(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\', 1000, 700)'; + $link = 'winopeng_var(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\', 800, 480)'; $data[8] = get_module_realtime_link_graph($row);