From 6412dc7e17accea83a805b4adce549a7cd5ff4d0 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 5 Sep 2014 12:53:09 +0200 Subject: [PATCH] Added hooks to the enterprise services SLA reports * include/ajax/reporting.ajax.php godmode/reporting/reporting_builder.item_editor.php: Added hooks to the enterprise services SLA reports. --- pandora_console/ChangeLog | 6 + .../reporting_builder.item_editor.php | 185 ++++++++++++------ .../include/ajax/reporting.ajax.php | 5 + 3 files changed, 135 insertions(+), 61 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index fef5ec32f9..a5f7f2934c 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2014-09-05 Alejandro Gallardo + + * include/ajax/reporting.ajax.php + godmode/reporting/reporting_builder.item_editor.php: + Added hooks to the enterprise services SLA reports. + 2014-09-04 Vanessa Gil * include/languages/ru.mo diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 894b8b885e..9ddc186460 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -1120,16 +1120,18 @@ function print_SLA_list($width, $action, $idItem = null) { global $config; global $meta; + $report_item_type = db_get_value ('type', 'treport_content', 'id_rc', $idItem); ?> - - - - - - + + + + + + + - - - - - - '; + echo ''; + echo ''; + + 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 ''; + echo ''; + echo ''; + echo ' - '; + '; + echo ''; if ($meta) { //Restore db connection metaconsole_restore_db(); @@ -1190,17 +1199,24 @@ function print_SLA_list($width, $action, $idItem = null) { ?> - - - - - - + + + "; + } + ?> + + + + - - - - - + + ".html_print_select($services, 'id_service', false, '', '', '', true, false, false).""; + } + ?> + + + + option:selected").val(); + var serviceName = $("select#id_service>option:selected").text(); - if ((idAgent != '') && (slaMin != '') && (slaMax != '') - && (slaLimit != '')) { - //Truncate nameAgent - var params = []; - params.push("truncate_text=1"); - params.push("text=" + nameAgent); - params.push("page=include/ajax/reporting.ajax"); - jQuery.ajax ({ - data: params.join ("&"), - type: 'POST', - url: action= + "/ajax.php", - async: false, - timeout: 10000, - success: function (data) { - nameAgent = data; - } - }); - //Truncate nameModule - var params = []; - params.push("truncate_text=1"); - params.push("text=" + nameModule); - params.push("page=include/ajax/reporting.ajax"); - jQuery.ajax ({ - data: params.join ("&"), - type: 'POST', - url: action= + "/ajax.php", - async: false, - timeout: 10000, - success: function (data) { - nameModule = data; - } - }); + if (((idAgent != '') && (slaMin != '') && (slaMax != '') + && (slaLimit != '')) || serviceId != '') { + + if (nameAgent != '') { + //Truncate nameAgent + var params = []; + params.push("truncate_text=1"); + params.push("text=" + nameAgent); + params.push("page=include/ajax/reporting.ajax"); + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action= + "/ajax.php", + async: false, + timeout: 10000, + success: function (data) { + nameAgent = data; + } + }); + + //Truncate nameModule + var params = []; + params.push("truncate_text=1"); + params.push("text=" + nameModule); + params.push("page=include/ajax/reporting.ajax"); + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action= + "/ajax.php", + async: false, + timeout: 10000, + success: function (data) { + nameModule = data; + } + }); + } var params = []; params.push("add_sla=1"); @@ -1653,6 +1694,10 @@ function addSLARow() { params.push("sla_max=" + slaMax); params.push("sla_limit=" + slaLimit); params.push("server_id=" + serverId); + + if (serviceId != '') { + params.push("id_service=" + serviceId); + } params.push("page=include/ajax/reporting.ajax"); jQuery.ajax ({ @@ -1669,6 +1714,7 @@ function addSLARow() { $("#row", row).attr('id', 'sla_' + data['id']); $(".agent_name", row).html(nameAgent); $(".module_name", row).html(nameModule); + $(".service_name", row).html(serviceName); $(".sla_min", row).html(slaMin); $(".sla_max", row).html(slaMax); $(".sla_limit", row).html(slaLimit); @@ -1809,7 +1855,6 @@ function chooseType() { $("#row_url").hide(); $("#row_field_separator").hide(); $("#row_line_separator").hide(); - $("#sla_list").hide(); $("#row_custom_example").hide(); $("#row_group").hide(); $("#row_working_time").hide(); @@ -1839,6 +1884,16 @@ function chooseType() { $("#row_netflow_filter").hide(); $("#row_max_values").hide(); $("#row_resolution").hide(); + + // SLA list default state + $("#sla_list").hide(); + $(".sla_list_agent_col").show(); + $(".sla_list_module_col").show(); + $(".sla_list_service_col").hide(); + $(".sla_list_sla_min_col").show(); + $(".sla_list_sla_max_col").show(); + $(".sla_list_sla_limit_col").show(); + $(".sla_list_action_col").show(); //$('#agent_autocomplete').show(); $('#agent_autocomplete_events').show(); @@ -1910,6 +1965,14 @@ 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(); + $(".sla_list_sla_min_col").hide(); + $(".sla_list_sla_max_col").hide(); + $(".sla_list_sla_limit_col").hide(); + $("#sla_list").show(); break; case 'monitor_report': $("#row_description").show(); diff --git a/pandora_console/include/ajax/reporting.ajax.php b/pandora_console/include/ajax/reporting.ajax.php index 985eb0e697..b6f63a9371 100644 --- a/pandora_console/include/ajax/reporting.ajax.php +++ b/pandora_console/include/ajax/reporting.ajax.php @@ -66,6 +66,11 @@ if ($add_sla) { $sla_max = get_parameter('sla_max', 0); $sla_min = get_parameter('sla_min', 0); $server_id = (int)get_parameter('server_id', 0); + + $id_service = (int) get_parameter("id_service"); + if (empty($id_module) && !empty($id_service)) { + $id_module = $id_service; + } $include_enterprise = enterprise_include("include/functions_metaconsole.php");
' . printSmallFont($nameAgent) . $server_name_element . '' . printSmallFont($nameModule) . '' . $item['sla_min'] . '' . $item['sla_max'] . '' . $item['sla_limit'] . ' + + echo '
' . printSmallFont($nameAgent) . $server_name_element . '' . printSmallFont($nameModule) . '' . printSmallFont($nameService) . ''; + } + + echo '' . $item['sla_min'] . '' . $item['sla_max'] . '' . $item['sla_limit'] . ' ' . html_print_image("images/cross.png", true) . ' -
+ -