From f6c6e2a6ba0af81bea2d1890cba96823336b41d2 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Thu, 31 Aug 2017 15:09:04 +0200 Subject: [PATCH] Add show_statistics option for group item - #1245 --- .../visual_console_builder.editor.js | 201 +++++++++++++----- .../reporting/visual_console_builder.php | 2 + .../images/console/signes/group_status.png | Bin 0 -> 5798 bytes .../ajax/visual_console_builder.ajax.php | 6 + .../include/functions_visual_map.php | 143 ++++++++++--- .../include/functions_visual_map_editor.php | 7 + 6 files changed, 283 insertions(+), 76 deletions(-) create mode 100644 pandora_console/images/console/signes/group_status.png diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 3cea48be21..cdf1a9ac88 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -303,34 +303,64 @@ function update_button_palette_callback() { alert('Undefined height'); return false; } - + $("#text_" + idItem).html(values['label']); - if ((values['width'] == 0) || (values['height'] == 0)) { - if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ - $("#image_" + idItem).removeAttr('width'); - $("#image_" + idItem).removeAttr('height'); - $("#image_" + idItem).attr('width', 70); - $("#image_" + idItem).attr('height', 70); - $("#image_" + idItem).css('width', '70px'); - $("#image_" + idItem).css('height', '70px'); + + if(values['show_statistics'] == 1){ + + + if ((values['width'] == 0) || (values['height'] == 0)) { + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', 450); + $("#image_" + idItem).attr('height', 80); + $("#image_" + idItem).css('width', '450px'); + $("#image_" + idItem).css('height', '80px'); + $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); + } - else{ + else { $("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('height'); - $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); - $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); - $("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); - $("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); - } + $("#image_" + idItem).attr('width', values['width']); + $("#image_" + idItem).attr('height', values['height']); + $("#image_" + idItem).css('width', values['width'] + 'px'); + $("#image_" + idItem).css('height', values['height'] + 'px'); + $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); + } + } - else { - $("#image_" + idItem).removeAttr('width'); - $("#image_" + idItem).removeAttr('height'); - $("#image_" + idItem).attr('width', values['width']); - $("#image_" + idItem).attr('height', values['height']); - $("#image_" + idItem).css('width', values['width'] + 'px'); - $("#image_" + idItem).css('height', values['height'] + 'px'); + else{ + + if ((values['width'] == 0) || (values['height'] == 0)) { + if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', 70); + $("#image_" + idItem).attr('height', 70); + $("#image_" + idItem).css('width', '70px'); + $("#image_" + idItem).css('height', '70px'); + } + else{ + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); + $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); + $("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); + $("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); + } + } + else { + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', values['width']); + $("#image_" + idItem).attr('height', values['height']); + $("#image_" + idItem).css('width', values['width'] + 'px'); + $("#image_" + idItem).css('height', values['height'] + 'px'); + } + } + break; case 'percentile_bar': case 'percentile_item': @@ -613,6 +643,7 @@ function readFields() { $("input[name='line_width']").val()); values['line_color'] = $("input[name='line_color']").val(); values['label_position'] = $(".labelpos[sel=yes]").attr('position'); + values['show_statistics'] = $("input[name=show_statistics]").is(':checked') ? 1 : 0; if (is_metaconsole()) { values['metaconsole'] = 1; @@ -1140,6 +1171,17 @@ function loadFieldsFromDB(item) { } } + if (key == 'show_statistics') { + if (val == "1") { + $("input[name=show_statistics]") + .prop("checked", true); + } + else { + $("input[name=show_statistics]") + .prop("checked", false); + } + } + if (key == 'type_graph') { $("select[name=type_graph]").val(val); } @@ -1427,6 +1469,9 @@ function hiddenFields(item) { $("#enable_link_row").css('display', 'none'); $("#enable_link_row." + item).css('display', ''); + + $("#show_statistics_row").css('display', 'none'); + $("#show_statistics_row." + item).css('display', ''); $("#preview_row").css('display', 'none'); $("#preview_row." + item).css('display', ''); @@ -1621,11 +1666,13 @@ function set_static_graph_status(idElement, image, status) { data: parameter, success: function (data) { set_static_graph_status(idElement, image, data); - if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){ - $('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2); - } - else{ - $('#'+idElement+ ' img').css('margin-left', parseInt($('#'+idElement).css('width'))/2 - parseInt($('#'+idElement+ ' img').css('width'))/2); + if(values['show_statistics'] == 1){ + if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){ + $('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2); + } + else{ + $('#'+idElement+ ' img').css('margin-left', parseInt($('#'+idElement).css('width'))/2 - parseInt($('#'+idElement+ ' img').css('width'))/2); + } } } }); @@ -1660,15 +1707,25 @@ function set_static_graph_status(idElement, image, status) { } function set_image(type, idElement, image) { - if (type == "image") { + + if(image == 'show_statistics_bad.png' || image == 'show_statistics_ok.png' || image == 'show_statistics_warning.png' || image == 'show_statistics.png'){ item = "#image_" + idElement; - img_src = "images/console/icons/" + image; + img_src = "images/console/signes/group_status.png"; } - else if (type == "background") { - item = "#background_img"; - img_src = "images/console/background/" + image; + else{ + + if (type == "image") { + item = "#image_" + idElement; + img_src = "images/console/icons/" + image; + } + else if (type == "background") { + item = "#background_img"; + img_src = "images/console/background/" + image; + } + } - + + var params = []; params.push("get_image_path=1"); params.push("img_src=" + img_src); @@ -1682,6 +1739,12 @@ function set_image(type, idElement, image) { url: get_url_ajax(), success: function (data) { $(item).attr('src', data); + + if(image == 'show_statistics_bad.png' || image == 'show_statistics_ok.png' || image == 'show_statistics_warning.png' || image == 'show_statistics.png'){ + $(item).attr('width', 450); + $(item).attr('height', 80); + } + } }); } @@ -2173,21 +2236,28 @@ function createItem(type, values, id_data) { } - if ((values['width'] == 0) || (values['height'] == 0)) { - // Do none - if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ - $image.attr('width', '70') - .attr('height', '70'); + if(values['show_statistics'] != 1){ + + if ((values['width'] == 0) || (values['height'] == 0)) { + // Do none + if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + $image.attr('width', '70') + .attr('height', '70'); + } + else{ + $image.attr('width', $('#preview > img')[0].naturalWidth) + .attr('height', $('#preview > img')[0].naturalHeight); + } + } + else { + $image.attr('width', values['width']) + .attr('height', values['height']); + } } - else{ - $image.attr('width', $('#preview > img')[0].naturalWidth) - .attr('height', $('#preview > img')[0].naturalHeight); - } - } - else { - $image.attr('width', values['width']) - .attr('height', values['height']); - } + // else{ + // $('#image_'+id_data).css('width', values['width']+'px'); + // $('#image_'+id_data).css('height', values['height']+'px'); + // } /* var $span = $('') .attr('id', 'text_' + id_data) @@ -2245,8 +2315,32 @@ function createItem(type, values, id_data) { .append($image) .append($input); } - - set_static_graph_status(id_data, values['image']); + + if(values['show_statistics'] != 1){ + set_static_graph_status(id_data, values['image']); + } + else{ + set_static_graph_status(id_data, 'show_statistics'); + } + + if(values['show_statistics'] != 1){ + + if ((values['width'] == 0) || (values['height'] == 0)) { + // Do none + if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + $image.attr('width', '70') + .attr('height', '70'); + } + else{ + $image.attr('width', $('#preview > img')[0].naturalWidth) + .attr('height', $('#preview > img')[0].naturalHeight); + } + } + else { + $image.attr('width', values['width']) + .attr('height', values['height']); + } + } break; case 'auto_sla_graph': @@ -2580,9 +2674,9 @@ function updateDB_visual(type, idElement , values, event, top, left) { case 'static_graph': if ((event != 'resizestop') && (event != 'show_grid') && (event != 'dragstop')) { - - set_static_graph_status(idElement, values['image']); - + if(values['show_statistics'] != 1){ + set_static_graph_status(idElement, values['image']); + } } break; case 'percentile_item': @@ -2811,6 +2905,9 @@ function updateDB(type, idElement , values, event) { } function copyDB(idItem) { + + console.log(idItem); + metaconsole = $("input[name='metaconsole']").val(); parameter = Array(); diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 1baaab1cd5..fa997be6e5 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -357,6 +357,7 @@ switch ($activeTab) { break; case GROUP_ITEM: $values['id_group'] = get_parameter('group_' . $id, 0); + $values['show_statistics'] = get_parameter('show_statistics', 0); break; } $agentName = get_parameter('agent_' . $id, ''); @@ -410,6 +411,7 @@ switch ($activeTab) { $width = (int) get_parameter ("width", 0); $height = (int) get_parameter ("height", 0); $period = (int) get_parameter ("period", 0); + $show_statistics = get_parameter ("show_statistics", 0); $process_value = (int) get_parameter ("process_value", 0); $percentileitem_width = (int) get_parameter ("percentileitem_width", 0); $max_value = (int) get_parameter ("max_value", 0); diff --git a/pandora_console/images/console/signes/group_status.png b/pandora_console/images/console/signes/group_status.png new file mode 100644 index 0000000000000000000000000000000000000000..bd3f76a5f3bfb1ea2dad7558667c60d12652d839 GIT binary patch literal 5798 zcmZ8lWl$VUlU`hcExr)kgKKzkmcHX*aZF#0$lrlTh4Is`0kpy>RkC?=xz9rAl`bc%9;B2{`QsrW5URH z-NFzh$*n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O4Sh1?TtoUP@R1K#FEeoXz3Opf^y?@%gXclW>MY3^w9N9|D13STw)|0CK4dnI?&~ zVJSy{TIok|qx$ljSf~$APTVi<#h6}3#5V!c z?Yw9h8Czb4n}wf*}UT96lGN*)nLQm{{p6x=VAZ= literal 0 HcmV?d00001 diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 6f2bae0b40..e854a31c49 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -132,6 +132,7 @@ $get_element_status = get_parameter('get_element_status', 0); $enable_link = get_parameter('enable_link', 1); $type_graph = get_parameter('type_graph', 'area'); $label_position = get_parameter('label_position', 'down'); +$show_statistics = get_parameter('show_statistics', 0); switch ($action) { case 'get_font': @@ -569,6 +570,9 @@ switch ($action) { if ($height !== null) { $values['height'] = $height; } + if ($show_statistics !== null) { + $values['show_statistics'] = $show_statistics; + } break; case 'module_graph': if ($height_module_graph !== null) { @@ -640,6 +644,7 @@ switch ($action) { switch ($type) { case 'group_item': unset($values['id_group']); + unset($values['show_statistics']); break; case 'module_graph': unset($values['image']); @@ -948,6 +953,7 @@ switch ($action) { $values['width'] = $width; $values['height'] = $height; $values['id_group'] = $id_group; + $values['show_statistics'] = $show_statistics; breaK; case 'simple_value': //This allows min, max and avg process in a simple value diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index dcb4123113..91442813f0 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -1274,35 +1274,130 @@ function visual_map_print_item($mode = "read", $layoutData, $varsize = getimagesize($img); - if ($width == 0 || $height == 0) { - if($varsize[0] > 150 || $varsize[1] > 150){ - echo html_print_image($img, true, - array("class" => "image", - "id" => "image_" . $id, - "width" => "70px", - "height" => "70px", - "title" => $img_style_title, - "style" => $borderStyle.$imgpos), false, - false, false, $isExternalLink); + + if($layoutData['show_statistics'] == 1){ + + if (get_parameter('action') == 'edit') { + + if ($width == 0 || $height == 0) { + + echo ''; + } + else{ + echo ''; + } + } else{ - echo html_print_image($img, true, - array("class" => "image", - "id" => "image_" . $id, - "title" => $img_style_title, - "style" => $borderStyle.$imgpos), false, - false, false, $isExternalLink); + + $agents_critical = agents_get_agents(array ( + 'disabled' => 0, + 'id_grupo' => $layoutData['id_group'], + 'status' => AGENT_STATUS_CRITICAL), + array ('COUNT(*) as total'), 'AR', false); + + $agents_warning = agents_get_agents(array ( + 'disabled' => 0, + 'id_grupo' => $layoutData['id_group'], + 'status' => AGENT_STATUS_WARNING), + array ('COUNT(*) as total'), 'AR', false); + + $agents_unknown = agents_get_agents(array ( + 'disabled' => 0, + 'id_grupo' => $layoutData['id_group'], + 'status' => AGENT_STATUS_UNKNOWN), + array ('COUNT(*) as total'), 'AR', false); + + $agents_ok = agents_get_agents(array ( + 'disabled' => 0, + 'id_grupo' => $layoutData['id_group'], + 'status' => AGENT_STATUS_OK), + array ('COUNT(*) as total'), 'AR', false); + + $total_agents = $agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total']; + + $stat_agent_ok = $agents_ok[0]['total']/$total_agents*100; + $stat_agent_wa = $agents_warning[0]['total']/$total_agents*100; + $stat_agent_cr = $agents_critical[0]['total']/$total_agents*100; + $stat_agent_un = $agents_unknown[0]['total']/$total_agents*100; + + if($width == 0 || $height == 0){ + $dyn_width = 450; + $dyn_height = 80; + } + else{ + $dyn_width = $width; + $dyn_height = $height; + } + + + echo ''; + + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo "
" .groups_get_name($layoutData['id_group'],true) . "
"; + echo "
". remove_right_zeros(number_format($stat_agent_cr, 2)) ."%
"; + echo "
Critical
"; + echo "
". remove_right_zeros(number_format($stat_agent_wa, 2)) ."%
"; + echo "
Warning
"; + echo "
". remove_right_zeros(number_format($stat_agent_ok, 2)) ."%
"; + echo "
Normal
"; + echo "
". remove_right_zeros(number_format($stat_agent_un, 2)) ."%
"; + echo "
Unknown
"; + + echo "
"; + + } + } else{ - echo html_print_image($img, true, - array("class" => "image", - "id" => "image_" . $id, - "width" => $width, - "height" => $height, - "title" => $img_style_title, - "style" => $borderStyle.$imgpos), false, - false, false, $isExternalLink); + + if ($width == 0 || $height == 0) { + if($varsize[0] > 150 || $varsize[1] > 150){ + echo html_print_image($img, true, + array("class" => "image", + "id" => "image_" . $id, + "width" => "70px", + "height" => "70px", + "title" => $img_style_title, + "style" => $borderStyle.$imgpos), false, + false, false, $isExternalLink); + } + else{ + echo html_print_image($img, true, + array("class" => "image", + "id" => "image_" . $id, + "title" => $img_style_title, + "style" => $borderStyle.$imgpos), false, + false, false, $isExternalLink); + } + } + else{ + echo html_print_image($img, true, + array("class" => "image", + "id" => "image_" . $id, + "width" => $width, + "height" => $height, + "title" => $img_style_title, + "style" => $borderStyle.$imgpos), false, + false, false, $isExternalLink); + } + } } diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index c0c261ea57..54db2d8008 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -453,6 +453,13 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['period_row']['html'] = '' . __('Period') . ' ' . html_print_extended_select_for_time ('period', SECONDS_5MINUTES, '', '', '', false, true) . ''; + $form_items['show_statistics_row'] = array(); + $form_items['show_statistics_row']['items'] = array('group_item'); + $form_items['show_statistics_row']['html'] = + '' . __('Show statistics') . ' + ' . + html_print_checkbox('show_statistics', 1, '', true) . ''; + $form_items['module_graph_size_row'] = array(); $form_items['module_graph_size_row']['items'] = array('module_graph', 'datos');