#9814 projection graphs - module view & dashboard
This commit is contained in:
parent
5c8789af94
commit
1e22d473e6
|
@ -1486,6 +1486,31 @@ if (check_login()) {
|
|||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
if ($params['enable_projected_period'] === '1') {
|
||||
$params_graphic = [
|
||||
'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 .= $return['chart'];
|
||||
$output .= '</div>';
|
||||
} else {
|
||||
if ($params['histogram'] === true) {
|
||||
$params['id_agent_module'] = $params['agent_module_id'];
|
||||
$params['dinamic_proc'] = 1;
|
||||
|
@ -1508,6 +1533,7 @@ if (check_login()) {
|
|||
} else {
|
||||
$output .= grafico_modulo_sparse($params);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true && empty($server_id) === false) {
|
||||
metaconsole_restore_db();
|
||||
|
|
|
@ -1549,3 +1549,12 @@ function type_change() {
|
|||
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'];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -376,6 +411,8 @@ class SingleGraphWidget extends Widget
|
|||
$values['moduleId'] = \get_parameter('moduleId', 0);
|
||||
$values['period'] = \get_parameter('period', 0);
|
||||
$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;
|
||||
}
|
||||
|
@ -405,6 +442,29 @@ class SingleGraphWidget extends Widget
|
|||
$trickHight = 40;
|
||||
}
|
||||
|
||||
$output = '<div class="container-center widget-mrgn-0px">';
|
||||
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%',
|
||||
|
@ -419,9 +479,9 @@ class SingleGraphWidget extends Widget
|
|||
'menu' => false,
|
||||
'dashboard' => true,
|
||||
];
|
||||
|
||||
$output = '<div class="container-center widget-mrgn-0px">';
|
||||
$output .= \grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
}
|
||||
|
|
|
@ -197,6 +197,8 @@ ui_print_message_dialog(
|
|||
$time_compare_overlapped = get_parameter('time_compare_overlapped', 0);
|
||||
$unknown_graph = get_parameter_checkbox('unknown_graph', 1);
|
||||
$histogram = (bool) get_parameter('histogram', 0);
|
||||
$enable_projected_period = get_parameter('enable_projected_period', 0);
|
||||
$period_projected = get_parameter('period_projected', 300);
|
||||
|
||||
// FORM TABLE.
|
||||
$table = html_get_predefined_table('transparent', 2);
|
||||
|
@ -406,12 +408,35 @@ ui_print_message_dialog(
|
|||
true
|
||||
);
|
||||
$table->data[6][3] = html_print_checkbox_switch(
|
||||
'fullscale',
|
||||
'fullscalee',
|
||||
1,
|
||||
(bool) $fullscale,
|
||||
true,
|
||||
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 {
|
||||
$table->data[0][0] = __('Begin date');
|
||||
$table->data[0][1] = html_print_input_text(
|
||||
|
@ -535,6 +560,8 @@ ui_print_message_dialog(
|
|||
'type_mode_graph' => $type_mode_graph,
|
||||
'histogram' => $histogram,
|
||||
'begin_date' => strtotime($start_date.' '.$start_time),
|
||||
'enable_projected_period' => $enable_projected_period,
|
||||
'period_projected' => $period_projected,
|
||||
];
|
||||
|
||||
// Graph.
|
||||
|
|
Loading…
Reference in New Issue