Merge branch 'ent-9814-nuego-item-graficas-de-capacity-planning-en-dashboard' into 'develop'
Ent 9814 nuego item graficas de capacity planning en dashboard See merge request artica/pandorafms!6382
This commit is contained in:
commit
96c722b816
|
@ -1486,27 +1486,53 @@ if (check_login()) {
|
||||||
metaconsole_connect($server);
|
metaconsole_connect($server);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($params['histogram'] === true) {
|
if ($params['enable_projected_period'] === '1') {
|
||||||
$params['id_agent_module'] = $params['agent_module_id'];
|
$params_graphic = [
|
||||||
$params['dinamic_proc'] = 1;
|
'period' => $params['period'],
|
||||||
|
'date' => strtotime(date('Y-m-d H:i:s')),
|
||||||
|
'only_image' => false,
|
||||||
|
'homeurl' => ui_get_full_url(false, false, false, false).'/',
|
||||||
|
'ttl' => false,
|
||||||
|
'height' => $config['graph_image_height'],
|
||||||
|
'landscape' => $content['landscape'],
|
||||||
|
'return_img_base_64' => true,
|
||||||
|
];
|
||||||
|
|
||||||
|
$params_combined = [
|
||||||
|
'projection' => $params['period_projected'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$return['chart'] = graphic_combined_module(
|
||||||
|
[$params['agent_module_id']],
|
||||||
|
$params_graphic,
|
||||||
|
$params_combined
|
||||||
|
);
|
||||||
$output .= '<div class="stat_win_histogram">';
|
$output .= '<div class="stat_win_histogram">';
|
||||||
if ($params['compare'] === 'separated') {
|
$output .= $return['chart'];
|
||||||
|
$output .= '</div>';
|
||||||
|
} else {
|
||||||
|
if ($params['histogram'] === true) {
|
||||||
|
$params['id_agent_module'] = $params['agent_module_id'];
|
||||||
|
$params['dinamic_proc'] = 1;
|
||||||
|
|
||||||
|
$output .= '<div class="stat_win_histogram">';
|
||||||
|
if ($params['compare'] === 'separated') {
|
||||||
|
$graph = \reporting_module_histogram_graph(
|
||||||
|
['datetime' => ($params['begin_date'] - $params['period'])],
|
||||||
|
$params
|
||||||
|
);
|
||||||
|
$output .= $graph['chart'];
|
||||||
|
}
|
||||||
|
|
||||||
$graph = \reporting_module_histogram_graph(
|
$graph = \reporting_module_histogram_graph(
|
||||||
['datetime' => ($params['begin_date'] - $params['period'])],
|
['datetime' => $params['begin_date']],
|
||||||
$params
|
$params
|
||||||
);
|
);
|
||||||
$output .= $graph['chart'];
|
$output .= $graph['chart'];
|
||||||
|
$output .= '</div>';
|
||||||
|
} else {
|
||||||
|
$output .= grafico_modulo_sparse($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
$graph = \reporting_module_histogram_graph(
|
|
||||||
['datetime' => $params['begin_date']],
|
|
||||||
$params
|
|
||||||
);
|
|
||||||
$output .= $graph['chart'];
|
|
||||||
$output .= '</div>';
|
|
||||||
} else {
|
|
||||||
$output .= grafico_modulo_sparse($params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_metaconsole() === true && empty($server_id) === false) {
|
if (is_metaconsole() === true && empty($server_id) === false) {
|
||||||
|
|
|
@ -1613,3 +1613,12 @@ function type_change() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show/Hide period for projection on agent module graph.
|
||||||
|
function show_projection_period() {
|
||||||
|
if ($("#projection_switch").is(":checked")) {
|
||||||
|
$("#div_projection_period").show();
|
||||||
|
} else {
|
||||||
|
$("#div_projection_period").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -269,6 +269,14 @@ class SingleGraphWidget extends Widget
|
||||||
$values['showLegend'] = $decoder['showLegend'];
|
$values['showLegend'] = $decoder['showLegend'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['projection_switch']) === true) {
|
||||||
|
$values['projection_switch'] = $decoder['projection_switch'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['period_projection']) === true) {
|
||||||
|
$values['period_projection'] = $decoder['period_projection'];
|
||||||
|
}
|
||||||
|
|
||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,6 +365,33 @@ class SingleGraphWidget extends Widget
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Projection.
|
||||||
|
$inputs[] = [
|
||||||
|
'label' => __('Projection Graph'),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'projection_switch',
|
||||||
|
'id' => 'projection_switch',
|
||||||
|
'type' => 'switch',
|
||||||
|
'value' => $values['projection_switch'],
|
||||||
|
'onclick' => 'show_projection_period()',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Period Projection.
|
||||||
|
$display_projection = ($values['projection_switch'] === true) ? '' : 'display:none';
|
||||||
|
$inputs[] = [
|
||||||
|
'label' => __('Period Projection'),
|
||||||
|
'id' => 'div_projection_period',
|
||||||
|
'style' => $display_projection,
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'period_projection',
|
||||||
|
'type' => 'interval',
|
||||||
|
'value' => $values['period_projection'],
|
||||||
|
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||||
|
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
return $inputs;
|
return $inputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,6 +411,8 @@ class SingleGraphWidget extends Widget
|
||||||
$values['moduleId'] = \get_parameter('moduleId', 0);
|
$values['moduleId'] = \get_parameter('moduleId', 0);
|
||||||
$values['period'] = \get_parameter('period', 0);
|
$values['period'] = \get_parameter('period', 0);
|
||||||
$values['showLegend'] = \get_parameter_switch('showLegend');
|
$values['showLegend'] = \get_parameter_switch('showLegend');
|
||||||
|
$values['projection_switch'] = (boolean) get_parameter_switch('projection_switch');
|
||||||
|
$values['period_projection'] = \get_parameter('period_projection', 0);
|
||||||
|
|
||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
@ -405,23 +442,46 @@ class SingleGraphWidget extends Widget
|
||||||
$trickHight = 40;
|
$trickHight = 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = [
|
|
||||||
'agent_module_id' => $this->values['moduleId'],
|
|
||||||
'width' => '100%',
|
|
||||||
'height' => ((int) $size['height'] - $trickHight),
|
|
||||||
'period' => $this->values['period'],
|
|
||||||
'title' => $module_name,
|
|
||||||
'unit' => $units_name,
|
|
||||||
'homeurl' => $config['homeurl'],
|
|
||||||
'backgroundColor' => 'transparent',
|
|
||||||
'show_legend' => $this->values['showLegend'],
|
|
||||||
'show_title' => $module_name,
|
|
||||||
'menu' => false,
|
|
||||||
'dashboard' => true,
|
|
||||||
];
|
|
||||||
|
|
||||||
$output = '<div class="container-center widget-mrgn-0px">';
|
$output = '<div class="container-center widget-mrgn-0px">';
|
||||||
$output .= \grafico_modulo_sparse($params);
|
if ($this->values['projection_switch'] === true) {
|
||||||
|
$params_graphic = [
|
||||||
|
'period' => $this->values['period'],
|
||||||
|
'date' => strtotime(date('Y-m-d H:i:s')),
|
||||||
|
'only_image' => false,
|
||||||
|
'homeurl' => ui_get_full_url(false, false, false, false).'/',
|
||||||
|
'height' => ((int) $size['height'] - $trickHight),
|
||||||
|
'landscape' => $content['landscape'],
|
||||||
|
'return_img_base_64' => true,
|
||||||
|
];
|
||||||
|
|
||||||
|
$params_combined = [
|
||||||
|
'projection' => $this->values['period_projection'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$return['chart'] = graphic_combined_module(
|
||||||
|
[$this->values['moduleId']],
|
||||||
|
$params_graphic,
|
||||||
|
$params_combined
|
||||||
|
);
|
||||||
|
$output .= $return['chart'];
|
||||||
|
} else {
|
||||||
|
$params = [
|
||||||
|
'agent_module_id' => $this->values['moduleId'],
|
||||||
|
'width' => '100%',
|
||||||
|
'height' => ((int) $size['height'] - $trickHight),
|
||||||
|
'period' => $this->values['period'],
|
||||||
|
'title' => $module_name,
|
||||||
|
'unit' => $units_name,
|
||||||
|
'homeurl' => $config['homeurl'],
|
||||||
|
'backgroundColor' => 'transparent',
|
||||||
|
'show_legend' => $this->values['showLegend'],
|
||||||
|
'show_title' => $module_name,
|
||||||
|
'menu' => false,
|
||||||
|
'dashboard' => true,
|
||||||
|
];
|
||||||
|
$output .= \grafico_modulo_sparse($params);
|
||||||
|
}
|
||||||
|
|
||||||
$output .= '</div>';
|
$output .= '</div>';
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,6 +197,8 @@ ui_print_message_dialog(
|
||||||
$time_compare_overlapped = get_parameter('time_compare_overlapped', 0);
|
$time_compare_overlapped = get_parameter('time_compare_overlapped', 0);
|
||||||
$unknown_graph = get_parameter_checkbox('unknown_graph', 1);
|
$unknown_graph = get_parameter_checkbox('unknown_graph', 1);
|
||||||
$histogram = (bool) get_parameter('histogram', 0);
|
$histogram = (bool) get_parameter('histogram', 0);
|
||||||
|
$enable_projected_period = get_parameter('enable_projected_period', 0);
|
||||||
|
$period_projected = get_parameter('period_projected', 300);
|
||||||
|
|
||||||
// FORM TABLE.
|
// FORM TABLE.
|
||||||
$table = html_get_predefined_table('transparent', 2);
|
$table = html_get_predefined_table('transparent', 2);
|
||||||
|
@ -406,12 +408,35 @@ ui_print_message_dialog(
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$table->data[6][3] = html_print_checkbox_switch(
|
$table->data[6][3] = html_print_checkbox_switch(
|
||||||
'fullscale',
|
'fullscalee',
|
||||||
1,
|
1,
|
||||||
(bool) $fullscale,
|
(bool) $fullscale,
|
||||||
true,
|
true,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$table->data[7][0] = __('Projection graph');
|
||||||
|
$table->data[7][0] .= ui_print_help_tip(
|
||||||
|
__('Projection graph take as begin date the current time'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->data[7][1] = html_print_checkbox_switch(
|
||||||
|
'enable_projected_period',
|
||||||
|
1,
|
||||||
|
(bool) $enable_projected_period,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[7][2] = __('Projection period');
|
||||||
|
$table->data[7][3] = '<div class="small-input-select2">'.html_print_extended_select_for_time(
|
||||||
|
'period_projected',
|
||||||
|
$period_projected,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
7,
|
||||||
|
true
|
||||||
|
).'</div>';
|
||||||
} else {
|
} else {
|
||||||
$table->data[0][0] = __('Begin date');
|
$table->data[0][0] = __('Begin date');
|
||||||
$table->data[0][1] = html_print_input_text(
|
$table->data[0][1] = html_print_input_text(
|
||||||
|
@ -514,27 +539,29 @@ ui_print_message_dialog(
|
||||||
);
|
);
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
'agent_module_id' => $id,
|
'agent_module_id' => $id,
|
||||||
'period' => $period,
|
'period' => $period,
|
||||||
'show_events' => $draw_events,
|
'show_events' => $draw_events,
|
||||||
'title' => $label,
|
'title' => $label,
|
||||||
'unit_name' => $unit,
|
'unit_name' => $unit,
|
||||||
'show_alerts' => $draw_alerts,
|
'show_alerts' => $draw_alerts,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'unit' => $unit,
|
'unit' => $unit,
|
||||||
'baseline' => $baseline,
|
'baseline' => $baseline,
|
||||||
'homeurl' => $urlImage,
|
'homeurl' => $urlImage,
|
||||||
'adapt_key' => 'adapter_'.$graph_type,
|
'adapt_key' => 'adapter_'.$graph_type,
|
||||||
'compare' => $time_compare,
|
'compare' => $time_compare,
|
||||||
'show_unknown' => $unknown_graph,
|
'show_unknown' => $unknown_graph,
|
||||||
'percentil' => (($show_percentil) ? $config['percentil'] : null),
|
'percentil' => (($show_percentil) ? $config['percentil'] : null),
|
||||||
'type_graph' => $config['type_module_charts'],
|
'type_graph' => $config['type_module_charts'],
|
||||||
'fullscale' => $fullscale,
|
'fullscale' => $fullscale,
|
||||||
'zoom' => $zoom,
|
'zoom' => $zoom,
|
||||||
'height' => 300,
|
'height' => 300,
|
||||||
'type_mode_graph' => $type_mode_graph,
|
'type_mode_graph' => $type_mode_graph,
|
||||||
'histogram' => $histogram,
|
'histogram' => $histogram,
|
||||||
'begin_date' => strtotime($start_date.' '.$start_time),
|
'begin_date' => strtotime($start_date.' '.$start_time),
|
||||||
|
'enable_projected_period' => $enable_projected_period,
|
||||||
|
'period_projected' => $period_projected,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Graph.
|
// Graph.
|
||||||
|
|
Loading…
Reference in New Issue