From 3b03bfe6b52bc37e894cd08ad31f09fc005f5286 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 5 Oct 2017 17:33:37 +0200 Subject: [PATCH] Added modifications to value option --- .../visual_console_builder.editor.js | 24 ++-------- .../include/functions_visual_map.php | 46 ++++++++++++++----- .../include/graphs/functions_d3.php | 8 ++-- pandora_console/include/graphs/pandora.d3.js | 8 ++-- 4 files changed, 45 insertions(+), 41 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 1ebefe58c3..ba692f20f3 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -388,7 +388,6 @@ function update_button_palette_callback() { else { setPercentileBar(idItem, values); } - break; case 'module_graph': if($('#dir_items').html() == 'horizontal'){ @@ -634,7 +633,8 @@ function readFields() { values['event_max_time_row'] = $("select[name=event_max_time_row]").val(); values['type_percentile'] = $("select[name=type_percentile]").val(); values['percentile_color'] = $("input[name='percentile_color']").val(); - values['value_show'] = $("input[name=value_show]:checked").val(); + values['value_show'] = $("select[name=value_show]").val(); + values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0; values['id_group'] = $("select[name=group]").val(); values['id_custom_graph'] = parseInt( @@ -1291,14 +1291,7 @@ function loadFieldsFromDB(item) { } if (key == 'value_show') { - if (val == 'percent') { - $("input[name=value_show][value=percent]") - .attr("checked", "checked"); - } - else { - $("input[name=value_show][value=value]") - .attr("checked", "checked"); - } + $("select[name=value_show]").val(val); } if (key == 'id_group') { @@ -3114,9 +3107,6 @@ function updateDB(type, idElement , values, event) { } function copyDB(idItem) { - - console.log(idItem); - metaconsole = $("input[name='metaconsole']").val(); parameter = Array(); @@ -3572,8 +3562,6 @@ function eventsItems(drag) { } } else{ - console.log('Dragstart'); - multiDragStart(event); } @@ -3590,8 +3578,6 @@ function eventsItems(drag) { updateDB(selectedItem, idItem, values, 'dragstop'); } else{ - - console.log('Dragstop'); multidragStop(event); } }); @@ -3679,10 +3665,6 @@ function eventsItems(drag) { break; } } - else{ - console.log('Drag'); - - } }); } diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 152e3541a3..9479805b59 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -1590,11 +1590,23 @@ function visual_map_print_item($mode = "read", $layoutData, } } else { - if($width == 0){ - $img = progress_circular_bar($id, $percentile, 100,100, $border_color); + if (($layoutData['image'] == 'value') && ($value_text !== false)) { + $unit_text = db_get_sql ('SELECT unit + FROM tagente_modulo + WHERE id_agente_modulo = ' . $id_module); + $unit_text = trim(io_safe_output($unit_text)); + + $percentile = $value_text; + } + else { + $unit_text = "%"; + } + + if($width < 200){ + $img = progress_circular_bar($id, $percentile, 200,200, $border_color, $unit_text); } else{ - $img = progress_circular_bar($id, $percentile, $width, $width, $border_color); + $img = progress_circular_bar($id, $percentile, $width, $width, $border_color, $unit_text); } } @@ -1648,15 +1660,25 @@ function visual_map_print_item($mode = "read", $layoutData, $img = ''; } } - else{ - if ($type == CIRCULAR_INTERIOR_PROGRESS_BAR) { - if($width == 0){ - $img = progress_circular_bar_interior($id, $percentile, 100,100, $border_color); - - } - else{ - $img = progress_circular_bar_interior($id, $percentile, $width, $width, $border_color); - } + else { + if (($layoutData['image'] == 'value') && ($value_text !== false)) { + $unit_text = db_get_sql ('SELECT unit + FROM tagente_modulo + WHERE id_agente_modulo = ' . $id_module); + $unit_text = trim(io_safe_output($unit_text)); + + $percentile = $value_text; + } + else { + $unit_text = "%"; + } + + if($width < 200){ + $img = progress_circular_bar_interior($id, $percentile, 200,200, $border_color); + + } + else{ + $img = progress_circular_bar_interior($id, $percentile, $width, $width, $border_color); } } diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php index 4d25701115..9b839b7e02 100644 --- a/pandora_console/include/graphs/functions_d3.php +++ b/pandora_console/include/graphs/functions_d3.php @@ -310,7 +310,7 @@ function ux_console_phases_donut ($phases, $id, $return = false) { return $output; } -function progress_circular_bar ($id, $percentile, $width, $height, $color) { +function progress_circular_bar ($id, $percentile, $width, $height, $color, $unit = "%") { global $config; $recipient_name = "circular_progress_bar_" . $id; @@ -321,13 +321,13 @@ function progress_circular_bar ($id, $percentile, $width, $height, $color) { $output .= "
"; $output .= include_javascript_d3(true); $output .= ""; return $output; } -function progress_circular_bar_interior ($id, $percentile, $width, $height, $color) { +function progress_circular_bar_interior ($id, $percentile, $width, $height, $color, $unit = "%") { global $config; $recipient_name = "circular_progress_bar_interior_" . $id; @@ -338,7 +338,7 @@ function progress_circular_bar_interior ($id, $percentile, $width, $height, $col $output .= "
"; $output .= include_javascript_d3(true); $output .= ""; return $output; diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 0992d81fcf..9ce7c9c42d 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -1494,7 +1494,7 @@ function print_phases_donut (recipient, phases) { } } -function print_circular_progress_bar (recipient, percentile, width, height, color) { +function print_circular_progress_bar (recipient, percentile, width, height, color, unit) { var twoPi = Math.PI * 2; var radius = (width / 2) - 10; var border = 20; @@ -1556,7 +1556,7 @@ function print_circular_progress_bar (recipient, percentile, width, height, colo .style("font-family", "arial") .style("font-weight", "bold") .style("font-size", 16) - .text("%") + .text(unit) .attr('text-anchor', 'middle') .attr('dy', '40'); @@ -1579,7 +1579,7 @@ function print_circular_progress_bar (recipient, percentile, width, height, colo })(); } -function print_interior_circular_progress_bar (recipient, percentile, width, height, color) { +function print_interior_circular_progress_bar (recipient, percentile, width, height, color, unit) { var twoPi = Math.PI * 2; var radius = (width / 2) - 30; var radius2 = (width / 2) - 10; @@ -1655,7 +1655,7 @@ function print_interior_circular_progress_bar (recipient, percentile, width, hei .style("font-family", "arial") .style("font-weight", "bold") .style("font-size", 16) - .text("%") + .text(unit) .attr('text-anchor', 'middle') .attr('dy', '40');