Merge branch '1378-grafica-donut-en-consola-visual-dev' into 'develop'

1378 grafica donut en consola visual dev

See merge request artica/pandorafms!1051
This commit is contained in:
vgilc 2017-11-13 09:39:43 +01:00
commit 67373e39ac
6 changed files with 86 additions and 11 deletions

View File

@ -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});
@ -2475,7 +2486,7 @@ function setDonutsGraph (id_data, values) {
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/donut-graph.png');
if($('#text-width').val() == 0 || $('#text-height').val() == 0){
if($('#text-width_percentile').val() == 0){
// Image size
}
else{

View File

@ -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);
@ -611,7 +612,7 @@ switch ($action) {
}
$values['border_color'] = $resume_color;
$values['type'] = DONUT_GRAPH;
$values['id_agent'] = $id_agent_string;
break;
case 'box_item':
$values['border_width'] = $border_width;
@ -749,6 +750,7 @@ switch ($action) {
case 'donut_graph':
unset($values['border_color']);
unset($values['width']);
unset($values['id_agent']);
break;
case 'box_item':
unset($values['border_width']);
@ -893,6 +895,20 @@ switch ($action) {
case 'donut_graph':
$elementFields['width_percentile'] = $elementFields['width'];
$elementFields['resume_color'] = $elementFields['border_color'];
$elementFields['id_agent_string'] = $elementFields['id_agent'];
if (($elementFields['id_agent_string'] != 0)
&& ($elementFields['id_layout_linked'] == 0)) {
$modules = agents_get_modules(
$elementFields['id_agent'], false,
array('disabled' => 0,
'id_agente' => $elementFields['id_agent'],
'tagente_modulo.id_tipo_modulo IN' => "(17,23,3,10,33)"));
$elementFields['modules_html'] = '<option value="0">--</option>';
foreach ($modules as $id => $name) {
$elementFields['modules_html'] .= '<option value="' . $id . '">' . io_safe_output($name) . '</option>';
}
}
break;
case 'module_graph':
@ -1010,9 +1026,10 @@ switch ($action) {
break;
case 'donut_graph':
$values['type'] = DONUT_GRAPH;
$values['width'] = $width;
$values['height'] = $height;
$values['width'] = $width_percentile;
$values['height'] = $width_percentile;
$values['border_color'] = $resume_color;
$values['id_agent'] = $id_agent_string;
break;
case 'module_graph':
$values['type'] = MODULE_GRAPH;

View File

@ -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) . ')

View File

@ -2583,7 +2583,7 @@ function get_donut_module_data ($id_module) {
$total = 0;
foreach ($values as $val) {
if ($index < $max_elements) {
$data = explode(":", $val);
$data = explode(",", $val);
$values_to_return[$index]['tag_name'] = $data[0] . ", " . $data[1];
$values_to_return[$index]['color'] = $colors[$index];
$values_to_return[$index]['value'] = (int)$data[1];
@ -2591,7 +2591,7 @@ function get_donut_module_data ($id_module) {
$index++;
}
else {
$data = explode(":", $val);
$data = explode(",", $val);
$values_to_return[$index]['tag_name'] = __('Others') . ", " . $data[1];
$values_to_return[$index]['color'] = $colors[$index];
$values_to_return[$index]['value'] += (int)$data[1];
@ -2602,7 +2602,7 @@ function get_donut_module_data ($id_module) {
foreach ($values_to_return as $ind => $donut_data) {
$values_to_return[$ind]['percent'] = ($donut_data['value'] * 100) / $total;
}
return $values_to_return;
}

View File

@ -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'] = '<td align="left">' .
__('Agent') . '</td>';
$params = array();
@ -320,6 +320,39 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['agent_row']['html'] .= '<td align="left">' .
ui_print_agent_autocomplete_input($params) .
'</td>';
$form_items['agent_row_string'] = array();
$form_items['agent_row_string']['items'] = array('donut_graph');
$form_items['agent_row_string']['html'] = '<td align="left">' .
__('Agent') . '</td>';
$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'] .= '<td align="left">' .
ui_print_agent_autocomplete_input($params) .
'</td>';
$form_items['module_row'] = array();
$form_items['module_row']['items'] = array('static_graph',
@ -731,7 +764,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('donut_graph', __('Serialized pie graph'), 'left', false, 'donut_graph_min', true);
visual_map_print_button_editor('bars_graph', __('Bars Graph'), 'left', false, 'bars_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);

View File

@ -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 )