Merge branch '1163-Anadir_TIP_y_AVG_para_graficas_de_tipo_CUSTOM_GRAPH_en_GRAPH_CONTAINER' into 'develop'

add fullscale container graph

See merge request artica/pandorafms!1221
This commit is contained in:
vgilc 2018-01-03 16:06:21 +01:00
commit 7f6994bf8e
7 changed files with 90 additions and 18 deletions

View File

@ -7,6 +7,8 @@ UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max
ALTER TABLE tgraph ADD COLUMN `fullscale` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE tcontainer_item ADD COLUMN `fullscale` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE treport_content ADD COLUMN hide_no_data tinyint(1) DEFAULT 0;
COMMIT;

View File

@ -1408,6 +1408,7 @@ CREATE TABLE IF NOT EXISTS `tcontainer_item` (
`agent` varchar(100) NOT NULL default '',
`module` varchar(100) NOT NULL default '',
`id_tag` integer(10) unsigned NOT NULL DEFAULT 0,
`fullscale` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id_ci`),
FOREIGN KEY (`id_container`) REFERENCES tcontainer(`id_container`)
ON DELETE CASCADE

View File

@ -42,19 +42,30 @@ if (is_ajax()){
$id_agent_module = get_parameter('id_agent_module');
$time_lapse = get_parameter('time_lapse');
$only_avg = get_parameter('only_avg');
$fullscale = get_parameter('fullscale');
if($only_avg != 'false'){
$only_avg = 1;
}
else{
$only_avg = 0;
}
if($fullscale != 'false'){
$fullscale = 1;
}
else{
$fullscale = 0;
}
$values = array(
'id_container' => $id_container2,
'type' => "simple_graph",
'id_agent' => $id_agent,
'id_agent_module' => $id_agent_module,
'time_lapse' => $time_lapse,
'only_average' => $only_avg);
'only_average' => $only_avg,
'fullscale' => $fullscale
);
$id_item = db_process_sql_insert('tcontainer_item', $values);
return;
@ -63,12 +74,21 @@ if (is_ajax()){
if($add_custom){
$time_lapse = get_parameter('time_lapse');
$id_custom = get_parameter('id_custom');
$fullscale = get_parameter('fullscale');
if($fullscale != 'false'){
$fullscale = 1;
}
else{
$fullscale = 0;
}
$values = array(
'id_container' => $id_container2,
'type' => "custom_graph",
'time_lapse' => $time_lapse,
'id_graph' => $id_custom);
'id_graph' => $id_custom,
'fullscale' => $fullscale,
);
$id_item = db_process_sql_insert('tcontainer_item', $values);
return;
@ -88,6 +108,15 @@ if (is_ajax()){
else{
$only_avg = 0;
}
$fullscale = get_parameter('fullscale');
if($fullscale != 'false'){
$fullscale = 1;
}
else{
$fullscale = 0;
}
$values = array(
'id_container' => $id_container2,
'type' => "dynamic_graph",
@ -97,7 +126,9 @@ if (is_ajax()){
'agent' => $agent_alias,
'module' => $module_name,
'id_tag' => $tag,
'only_average' => $only_avg);
'only_average' => $only_avg,
'fullscale' => $fullscale
);
$id_item = db_process_sql_insert('tcontainer_item', $values);
return;
}
@ -270,7 +301,7 @@ if($edit_container){
$single_table = "<table width='100%' cellpadding=4 cellspacing=4>";
$single_table .= "<tr id='row_time_lapse' style='' class='datos'>";
$single_table .= "<td style='font-weight:bold;width: 12%;'>";
$single_table .= "<td style='font-weight:bold;width: 13%;'>";
$single_table .= __('Time lapse');
$single_table .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '),true);
$single_table .= "</td>";
@ -328,6 +359,14 @@ if($edit_container){
$single_table .= html_print_checkbox('only_avg', 1, true,true);
$single_table .= "</td>";
$single_table .= "</tr>";
$single_table .= "<tr id='row_fullscale' style='' class='datos'>";
$single_table .= "<td style='font-weight:bold;'>";
$single_table .= __('Show full scale graph (TIP)') . ui_print_help_tip('This option may cause performance issues', true);
$single_table .= "</td>";
$single_table .= "<td>";
$single_table .= html_print_checkbox('fullscale', 1, false,true);
$single_table .= "</td>";
$single_table .= "</tr>";
$single_table .= "<tr>";
$single_table .= "<td >";
$single_table .= "</td>";
@ -353,7 +392,7 @@ if($edit_container){
$table->class = 'dat';
$table->styleTable = 'font-weight: bold;';
$table->style[0] = 'width: 12%';
$table->style[0] = 'width: 13%';
$table->data = array();
$data = array();
@ -377,6 +416,13 @@ if($edit_container){
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = __('Show full scale graph (TIP)') .
ui_print_help_tip('This option may cause performance issues', true);
$data[1] = html_print_checkbox('fullscale_2', 1, false,true);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = "";
$data[1] = "<input style='float:right;' type=submit name='add_custom' class='sub add' value='".__('Add item')."'>";
@ -401,7 +447,7 @@ if($edit_container){
$table->class = 'dat';
$table->styleTable = 'font-weight: bold;';
$table->style[0] = 'width: 12%';
$table->style[0] = 'width: 13%';
$table->data = array();
$data = array();
@ -450,7 +496,14 @@ if($edit_container){
$data[1] = html_print_checkbox('only_avg_2', 1, false,true);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = __('Show full scale graph (TIP)') .
ui_print_help_tip('This option may cause performance issues', true);
$data[1] = html_print_checkbox('fullscale_3', 1, false,true);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = "";
$data[1] = "<input style='float:right;' type=submit name='add_dynamic' class='sub add' value='".__('Add item')."'>";
@ -561,6 +614,7 @@ echo html_print_input_hidden('id_agent', 0);
var id_agent = $("#hidden-id_agent").attr('value');
var time_lapse = $("#hidden-period_single").attr('value');
var only_avg = $("#checkbox-only_avg").prop("checked");
var fullscale = $("#checkbox-fullscale").prop("checked");
var id_container = <?php echo $id_container; ?>;
jQuery.post ("ajax.php",
{"page" : "godmode/reporting/create_container",
@ -569,6 +623,7 @@ echo html_print_input_hidden('id_agent', 0);
"id_agent_module" : id_agent_module,
"time_lapse" : time_lapse,
"only_avg" : only_avg,
"fullscale" : fullscale,
"id_container" : id_container,
},
function (data, status) {
@ -580,9 +635,9 @@ echo html_print_input_hidden('id_agent', 0);
}
});
$("input[name=add_custom]").click (function () {
var id_custom = $("#id_custom_graph").val();
var fullscale = $("#checkbox-fullscale_2").prop("checked");
if (id_custom !== '0'){
var time_lapse = $("#hidden-period_custom").attr('value');
var id_container = <?php echo $id_container; ?>;
@ -592,6 +647,7 @@ echo html_print_input_hidden('id_agent', 0);
"time_lapse" : time_lapse,
"id_custom" : id_custom,
"id_container" : id_container,
"fullscale" : fullscale,
},
function (data, status) {
var url = location.href.replace('&update_container=1', "");
@ -611,6 +667,7 @@ echo html_print_input_hidden('id_agent', 0);
var tag = $("#tag").val();
var only_avg = $("#checkbox-only_avg_2").prop("checked");
var id_container = <?php echo $id_container; ?>;
var fullscale = $("#checkbox-fullscale_3").prop("checked");
jQuery.post ("ajax.php",
{"page" : "godmode/reporting/create_container",
"add_dynamic" : 1,
@ -622,6 +679,7 @@ echo html_print_input_hidden('id_agent', 0);
"tag" : tag,
"id_container" : id_container,
"only_avg" : only_avg,
"fullscale" : fullscale,
},
function (data, status) {
var url = location.href.replace('&update_container=1', "");

View File

@ -123,13 +123,12 @@ if($report_r && $report_w){
if(e.which == 13) {
var time = $('input[id *= hidden-period_container_'+hash+']').val();
get_graphs_container(id_container,hash,time);
}
}
});
}
});
}
$(document).ready (function () {
$('a[id *= tgl]').click(function(e) {
var id = e.currentTarget.id;

View File

@ -31,9 +31,10 @@ if ($save_custom_graph) {
$height = get_parameter('height', 0);
$events = get_parameter('events', 0);
$period = get_parameter('period', 0);
$fullscale = get_parameter('fullscale', 0);
$result = (bool)custom_graphs_create($id_modules, $name,
$description, $stacked, $width, $height, $events, $period);
$description, $stacked, $width, $height, $events, $period, 0, 0, false, $fullscale);
$return['correct'] = $result;
@ -64,6 +65,7 @@ if ($print_custom_graph) {
$ttl = (int) get_parameter('ttl', 1);
$dashboard = (bool) get_parameter('dashboard');
$vconsole = (bool) get_parameter('vconsole');
$fullscale = (bool) get_parameter('fullscale');
echo custom_graphs_print($id_graph, $height, $width, $period, $stacked,
true, $date, $only_image, $background_color, $modules_param,
@ -103,13 +105,14 @@ if ($print_sparse_graph) {
$dashboard = (bool) get_parameter('dashboard');
$vconsole = (bool) get_parameter('vconsole');
$type_g = get_parameter('type_g', $config['type_module_charts']);
$fullscale = get_parameter('fullscale', 0);
echo grafico_modulo_sparse($agent_module_id, $period, $show_events,
$width, $height , $title, $unit_name, $show_alerts, $avg_only,
$pure, $date, $unit, $baseline, $return_data, $show_title,
$only_image, $homeurl, $ttl, $projection, $adapt_key, $compare,
$show_unknown, $menu, $backgroundColor, $percentil,
$dashboard, $vconsole, $type_g);
$dashboard, $vconsole, $type_g, $fullscale);
return;
}
@ -192,7 +195,9 @@ if ($get_graphs){
null,
false,
false,
'area');
'area',
$value['fullscale']
);
$contador --;
}
// $table .= "</br>";
@ -255,7 +260,10 @@ if ($get_graphs){
false,
false,
null,
false);
false,
false,
$value['fullscale']
);
$contador --;
}
break;
@ -331,7 +339,9 @@ if ($get_graphs){
null,
false,
false,
'area');
'area',
$value['fullscale']
);
$contador --;
}
}

View File

@ -31,7 +31,7 @@ require_once ($config['homedir'] . '/include/functions_users.php');
function custom_graphs_create($id_modules = array(), $name = "",
$description = "", $stacked = CUSTOM_GRAPH_AREA, $width = 0,
$height = 0, $events = 0 , $period = 0, $private = 0, $id_group = 0,
$user = false) {
$user = false, $fullscale = 0) {
global $config;
@ -51,7 +51,8 @@ function custom_graphs_create($id_modules = array(), $name = "",
'events' => $events,
'stacked' => $stacked,
'id_group' => $id_group,
'id_graph_template' => 0
'id_graph_template' => 0,
'fullscale' => $fullscale,
));
if (empty($id_graph)) {

View File

@ -604,6 +604,7 @@ CREATE TABLE IF NOT EXISTS `tcontainer_item` (
`agent` varchar(100) NOT NULL default '',
`module` varchar(100) NOT NULL default '',
`id_tag` integer(10) unsigned NOT NULL DEFAULT 0,
`fullscale` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id_ci`),
FOREIGN KEY (`id_container`) REFERENCES tcontainer(`id_container`)
ON DELETE CASCADE