From aec10bea6bd22aa7306fd3589ec76ce3e04fd8e8 Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Mon, 11 Jul 2011 10:16:18 +0000 Subject: [PATCH] 2011-07-11 Juan Manuel Ramon * include/functions_visual_map.php include/ajax/visual_console_builder.ajax.php godmode/users/configure_user.php godmode/reporting/visual_console_builder.editor.js godmode/reporting/visual_console_builder.editor.php godmode/reporting/visual_console_builder.constans.php: Added min, max and avg process to simple value items in visual maps. Pending tasks: #3014709 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4541 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 12 +++ .../visual_console_builder.constans.php | 5 +- .../visual_console_builder.editor.js | 7 +- .../visual_console_builder.editor.php | 6 ++ .../godmode/users/configure_user.php | 2 +- .../ajax/visual_console_builder.ajax.php | 65 +++++++++++++++- .../include/functions_visual_map.php | 75 ++++++++++++++++++- 7 files changed, 162 insertions(+), 10 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 00c6462342..0b0b07281f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2011-07-11 Juan Manuel Ramon + + * include/functions_visual_map.php + include/ajax/visual_console_builder.ajax.php + godmode/users/configure_user.php + godmode/reporting/visual_console_builder.editor.js + godmode/reporting/visual_console_builder.editor.php + godmode/reporting/visual_console_builder.constans.php: Added min, + max and avg process to simple value items in visual maps. + + Pending tasks: #3014709 + 2011-07-11 Junichi Satoh * operation/agentes/estado_agente.php, diff --git a/pandora_console/godmode/reporting/visual_console_builder.constans.php b/pandora_console/godmode/reporting/visual_console_builder.constans.php index b902bca610..0c36857435 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.constans.php +++ b/pandora_console/godmode/reporting/visual_console_builder.constans.php @@ -19,4 +19,7 @@ define('MODULE_GRAPH', 1); define('SIMPLE_VALUE', 2); define('LABEL', 4); define('ICON', 5); -?> \ No newline at end of file +define('SIMPLE_VALUE_MAX', 6); +define('SIMPLE_VALUE_MIN', 7); +define('SIMPLE_VALUE_AVG', 8); +?> diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 4bd89cde45..ecccb895f5 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -266,6 +266,7 @@ function readFields() { values['top'] = $("input[name=top]").val(); values['agent'] = $("input[name=agent]").val(); values['module'] = $("select[name=module]").val(); + values['process_simple_value'] = $("select[name=process_value]").val(); values['background'] = $("#background_image").val(); values['period'] = $("select[name=period]").val(); values['width'] = $("input[name=width]").val(); @@ -420,6 +421,7 @@ function loadFieldsFromDB(item) { moduleId = val; $("select[name=module]").val(val); } + if (key == 'process_value') $("select[name=process_value]").val(val); if (key == 'period') $("select[name=period]").val(val); if (key == 'width') $("input[name=width]").val(val); if (key == 'height') $("input[name=height]").val(val); @@ -522,8 +524,8 @@ function hiddenFields(item) { $("#agent_row").css('display', 'none'); $("#agent_row." + item).css('display', ''); - $("#module_row").css('display', 'none'); - $("#module_row." + item).css('display', ''); + $("#process_value_row").css('display', 'none'); + $("#process_value_row." + item).css('display', ''); $("#background_row_1").css('display', 'none'); $("#background_row_1." + item).css('display', ''); @@ -569,6 +571,7 @@ function cleanFields() { $("input[name=top]").val(0); $("input[name=agent]").val(''); $("select[name=module]").val(''); + $("input[name=process_value]").val(''); $("select[name=background_image]").val(''); $("input[name=width_percentile]").val(''); $("input[name=max_percentile]").val(''); diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index 13f2b03ff8..d97c7a242d 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -136,6 +136,12 @@ echo ''; break; case SIMPLE_VALUE: + case SIMPLE_VALUE_MAX: + case SIMPLE_VALUE_MIN: + case SIMPLE_VALUE_AVG: echo '
'; - echo $text; - echo ' ' . db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $id_module) . ''; + echo $text; + switch ($type){ + case SIMPLE_VALUE: + echo ' ' . db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $id_module) . ''; + break; + case SIMPLE_VALUE_MAX: + $value = reporting_get_agentmodule_data_max ($id_module, 86400, 0); + if ($value === false) { + $value = __('Unknown'); + } else { + $value = format_numeric ($value); + } + echo ' ' . $value . ''; + break; + case SIMPLE_VALUE_MIN: + $value = reporting_get_agentmodule_data_min ($id_module, 86400, 0); + if ($value === false) { + $value = __('Unknown'); + } else { + $value = format_numeric ($value); + } + echo ' ' . $value . ''; + break; + case SIMPLE_VALUE_AVG: + $value = reporting_get_agentmodule_data_average ($id_module, 86400, 0); + if ($value === false) { + $value = __('Unknown'); + } else { + $value = format_numeric ($value); + } + echo ' ' . $value . ''; + break; + } echo '
'; break; case LABEL: @@ -731,6 +765,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line echo ""; break; case 2: + case 6: + case 7: + case 8: // **************************************************************** // SIMPLE DATA VALUE (type = 2) // **************************************************************** @@ -761,7 +798,39 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line } echo ''.$layout_data['label']. ' '; - echo db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $layout_data['id_agente_modulo']); + //TODO: change interface to add a period parameter, now is set to 1 day + switch ($layout_data['type']){ + case 2: + echo db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $layout_data['id_agente_modulo']); + break; + case 6: + $value = reporting_get_agentmodule_data_max ($layout_data['id_agente_modulo'], 86400, 0); + if ($value === false) { + $value = __('Unknown'); + } else { + $value = format_numeric ($value); + } + echo $value; + break; + case 7: + $value = reporting_get_agentmodule_data_min ($layout_data['id_agente_modulo'], 86400, 0); + if ($value === false) { + $value = __('Unknown'); + } else { + $value = format_numeric ($value); + } + echo $value; + break; + case 8: + $value = reporting_get_agentmodule_data_average($layout_data['id_agente_modulo'], 86400, 0); + if ($value === false) { + $value = __('Unknown'); + } else { + $value = format_numeric ($value); + } + echo $value; + break; + } echo ''; if ($endTagA) echo '';