From eb39d25c4b137115b6d65a7ee733b987df4a1b88 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 10 Nov 2017 15:03:52 +0100 Subject: [PATCH] Added field to get string modules --- .../visual_console_builder.editor.js | 15 ++++++-- .../ajax/visual_console_builder.ajax.php | 5 ++- pandora_console/include/functions_ui.php | 9 +++++ .../include/functions_visual_map_editor.php | 35 ++++++++++++++++++- .../operation/agentes/ver_agente.php | 5 +++ 5 files changed, 65 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index ebd2427ce3..291c3abd38 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -800,6 +800,8 @@ function readFields() { values['top'] = $("input[name=top]").val(); values['agent'] = $("input[name=agent]").val(); values['id_agent'] = $("input[name=id_agent]").val(); + values['agent_string'] = $("input[name=agent_string]").val(); + values['id_agent_string'] = $("input[name=id_agent_string]").val(); values['module'] = $("select[name=module]").val(); values['process_simple_value'] = $("select[name=process_value]").val(); values['background'] = $("#background_image").val(); @@ -910,7 +912,7 @@ function create_button_palette_callback() { } break; case 'donut_graph': - if ((values['agent'] == '')) { + if ((values['agent_string'] == '')) { alert($("#message_alert_no_agent").html()); validate = false; } @@ -1442,11 +1444,16 @@ function loadFieldsFromDB(item) { if (key == 'pos_y') $("input[name=top]").val(val); if (key == 'agent_name') { $("input[name=agent]").val(val); + $("input[name=agent_string]").val(val); //Reload no-sincrone the select of modules } + if (key == 'id_agent') { $("input[name=id_agent]").val(val); } + if (key == 'id_agent_string') { + $("input[name=id_agent_string]").val(val); + } if (key == 'modules_html') { $("select[name=module]").empty().html(val); $("select[name=module]").val(moduleId); @@ -1714,6 +1721,9 @@ function hiddenFields(item) { $("#agent_row").css('display', 'none'); $("#agent_row." + item).css('display', ''); + $("#agent_row_string").css('display', 'none'); + $("#agent_row_string." + item).css('display', ''); + $("#module_row").css('display', 'none'); $("#module_row." + item).css('display', ''); @@ -1838,6 +1848,7 @@ function cleanFields(item) { $("input[name=left]").val(0); $("input[name=top]").val(0); $("input[name=agent]").val(''); + $("input[name=agent_string]").val(''); $("select[name=module]").val(''); $("select[name=process_value]").val(0); $("select[name=background_image]").val(''); @@ -2452,7 +2463,7 @@ function setDonutsGraph (id_data, values) { parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_module_type_string"}); - parameter.push ({name: "id_agent", value: values['id_agent']}); + parameter.push ({name: "id_agent", value: values['id_agent_string']}); parameter.push ({name: "module", value: values['module']}); parameter.push ({name: "id_element", value: id_data}); parameter.push ({name: "id_visual_console", value: id_visual_console}); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index c7e4484a27..07a51af3bb 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -113,6 +113,7 @@ $metaconsole = get_parameter('metaconsole', 0); $server_name = get_parameter('server_name', null); $server_id = (int)get_parameter('server_id', 0); $id_agent = get_parameter('id_agent', null); +$id_agent_string = get_parameter('id_agent_string', null); $id_metaconsole = get_parameter('id_metaconsole', null); $id_group = (int)get_parameter('id_group', 0); $id_custom_graph = get_parameter('id_custom_graph', null); @@ -179,7 +180,7 @@ switch ($action) { } $is_string = db_get_value_filter ('id_tipo_modulo', 'tagente_modulo', - array ('id_agente' => $id_agent, + array ('id_agente' => _string, 'id_agente_modulo' => $id_module)); if ($layoutData['id_metaconsole'] != 0) { @@ -611,6 +612,7 @@ switch ($action) { } $values['border_color'] = $resume_color; $values['type'] = DONUT_GRAPH; + $values['id_agent'] = $id_agent_string; break; case 'box_item': @@ -1013,6 +1015,7 @@ switch ($action) { $values['width'] = $width; $values['height'] = $height; $values['border_color'] = $resume_color; + $values['id_agent'] = $id_agent_string; break; case 'module_graph': $values['type'] = MODULE_GRAPH; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 11395a37ba..e76ba9399f 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2973,6 +2973,11 @@ function ui_print_agent_autocomplete_input($parameters) { else $metaconsole_enabled = false; } + + $get_only_string_modules = false; + if (isset($parameters['get_only_string_modules'])) { + $get_only_string_modules = true; + } $spinner_image = html_print_image('images/spinner.gif', true, false, true); if (isset($parameters['spinner_image'])) { @@ -3128,6 +3133,10 @@ function ui_print_agent_autocomplete_input($parameters) { if (' . ((int) $get_order_json) . ') { inputs.push ("get_order_json=1"); } + + if (' . ((int) $get_only_string_modules) . ') { + inputs.push ("get_only_string_modules=1"); + } if (' . ((int)$metaconsole_enabled) . ') { if ((' . ((int)$use_input_server) . ') diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 82d6382343..f4d99e5bfa 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -290,7 +290,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['agent_row'] = array(); $form_items['agent_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'datos', 'auto_sla_graph', 'bars_graph', 'donut_graph'); + 'simple_value', 'datos', 'auto_sla_graph', 'bars_graph'); $form_items['agent_row']['html'] = '' . __('Agent') . ''; $params = array(); @@ -320,6 +320,39 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['agent_row']['html'] .= '' . ui_print_agent_autocomplete_input($params) . ''; + + $form_items['agent_row_string'] = array(); + $form_items['agent_row_string']['items'] = array('donut_graph'); + $form_items['agent_row_string']['html'] = '' . + __('Agent') . ''; + $params = array(); + $params['return'] = true; + $params['show_helptip'] = true; + $params['input_name'] = 'agent_string'; + $params['size'] = 30; + $params['selectbox_id'] = 'module'; + $params['javascript_is_function_select'] = true; + $params['use_hidden_input_idagent'] = true; + $params['print_hidden_input_idagent'] = true; + $params['hidden_input_idagent_name'] = 'id_agent_string'; + $params['get_order_json'] = true; + $params['get_only_string_modules'] = true; + if (defined('METACONSOLE')) { + $params['javascript_ajax_page'] = '../../ajax.php'; + $params['disabled_javascript_on_blur_function'] = true; + + $params['print_input_server'] = true; + $params['print_input_id_server'] = true; + $params['input_server_id'] = 'id_server_name'; + $params['input_id_server_name'] = 'id_server_metaconsole'; + $params['input_server_value'] = ''; + $params['use_input_id_server'] = true; + $params['metaconsole_enabled'] = true; + $params['print_hidden_input_idagent'] = true; + } + $form_items['agent_row_string']['html'] .= '' . + ui_print_agent_autocomplete_input($params) . + ''; $form_items['module_row'] = array(); $form_items['module_row']['items'] = array('static_graph', diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 97c4f01720..b2479fec88 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -589,6 +589,11 @@ if (is_ajax ()) { if (empty($filter)) $filter = false; + $get_only_string_modules = get_parameter('get_only_string_modules', false); + if ($get_only_string_modules) { + $filter['tagente_modulo.id_tipo_modulo IN'] = "(17,23,3,10,33)"; + } + // Status selector if ($status_modulo == AGENT_MODULE_STATUS_NORMAL) { //Normal $sql_conditions .= ' estado = 0 AND utimestamp > 0 )