From 0952b96b49035516e27170fe6352f347f0811a69 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 23 Feb 2015 13:43:26 +0100 Subject: [PATCH] Added the option 'last value' for the items 'general' and 'exception' in reports. TICKET: #1819 --- .../reporting_builder.item_editor.php | 76 +++++- pandora_console/include/functions_html.php | 15 +- .../include/functions_reporting.php | 254 +++++++++++------- pandora_console/include/javascript/pandora.js | 90 ++++--- 4 files changed, 277 insertions(+), 158 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 4dcb730cc5..147f9c7b57 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -568,8 +568,25 @@ html_print_input_hidden('id_item', $idItem); + ?> + + + + + + + + + + + '; echo '' . printSmallFont($nameAgent) . $server_name_element . ''; echo '' . printSmallFont($nameModule) . ''; - + if (enterprise_installed() && $report_item_type == 'SLA_services') { enterprise_include_once("include/functions_services.php"); $nameService = enterprise_hook('services_get_name', array($item['id_agent_module'])); echo '' . printSmallFont($nameService) . ''; } - + echo '' . $item['sla_min'] . ''; echo '' . $item['sla_max'] . ''; echo '' . $item['sla_limit'] . ''; @@ -1424,7 +1441,8 @@ $(document).ready (function () { minuteText: '', secondText: '', currentText: '', - closeText: ''}); + closeText: '' + }); }); function create_custom_graph() { @@ -1451,7 +1469,11 @@ function create_custom_graph() { jQuery.ajax ({ data: params1.join ("&"), type: 'POST', - url: action= + "/ajax.php", + url: action= + "/ajax.php", async: false, timeout: 10000, success: function (data) { @@ -1659,13 +1681,13 @@ function addSLARow() { var slaMin = $("input[name=sla_min]").val(); var slaMax = $("input[name=sla_max]").val(); var slaLimit = $("input[name=sla_limit]").val(); - + var serviceId = $("select#id_service>option:selected").val(); var serviceName = $("select#id_service>option:selected").text(); if (((idAgent != '') && (slaMin != '') && (slaMax != '') && (slaLimit != '')) || serviceId != '') { - + if (nameAgent != '') { //Truncate nameAgent var params = []; @@ -1682,7 +1704,7 @@ function addSLARow() { nameAgent = data; } }); - + //Truncate nameModule var params = []; params.push("truncate_text=1"); @@ -1708,7 +1730,7 @@ function addSLARow() { params.push("sla_max=" + slaMax); params.push("sla_limit=" + slaLimit); params.push("server_id=" + serverId); - + if (serviceId != '') { params.push("id_service=" + serviceId); } @@ -1899,7 +1921,8 @@ function chooseType() { $("#row_netflow_filter").hide(); $("#row_max_values").hide(); $("#row_resolution").hide(); - + $("#row_last_value").hide(); + // SLA list default state $("#sla_list").hide(); $(".sla_list_agent_col").show(); @@ -1983,7 +2006,7 @@ function chooseType() { $("#row_only_display_wrong").show(); $("#row_working_time").show(); $("#row_sort").show(); - + $(".sla_list_agent_col").hide(); $(".sla_list_module_col").hide(); $(".sla_list_service_col").show(); @@ -2137,7 +2160,7 @@ function chooseType() { $("#row_event_filter").show(); $("#row_event_graphs").show(); $("#row_event_graph_by_agent").hide(); - + $('#agent_autocomplete').hide(); $('#agent_autocomplete_events').show(); break; @@ -2159,6 +2182,12 @@ function chooseType() { $("#row_order_uptodown").show(); $("#row_show_resume").show(); $("#row_show_in_two_columns").show(); + + $("#row_last_value").show(); + if ($("#hidden-period").val() == 0) { + $("#row_period").hide(); + $("input[name='last_value']").prop("checked", true); + } break; case 'group_report': $("#row_group").show(); @@ -2191,6 +2220,12 @@ function chooseType() { $("#row_show_resume").show(); $("#row_show_graph").show(); $("#row_show_in_two_columns").show(); + + $("#row_last_value").show(); + if ($("#hidden-period").val() == 0) { + $("#row_period").hide(); + $("input[name='last_value']").prop("checked", true); + } break; case 'agent_module': $("#row_description").show(); @@ -2292,4 +2327,19 @@ function chooseType() { break; } } + +function set_last_value_period() { + var checked = $("input[name='last_value']").prop("checked"); + + if (checked) { + $("#row_period").hide(); + period_set_value($("#hidden-period").attr('class'), 0); + alert(""); + } + else { + $("#row_period").show(); + } +} diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 00d6bad1e2..8149098fc3 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -748,7 +748,13 @@ function html_print_extended_select_for_time ($name, $selected = '', echo '
'; html_print_select ($fields, $uniq_name . '_select', $selected,"" . $script, $nothing, $nothing_value, false, false, false, '', false, 'font-size: xx-small;'.$select_style); - echo ' '.html_print_image('images/pencil.png',true,array('class' => $uniq_name . '_toggler', 'alt' => __('Custom'), 'title' => __('Custom'), 'style' => 'width: 18px;')).''; + echo ' ' . + html_print_image('images/pencil.png', true, + array('class' => $uniq_name . '_toggler', + 'alt' => __('Custom'), + 'title' => __('Custom'), + 'style' => 'width: 18px;')) . + ''; echo '
'; echo '
'; @@ -757,7 +763,12 @@ function html_print_extended_select_for_time ($name, $selected = '', html_print_input_hidden ($name, $selected, false, $uniq_name); html_print_select ($units, $uniq_name . '_units', 1, "" . $script, $nothing, $nothing_value, false, false, false, '', false, 'font-size: xx-small;'.$select_style); - echo ' '.html_print_image('images/default_list.png',true,array('class' => $uniq_name . '_toggler', 'alt' => __('List'), 'title' => __('List'), 'style' => 'width: 18px;')).''; + echo ' ' . + html_print_image('images/default_list.png', true, + array('class' => $uniq_name . '_toggler', + 'alt' => __('List'), + 'title' => __('List'), 'style' => 'width: 18px;')) . + ''; echo '
'; echo "