diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 7f97a7d1ec..ecdc0e7926 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -456,8 +456,9 @@ if (modules_is_string_type($id_module_type) || $edit) { ).''; } - $table_simple->data[2][1] .= '
'.__('Inverse interval').''; - $table_simple->data[2][1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true, $disabledBecauseInPolicy); +$table_simple->data[2][1] .= '
'.__('Inverse interval').''; +$table_simple->data[2][1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true, $disabledBecauseInPolicy); +$table_simple->data[2][1] .= '
'; if (modules_is_string_type($id_module_type) === false) { $table_simple->data[2][1] .= '
'.__('Percentage').''; @@ -515,8 +516,10 @@ if (modules_is_string_type($id_module_type) || $edit) { ).''; } -$table_simple->data[3][1] .= '
'.__('Inverse interval').''; +$table_simple->data[3][1] .= '
'.__('Inverse interval').''; $table_simple->data[3][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy); +$table_simple->data[3][1] .= '
'; + if (modules_is_string_type($id_module_type) === false) { $table_simple->data[3][1] .= '
'.__('Percentage').''; @@ -1644,11 +1647,64 @@ $(document).ready (function () { $('#text-max_critical').val(0); } }); + + if ($('#checkbox-warning_inverse').prop('checked') === true) { + $('#percentage_warning').hide(); + } + + if ($('#checkbox-critical_inverse').prop('checked') === true) { + $('#percentage_critical').hide(); + } + + if ($('#checkbox-percentage_warning').prop('checked') === true) { + $('#warning_inverse').hide(); + } + + if ($('#checkbox-percentage_critical').prop('checked') === true) { + $('#critical_inverse').hide(); + } + $('#checkbox-warning_inverse').change (function() { paint_graph_values(); - }); + if ($('#checkbox-warning_inverse').prop('checked') === true){ + $('#checkbox-percentage_warning').prop('checked', false); + $('#percentage_warning').hide(); + } else { + $('#percentage_warning').show(); + } + }); + $('#checkbox-critical_inverse').change (function() { paint_graph_values(); + + if ($('#checkbox-critical_inverse').prop('checked') === true){ + $('#checkbox-percentage_critical').prop('checked', false); + $('#percentage_critical').hide(); + } else { + $('#percentage_critical').show(); + } + }); + + $('#checkbox-percentage_warning').change (function() { + paint_graph_values(); + if ($('#checkbox-percentage_warning').prop('checked') === true){ + $('#checkbox-warning_inverse').prop('checked', false); + $('#warning_inverse').hide(); + } else { + $('#warning_inverse').show(); + } + }); + + $('#checkbox-percentage_critical').change (function() { + paint_graph_values(); + if ($('#checkbox-percentage_critical').prop('checked') === true){ + $('#checkbox-critical_inverse').prop('checked', false); + $('#critical_inverse').hide(); + } + else { + $('#critical_inverse').show(); + } + }); }); @@ -1931,6 +1987,43 @@ function paint_graph_values(){ //messages error var message_error_warning = ''; var message_error_critical = ''; + var message_error_percentage = ''; + + + //Percentage selector + var percentage_w = $('#checkbox-percentage_warning').prop('checked'); + var percentage_c = $('#checkbox-percentage_critical').prop('checked'); + + if(percentage_w == true || percentage_c == true) { + d3.select("#svg_dinamic rect").remove(); + //create svg + var svg = d3.select("#svg_dinamic"); + svg.selectAll("g").remove(); + if (percentage_w === true) { + if(max_w < 0 || min_w < 0) { + paint_graph_status(0,0,0,0,0,0,1,0,legend_normal,legend_warning,legend_critical,message_error_percentage,message_error_percentage); + } else { + $("#text-max_warning").removeClass("input_error"); + $("#text-min_warning").removeClass("input_error"); + } + + } + + if(percentage_c === true) { + if(max_c < 0 || min_c < 0) { + paint_graph_status(0,0,0,0,0,0,0,1,legend_normal,legend_warning,legend_critical,message_error_percentage,message_error_percentage); + } else { + $("#text-min-critical").removeClass("input_error"); + $("#text-max_critical").removeClass("input_error"); + + } + } + + return; + + } else { + $('#svg_dinamic').show(); + } //if haven't error if(max_w == 0 || max_w > min_w){ diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index ba1e7e7869..6fb13482e0 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -1876,6 +1876,31 @@ $(document).ready (function () { } } }); + + $('#warning_inverse').change(function() { + if($(this).val() == 1) { + $("#percentage_warning").val('0').change() + } + }); + + $('#critical_inverse').change(function() { + if($(this).val() == 1) { + $("#percentage_critical").val('0').change(); + } + }); + + $('#percentage_warning').change(function() { + if($(this).val() == 1) { + $("#warning_inverse").val('0').change() + } + }); + + $('#percentage_critical').change(function() { + if($(this).val() == 1) { + $("#critical_inverse").val('0').change() + } + }); + }); diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index b26af8bbbe..559ca0a376 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -829,6 +829,60 @@ $(document).ready (function () { }); $("#snmp_version" ).trigger("change"); + + if ($('#checkbox-warning_inverse').prop('checked') === true) { + $('#percentage_warning').hide(); + } + + if ($('#checkbox-critical_inverse').prop('checked') === true) { + $('#percentage_critical').hide(); + } + + if ($('#checkbox-percentage_warning').prop('checked') === true) { + $('#warning_inverse').hide(); + } + + if ($('#checkbox-percentage_critical').prop('checked') === true) { + $('#critical_inverse').hide(); + } + + $('#checkbox-warning_inverse').change (function() { + if ($('#checkbox-warning_inverse').prop('checked') === true){ + $('#checkbox-percentage_warning').prop('checked', false); + $('#percentage_warning').hide(); + } else { + $('#percentage_warning').show(); + } + }); + + $('#checkbox-critical_inverse').change (function() { + if ($('#checkbox-critical_inverse').prop('checked') === true){ + $('#checkbox-percentage_critical').prop('checked', false); + $('#percentage_critical').hide(); + } else { + $('#percentage_critical').show(); + } + }); + + $('#checkbox-percentage_warning').change (function() { + if ($('#checkbox-percentage_warning').prop('checked') === true){ + $('#checkbox-warning_inverse').prop('checked', false); + $('#warning_inverse').hide(); + } else { + $('#warning_inverse').show(); + } + }); + + $('#checkbox-percentage_critical').change (function() { + if ($('#checkbox-percentage_critical').prop('checked') === true){ + $('#checkbox-critical_inverse').prop('checked', false); + $('#critical_inverse').hide(); + } + else { + $('#critical_inverse').show(); + } + }); + }); data[4][1] .= html_print_input_text( 1024, true ).''; -$table->data[4][1] .= '
'.__('Inverse interval').''; +$table->data[4][1] .= '
'.__('Inverse interval').''; $table->data[4][1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true); +$table->data[4][1] .= '
'; $table->data[4][1] .= '
'.__('Percentage').''; $table->data[4][1] .= html_print_checkbox('percentage_warning', 1, $percentage_warning, true); @@ -224,8 +227,9 @@ $table->data[5][1] .= html_print_input_text( 1024, true ).''; -$table->data[5][1] .= '
'.__('Inverse interval').''; +$table->data[5][1] .= '
'.__('Inverse interval').''; $table->data[5][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true); +$table->data[5][1] .= '
'; $table->data[5][1] .= '
'.__('Percentage').''; $table->data[5][1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true); @@ -580,11 +584,64 @@ $next_row++; $('#text-max_critical').val(0); } }); + + if ($('#checkbox-warning_inverse').prop('checked') === true) { + $('#percentage_warning').hide(); + } + + if ($('#checkbox-critical_inverse').prop('checked') === true) { + $('#percentage_critical').hide(); + } + + if ($('#checkbox-percentage_warning').prop('checked') === true) { + $('#warning_inverse').hide(); + } + + if ($('#checkbox-percentage_critical').prop('checked') === true) { + $('#critical_inverse').hide(); + } + $('#checkbox-warning_inverse').change (function() { paint_graph_values(); - }); + if ($('#checkbox-warning_inverse').prop('checked') === true){ + $('#checkbox-percentage_warning').prop('checked', false); + $('#percentage_warning').hide(); + } else { + $('#percentage_warning').show(); + } + }); + $('#checkbox-critical_inverse').change (function() { paint_graph_values(); + + if ($('#checkbox-critical_inverse').prop('checked') === true){ + $('#checkbox-percentage_critical').prop('checked', false); + $('#percentage_critical').hide(); + } else { + $('#percentage_critical').show(); + } + }); + + $('#checkbox-percentage_warning').change (function() { + paint_graph_values(); + if ($('#checkbox-percentage_warning').prop('checked') === true){ + $('#checkbox-warning_inverse').prop('checked', false); + $('#warning_inverse').hide(); + } else { + $('#warning_inverse').show(); + } + }); + + $('#checkbox-percentage_critical').change (function() { + paint_graph_values(); + if ($('#checkbox-percentage_critical').prop('checked') === true){ + $('#checkbox-critical_inverse').prop('checked', false); + $('#critical_inverse').hide(); + } + else { + $('#critical_inverse').show(); + } + }); }); @@ -648,6 +705,43 @@ $next_row++; //messages error var message_error_warning = ''; var message_error_critical = ''; + var message_error_percentage = ''; + + + //Percentage selector + var percentage_w = $('#checkbox-percentage_warning').prop('checked'); + var percentage_c = $('#checkbox-percentage_critical').prop('checked'); + + if(percentage_w == true || percentage_c == true) { + d3.select("#svg_dinamic rect").remove(); + //create svg + var svg = d3.select("#svg_dinamic"); + svg.selectAll("g").remove(); + if (percentage_w === true) { + if(max_w < 0 || min_w < 0) { + paint_graph_status(0,0,0,0,0,0,1,0,legend_normal,legend_warning,legend_critical,message_error_percentage,message_error_percentage); + } else { + $("#text-max_warning").removeClass("input_error"); + $("#text-min_warning").removeClass("input_error"); + } + + } + + if(percentage_c === true) { + if(max_c < 0 || min_c < 0) { + paint_graph_status(0,0,0,0,0,0,0,1,legend_normal,legend_warning,legend_critical,message_error_percentage,message_error_percentage); + } else { + $("#text-min-critical").removeClass("input_error"); + $("#text-max_critical").removeClass("input_error"); + + } + } + + return; + +} else { + $('#svg_dinamic').show(); +} //if haven't error if(max_w == 0 || max_w > min_w){ diff --git a/pandora_console/godmode/modules/manage_network_components_form_wizard.php b/pandora_console/godmode/modules/manage_network_components_form_wizard.php index 9c2ec3c27d..d3d4b6e4d3 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_wizard.php +++ b/pandora_console/godmode/modules/manage_network_components_form_wizard.php @@ -389,10 +389,13 @@ $data[1] .= ''; $data[1] .= ''.__('String').'  '; $data[1] .= html_print_input_text('str_warning', $str_warning, '', 5, 1024, true).''; // Warning inverse values. -$data[1] .= '
'.__('Inverse interval').' '; +$data[1] .= '
'.__('Inverse interval').' '; $data[1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true); -$data[1] .= '
'.__('Percentage').' '; +$data[1] .= '
'; + +$data[1] .= '
'.__('Percentage').' '; $data[1] .= html_print_checkbox('percentage_warning', 1, $percentage_warning, true); +$data[1] .= '
'; $data[2] = ' '; $table->colspan['warning-svg-row'][2] = 2; @@ -427,10 +430,13 @@ $data[1] .= ''; $data[1] .= ''.__('String').'  '; $data[1] .= html_print_input_text('str_critical', $str_critical, '', 5, 1024, true).''; // Critical inverse values. -$data[1] .= '
'.__('Inverse interval').' '; +$data[1] .= '
'.__('Inverse interval').' '; $data[1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true); -$data[1] .= '
'.__('Percentage').' '; +$data[1] .= '
'; + +$data[1] .= ''.__('Percentage').' '; $data[1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true); +$data[1] .= '
'; push_table_row($data, 'critical-row'); diff --git a/pandora_console/include/class/AgentWizard.class.php b/pandora_console/include/class/AgentWizard.class.php index f6b7afdd97..79c9af84c5 100644 --- a/pandora_console/include/class/AgentWizard.class.php +++ b/pandora_console/include/class/AgentWizard.class.php @@ -4105,7 +4105,7 @@ class AgentWizard extends HTML $module['inv_warning'], true, false, - '', + 'change_control(this, \''.$uniqueId.'\')', false, 'form="form-create-modules"' ), @@ -4122,7 +4122,7 @@ class AgentWizard extends HTML $module['perc_warning'], true, false, - '', + 'change_control(this, \''.$uniqueId.'\')', false, 'form="form-create-modules"' ), @@ -4184,12 +4184,12 @@ class AgentWizard extends HTML 'class' => 'wizard-column-levels-check', 'style' => 'margin-top: 0.3em;', 'content' => html_print_checkbox( - 'module-critical_inv_'.$uniqueId, + 'module-critical-inv-'.$uniqueId, $module['inv_critical'], $module['inv_critical'], true, false, - '', + 'change_control(this, \''.$uniqueId.'\')', false, 'form="form-create-modules"' ), @@ -4207,7 +4207,7 @@ class AgentWizard extends HTML $module['perc_critical'], true, false, - '', + 'change_control(this,\''.$uniqueId.'\')', false, 'form="form-create-modules"' ), @@ -5922,6 +5922,29 @@ class AgentWizard extends HTML }); } + + function change_control(checkbox, uniqueId) { + var checkbox_name = $(checkbox).attr('name'); + + if($(checkbox).prop('checked', true)) { + if(checkbox_name.match(/warning-inv/gm) !== null) { + $('#checkbox-module-warning-perc-'+uniqueId).prop('checked', false); + } + + if(checkbox_name.match(/critical-inv/gm) !== null) { + $('#checkbox-module-critical-perc-'+uniqueId).prop('checked', false); + } + + if(checkbox_name.match(/warning-perc/gm) !== null) { + $('#checkbox-module-warning-inv-'+uniqueId).prop('checked', false); + } + + if(checkbox_name.match(/critical-perc/gm) !== null) { + $('#checkbox-module-critical-inv-'+uniqueId).prop('checked', false); + } + } + + }