From ce72e5a5afef41154c2d8083453a9d9d7cd16a4b Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 16 Oct 2017 16:10:59 +0200 Subject: [PATCH] Added structure to new item --- .../visual_console_builder.editor.js | 51 +++++++++++++++++++ pandora_console/include/constants.php | 1 + .../include/functions_visual_map_editor.php | 14 ++--- 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 22c6c4d8d4..1e40c44279 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -434,6 +434,19 @@ function update_button_palette_callback() { setEventsBar(idItem, values); break; + case 'donut_graph': + if($('input[name=width]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height]').val() == ''){ + alert('Undefined height'); + return false; + } + $("#image_" + idItem).attr("src", "images/spinner.gif"); + + setDonutsGraph(idItem, values); + break; case 'simple_value': //checkpoint // if(($('#text-label_ifr').contents().find('#tinymce p').html() == '_VALUE_' || @@ -699,6 +712,12 @@ function create_button_palette_callback() { validate = false; } break; + case 'donut_graph': + if ((values['agent'] == '')) { + alert($("#message_alert_no_agent").html()); + validate = false; + } + break; case 'label': if ((values['label'] == '')) { alert($("#message_alert_no_label").html()); @@ -975,6 +994,7 @@ function toggle_item_palette() { activeToolboxButton('box_item', true); activeToolboxButton('line_item', true); activeToolboxButton('auto_sla_graph', true); + activeToolboxButton('donut_graph', true); if (typeof(enterprise_activeToolboxButton) == 'function') { enterprise_activeToolboxButton(true); @@ -995,6 +1015,7 @@ function toggle_item_palette() { activeToolboxButton('static_graph', false); activeToolboxButton('module_graph', false); activeToolboxButton('auto_sla_graph', false); + activeToolboxButton('donut_graph', false); activeToolboxButton('simple_value', false); activeToolboxButton('label', false); activeToolboxButton('icon', false); @@ -2348,6 +2369,17 @@ function createItem(type, values, id_data) { setEventsBar(id_data, values); break; + case 'donut_graph': + var sizeStyle = ''; + var imageSize = ''; + item = $('
' + + '
' + + '' + + '
' + ); + + setDonutsGraph(id_data, values); + break; case 'percentile_bar': case 'percentile_item': var sizeStyle = ''; @@ -2679,6 +2711,7 @@ function updateDB_visual(type, idElement , values, event, top, left) { case 'icon': case 'module_graph': case 'auto_sla_graph': + case 'donut_graph': if (type == 'simple_value') { setModuleValue(idElement, values.process_simple_value, @@ -3093,6 +3126,15 @@ function eventsItems(drag) { activeToolboxButton('delete_item', true); activeToolboxButton('show_grid', false); } + if ($(divParent).hasClass('donut_graph')) { + creationItem = null; + selectedItem = 'donut_graph'; + idItem = $(divParent).attr('id'); + activeToolboxButton('copy_item', true); + activeToolboxButton('edit_item', true); + activeToolboxButton('delete_item', true); + activeToolboxButton('show_grid', false); + } if ($(divParent).hasClass('group_item')) { creationItem = null; selectedItem = 'group_item'; @@ -3293,6 +3335,9 @@ function eventsItems(drag) { if ($(event.target).hasClass('auto_sla_graph')) { selectedItem = 'auto_sla_graph'; } + if ($(event.target).hasClass('donut_graph')) { + selectedItem = 'donut_graph'; + } if ($(event.target).hasClass('group_item')) { selectedItem = 'group_item'; } @@ -3617,6 +3662,10 @@ function click_button_toolbox(id) { toolbuttonActive = creationItem = 'auto_sla_graph'; toggle_item_palette(); break; + case 'donut_graph': + toolbuttonActive = creationItem = 'donut_graph'; + toggle_item_palette(); + break; case 'simple_value': toolbuttonActive = creationItem = 'simple_value'; toggle_item_palette(); @@ -3674,6 +3723,7 @@ function click_button_toolbox(id) { activeToolboxButton('service', false); activeToolboxButton('group_item', false); activeToolboxButton('auto_sla_graph', false); + activeToolboxButton('donut_graph', false); activeToolboxButton('copy_item', false); activeToolboxButton('edit_item', false); activeToolboxButton('delete_item', false); @@ -3704,6 +3754,7 @@ function click_button_toolbox(id) { activeToolboxButton('icon', true); activeToolboxButton('group_item', true); activeToolboxButton('auto_sla_graph', true); + activeToolboxButton('donut_graph', true); } break; case 'save_visualmap': diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index f039a90504..8d0facabee 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -197,6 +197,7 @@ define('SERVICE', 10); //Enterprise Item. define('GROUP_ITEM', 11); define('BOX_ITEM', 12); define('LINE_ITEM', 13); +define('DONUT_GRAPH', 17); //Some styles define('MIN_WIDTH', 300); define('MIN_HEIGHT', 120); diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 54db2d8008..ec9e06c9e8 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -54,6 +54,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'static_graph' => __('Static Graph'), 'percentile_item' => __('Percentile Item'), 'module_graph' => __('Graph'), + 'donut_graph' => __('Donut graph'), 'auto_sla_graph' => __('Auto SLA Graph'), 'simple_value' => __('Simple value') . ui_print_help_tip(__("To use 'label'field, you should write a text to replace '(_VALUE_)' and the value of the module will be printed at the end."), true), @@ -277,7 +278,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'); + 'simple_value', 'datos', 'auto_sla_graph', 'donut_graph'); $form_items['agent_row']['html'] = '' . __('Agent') . ''; $params = array(); @@ -310,7 +311,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['module_row'] = array(); $form_items['module_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'datos', 'auto_sla_graph'); + 'simple_value', 'datos', 'auto_sla_graph', 'donut_graph'); $form_items['module_row']['html'] = '' . __('Module') . ' ' . @@ -446,12 +447,6 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { html_print_radio_button_extended('value_show', 'value', ('Value'), 'value', false, '', '', true) . ''; } - - - $form_items['period_row'] = array(); - $form_items['period_row']['items'] = array('module_graph', 'simple_value', 'datos'); - $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'); @@ -530,7 +525,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items_advance['size_row']['items'] = array( 'group_item', 'background', 'static_graph', 'icon datos', - 'auto_sla_graph'); + 'auto_sla_graph', 'donut_graph'); $form_items_advance['size_row']['html'] = '' . __('Size') . ui_print_help_tip ( @@ -674,6 +669,7 @@ function visual_map_editor_print_toolbox() { visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true); visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true); visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true); + visual_map_print_button_editor('donut_graph', __('Donut Graph'), 'left', false, 'donut_graph_min', true); visual_map_print_button_editor('auto_sla_graph', __('Auto SLA Graph'), 'left', false, 'auto_sla_graph_min', true); visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true); visual_map_print_button_editor('label', __('Label'), 'left', false, 'label_min', true);