diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index f987292126..c396634f67 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -2003,23 +2003,14 @@ ui_require_jquery_file('json'); var type_names = jQuery.parseJSON(Base64.decode($('#hidden-type_names').val())); var type_name_selected = type_names[type_selected]; - if ($('#radius-percentage_warning').prop('checked') === true || $('#radius-percentage_critical').prop('checked') === true || type_name_selected == 'generic_data_string') { + if (($('#radius-percentage_warning').prop('checked') === true && $('#radius-percentage_critical').prop('checked') === true) || type_name_selected == 'generic_data_string') { + paint_graph_values(); $("#svg_dinamic").hide(); } else { paint_graph_values(); $("#svg_dinamic").show(); } - if ($('#radius-percentage_warning').prop('checked') === true) { - $('#radius-warning_inverse').hide(); - $('#label-radius-warning_inverse').hide(); - } - - if ($('#radius-warning_inverse').prop('checked') === true) { - $('#radius-percentage_warning').hide(); - $('#label-radius-percentage_warning').hide(); - } - if ($('#radius-normal_warning').prop('checked') === true) { $('#radius-warning_inverse').show(); $('#label-radius-warning_inverse').show(); @@ -2027,17 +2018,6 @@ ui_require_jquery_file('json'); $('#label-radius-percentage_warning').show(); } - - if ($('#radius-percentage_critical').prop('checked') === true) { - $('#radius-critical_inverse').hide(); - $('#label-radius-critical_inverse').hide(); - } - - if ($('#radius-critical_inverse').prop('checked') === true) { - $('#radius-percentage_critical').hide(); - $('#label-radius-percentage_critical').hide(); - } - if ($('#radius-normal_critical').prop('checked') === true) { $('#radius-critical_inverse').show(); $('#label-radius-critical_inverse').show(); @@ -2354,30 +2334,48 @@ ui_require_jquery_file('json'); var message_error_percentage = ''; //if haven't error - if (max_w == 0 || max_w > min_w) { - if (max_c == 0 || max_c > min_c) { - paint_graph_status( - min_w, max_w, min_c, max_c, inverse_w, - inverse_c, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical - ); + if (max_w == 0 || max_w > min_w || $('#radius-percentage_warning').is(':checked') === true) { + if (max_c == 0 || max_c > min_c || $('#radius-percentage_critical').is(':checked') === true) { + error_c = 0; + error_w = 0; } else { error_c = 1; - paint_graph_status( - 0, 0, 0, 0, 0, 0, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical - ); + min_w = 0; + max_w = 0; + min_c = 0; + max_c = 0; + inverse_w = 0; + inverse_c = 0; } } else { + if (max_c !== 0 && max_c < min_c && $('#radius-percentage_critical').is(':checked') === false) { + error_c = 2; + } error_w = 1; - paint_graph_status( - 0, 0, 0, 0, 0, 0, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical - ); + min_w = 0; + max_w = 0; + min_c = 0; + max_c = 0; + inverse_w = 0; + inverse_c = 0; } + + if ($('#radius-percentage_warning').is(':checked') === true){ + min_w = 0; + max_w = 0; + } + + if ($('#radius-percentage_critical').is(':checked') === true){ + min_c = 0; + max_c = 0; + } + + paint_graph_status( + min_w, max_w, min_c, max_c, inverse_w, + inverse_c, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical + ); } /* ]]> */ diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 577ac7a30c..1a59ab50e8 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -1653,6 +1653,10 @@ function paint_graph_status( max_c = 0; } + // Remove Error class. + $("#text-max_warning").removeClass("input_error"); + $("#text-max_critical").removeClass("input_error"); + //if haven't errors if (error_w == 0 && error_c == 0) { //parse element @@ -1958,6 +1962,9 @@ function paint_graph_status( .html(message_error_critical) .style("text-anchor", "first"); } + if (error_c == 2) { + $("#text-max_critical").addClass("input_error"); + } } }