diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index d81e2bc1d6..4dbfa743bd 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -5614,6 +5614,24 @@ function draw_form_stat_win(array $form_data, string $tab_active) false, false ).''; + + $table->data[7][0] = __('Type graph'); + $table->data[7][1] = '
'.html_print_select( + [ + 'tabs-chart-module-graph' => __('Module Graph'), + 'tabs-chart-period-graph' => __('Sliced'), + ], + 'graph_tab', + $form_data['graph_tab'], + '', + '', + 0, + true, + false, + false + ).'
'; + $table->data[7][2] = ''; + $table->data[7][3] = ''; } } else { $table->data[0][0] = __('Refresh time'); @@ -5786,6 +5804,22 @@ function draw_form_stat_win(array $form_data, string $tab_active) 7, true ).''; + + $table->data[8][0] = __('Type graph'); + $table->data[8][1] = '
'.html_print_select( + [ + 'tabs-chart-module-graph' => __('Module Graph'), + 'tabs-chart-period-graph' => __('Sliced'), + ], + 'graph_tab', + $form_data['graph_tab'], + '', + '', + 0, + true, + false, + false + ).'
'; } $form_table = html_print_table($table, true); diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index e945797529..a944588040 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -209,6 +209,8 @@ ui_print_message_dialog( $period_slice_chart = get_parameter('period_slice_chart', SECONDS_1HOUR); $period_mode = get_parameter('period_mode', CUSTOM_GRAPH_VBARS); + $graph_tab = get_parameter('graph_tab', 'tabs-chart-module-graph'); + $time_compare = false; if ($time_compare_separated) { @@ -297,6 +299,7 @@ ui_print_message_dialog( 'period_summatory' => $period_summatory, 'period_slice_chart' => $period_slice_chart, 'period_mode' => $period_mode, + 'graph_tab' => $graph_tab, ]; $params = [ @@ -329,47 +332,14 @@ ui_print_message_dialog( 'period_summatory' => $period_summatory, 'period_slice_chart' => $period_slice_chart, 'period_mode' => $period_mode, + 'graph_tab' => $graph_tab, ]; if ($histogram === false) { - $output = '
'; - $output .= ''; - - $output .= '
'; - $output .= draw_container_chart_stat_win('tabs-chart-module-graph'); + $output = '
'; + $output .= '
'; + $output .= draw_container_chart_stat_win($graph_tab); $output .= '
'; - - $output .= '
'; - $output .= draw_container_chart_stat_win('tabs-chart-period-graph'); - $output .= '
'; - $output .= '
'; } else { // Graph. @@ -408,18 +378,8 @@ ui_include_time_picker(true); var histogram = ""; var period_graph = ""; if(histogram == 0) { - $("#tabs-chart-modal").tabs({ - create: function( event, ui ) { - var tab_active = ui.tab.children(":first").attr('id'); - get_ajax_module(url, graph_data, form_data, serverId, tab_active); - }, - activate: function( event, ui ) { - var tab_active = ui.newTab.children(":first").attr('id'); - change_tabs_periodicity(tab_active); - get_ajax_module(url, graph_data, form_data, serverId, tab_active); - }, - active: period_graph - }); + var tab_active = ''; + get_ajax_module(url, graph_data, form_data, serverId, tab_active); } else { get_ajax_module(url, graph_data, form_data, serverId, null); } @@ -443,7 +403,7 @@ ui_include_time_picker(true); function get_ajax_module(url, graph_data, form_data, serverId, id) { let active = 'stat-win-module-graph'; if(id != null) { - active = $("#"+id).parent().attr('aria-controls'); + active = id; } $("#tabs-chart-module-graph-content").empty(); $("#tabs-chart-period-graph-content").empty(); @@ -463,6 +423,20 @@ ui_include_time_picker(true); success: function (data) { $("#"+active+"-spinner").hide(); $("#"+active+"-content").append(data); + if (active === 'tabs-chart-module-graph' || active === 'tabs-chart-period-graph') { + let margin = 100; + if (navigator.userAgent.indexOf("Chrome") != -1) { + margin = 100; + } else if (navigator.userAgent.indexOf("Firefox") != -1) { + margin = 50; + } + + var browserZoomLevel = (Math.round(window.devicePixelRatio * 100)/100); + let height = ($('#chart-modal').height() + margin) * browserZoomLevel; + let width = 800 * browserZoomLevel; + window.resizeTo(width, height); + } + let pg = 0; if (active === 'tabs-chart-period-graph') { pg = 1;