#11693 fix warning/critical inverse for serverdata

This commit is contained in:
Jonathan 2023-08-02 09:26:14 +02:00
parent ecd8c8c116
commit f063c5182e
2 changed files with 20 additions and 4 deletions

View File

@ -1523,9 +1523,9 @@ if ($update_module === true || $create_module === true) {
$warning_threshold_check_type = get_parameter('warning_thresholds_checks');
if ($warning_threshold_check_type === 'normal_warning') {
$percentage_warning = 0;
$warning_inverse = (get_parameter_switch('warning_inverse_string', 0) === 0) ? 0 : 1;
$warning_inverse = 0;
} else if ($warning_threshold_check_type === 'warning_inverse') {
$warning_inverse = (get_parameter_switch('warning_inverse_string', 0) === 0) ? 0 : 1;
$warning_inverse = (int) get_parameter('warning_inverse_string_sent');
$percentage_warning = 0;
} else {
$percentage_warning = (int) get_parameter('warning_inverse_string_sent');
@ -1536,9 +1536,9 @@ if ($update_module === true || $create_module === true) {
$critical_threshold_check_type = get_parameter('critical_thresholds_checks');
if ($critical_threshold_check_type === 'normal_critical') {
$percentage_critical = 0;
$critical_inverse = (get_parameter_switch('critical_inverse_string', 0) === 0) ? 0 : 1;
$critical_inverse = 0;
} else if ($critical_threshold_check_type === 'critical_inverse') {
$critical_inverse = (get_parameter_switch('critical_inverse_string', 0) === 0) ? 0 : 1;
$critical_inverse = (int) get_parameter('critical_inverse_string_sent');
$percentage_critical = 0;
} else {
$percentage_critical = (int) get_parameter('critical_inverse_string_sent');

View File

@ -1847,6 +1847,22 @@ $(document).ready (function () {
setModuleType(type_name_selected);
});
$('#checkbox-warning_inverse_string').change( function () {
if ($(this).prop('checked') === true) {
$('input[name="warning_thresholds_checks"]').val('warning_inverse');
} else {
$('input[name="warning_thresholds_checks"]').val('normal_warning');
}
});
$('#checkbox-critical_inverse_string').change( function () {
if ($(this).prop('checked') === true) {
$('input[name="critical_thresholds_checks"]').val('critical_inverse');
} else {
$('input[name="critical_thresholds_checks"]').val('normal_critical');
}
});
function setModuleType(type_name_selected) {
if (type_name_selected.match(/_string$/) == null) {
// Hide string fields.