#10974 Warning threshold Inverse Interval and Critical threshold Inverse Interval set

This commit is contained in:
Jorge Rincon 2023-04-18 09:31:22 +02:00
parent b1a5e9e473
commit e33fadb8eb
2 changed files with 32 additions and 11 deletions

View File

@ -1519,10 +1519,31 @@ if ($update_module === true || $create_module === true) {
$critical_instructions = (string) get_parameter('critical_instructions');
$warning_instructions = (string) get_parameter('warning_instructions');
$unknown_instructions = (string) get_parameter('unknown_instructions');
$critical_inverse = (int) get_parameter('critical_inverse');
$warning_inverse = (int) get_parameter('warning_inverse');
$percentage_critical = (int) get_parameter('percentage_critical');
$percentage_warning = (int) get_parameter('percentage_warning');
// Warning thresholds
$warning_threshold_check_type = get_parameter('warning_thresholds_checks');
if ($warning_threshold_check_type === 'normal_warning') {
$percentage_warning = 0;
$warning_inverse = 0;
} else if ($warning_threshold_check_type === 'warning_inverse') {
$warning_inverse = (int) get_parameter('warning_inverse_string_sent');
$percentage_warning = 0;
} else {
$percentage_warning = (int) get_parameter('warning_inverse_string_sent');
$warning_inverse = 0;
}
// Critical thresholds
$critical_threshold_check_type = get_parameter('critical_thresholds_checks');
if ($critical_threshold_check_type === 'normal_critical') {
$percentage_critical = 0;
$critical_inverse = 0;
} else if ($critical_threshold_check_type === 'critical_inverse') {
$critical_inverse = (int) get_parameter('critical_inverse_string_sent');
$percentage_critical = 0;
} else {
$percentage_critical = (int) get_parameter('critical_inverse_string_sent');
$critical_inverse = 0;
}
$id_category = (int) get_parameter('id_category');

View File

@ -473,9 +473,9 @@ $tableBasicThresholds->data['warning_threshold'][1] .= html_print_input_text(
$tableBasicThresholds->data['switch_warning_threshold'][0] .= html_print_switch_radio_button(
[
html_print_radio_button_extended('warning_thresholds_checks', 'normal_warning', __('Normal'), ($percentage_warning && $warning_inverse) === false, false, '', '', true, false, '', 'radius-normal_warning'),
html_print_radio_button_extended('warning_thresholds_checks', 'warning_inverse', __('Inverse interval'), $warning_inverse, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-warning_inverse'),
html_print_radio_button_extended('warning_thresholds_checks', 'percentage_warning', __('Percentage'), $percentage_warning, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-percentage_warning'),
html_print_radio_button_extended('warning_thresholds_checks', 'normal_warning', __('Normal'), ($percentage_warning && $warning_inverse) ? false : 'normal_warning', false, '', '', true, false, '', 'radius-normal_warning'),
html_print_radio_button_extended('warning_thresholds_checks', 'warning_inverse', __('Inverse interval'), ($warning_inverse) ? 'warning_inverse' : false, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-warning_inverse'),
html_print_radio_button_extended('warning_thresholds_checks', 'percentage_warning', __('Percentage'), ($percentage_warning) ? 'percentage_warning' : false, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-percentage_warning'),
],
[ 'class' => 'margin-top-10' ],
true
@ -556,9 +556,9 @@ $tableBasicThresholds->data['critical_threshold'][1] .= html_print_input_text(
$tableBasicThresholds->data['switch_critical_threshold'][0] .= html_print_switch_radio_button(
[
html_print_radio_button_extended('critical_thresholds_checks', 'normal_critical', __('Normal'), ($percentage_critical && $critical_inverse) === false, false, '', '', true, false, '', 'radius-normal_critical'),
html_print_radio_button_extended('critical_thresholds_checks', 'critical_inverse', __('Inverse interval'), $critical_inverse, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-critical_inverse'),
html_print_radio_button_extended('critical_thresholds_checks', 'percentage_critical', __('Percentage'), $percentage_critical, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-percentage_critical'),
html_print_radio_button_extended('critical_thresholds_checks', 'normal_critical', __('Normal'), ($percentage_critical && $critical_inverse) ? false : 'normal_critical', false, '', '', true, false, '', 'radius-normal_critical'),
html_print_radio_button_extended('critical_thresholds_checks', 'critical_inverse', __('Inverse interval'), ($critical_inverse) ? 'critical_inverse' : false, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-critical_inverse'),
html_print_radio_button_extended('critical_thresholds_checks', 'percentage_critical', __('Percentage'), ($percentage_critical) ? 'percentage_critical' : false, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-percentage_critical'),
],
[ 'class' => 'margin-top-10' ],
true
@ -1978,7 +1978,7 @@ $(document).ready (function () {
}
});
});