mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
MADE only on compatible module types
This commit is contained in:
parent
35db83647a
commit
6612fe96bd
@ -1337,7 +1337,7 @@ if ($update_module === true || $create_module === true) {
|
||||
*/
|
||||
|
||||
$post_process = (string) get_parameter('post_process', 0.0);
|
||||
if (modules_is_string_type($id_module_type) === false) {
|
||||
if (modules_made_compatible($id_module_type) === false) {
|
||||
$made_enabled = (bool) get_parameter_checkbox('made_enabled', 0);
|
||||
} else {
|
||||
$made_enabled = false;
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Common module editor.
|
||||
*
|
||||
@ -1688,8 +1689,9 @@ ui_require_jquery_file('json');
|
||||
$(document).ready(function() {
|
||||
var disabledBecauseInPolicy = <?php echo '\''.((empty($disabledBecauseInPolicy) === true) ? '0' : '1').'\''; ?>;
|
||||
var idModuleType = '<?php echo $type_names_hash[$id_module_type]; ?>';
|
||||
var moduleTypeId = '<?php echo $id_module_type; ?>';
|
||||
if (idModuleType != '') {
|
||||
setModuleType(idModuleType);
|
||||
setModuleType(idModuleType, moduleTypeId);
|
||||
}
|
||||
|
||||
$("#right").click(function() {
|
||||
@ -1766,8 +1768,7 @@ $(document).ready (function () {
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
window.open(
|
||||
'https://pandorafms.com/manual/en/documentation/03_monitoring/02_operations#types_of_modules',
|
||||
'_blank',
|
||||
@ -1786,8 +1787,7 @@ $(document).ready (function () {
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
window.open(
|
||||
'https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitoring#icmp_monitoring',
|
||||
'_blank',
|
||||
@ -1808,8 +1808,7 @@ $(document).ready (function () {
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
window.open(
|
||||
'https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitoring#monitoring_through_network_modules_with_snmp',
|
||||
'_blank',
|
||||
@ -1829,8 +1828,7 @@ $(document).ready (function () {
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
window.open(
|
||||
'https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitoring#tcp_monitoring',
|
||||
'_blank',
|
||||
@ -1849,8 +1847,7 @@ $(document).ready (function () {
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
window.open(
|
||||
'https://pandorafms.com/manual/en/documentation/03_monitoring/06_web_monitoring#creating_web_modules',
|
||||
'_blank',
|
||||
@ -1861,7 +1858,7 @@ $(document).ready (function () {
|
||||
}
|
||||
}
|
||||
|
||||
setModuleType(type_name_selected);
|
||||
setModuleType(type_name_selected, type_selected);
|
||||
});
|
||||
|
||||
$('#checkbox-warning_inverse_string').change(function() {
|
||||
@ -1880,7 +1877,7 @@ $(document).ready (function () {
|
||||
}
|
||||
});
|
||||
|
||||
function setModuleType(type_name_selected) {
|
||||
function setModuleType(type_name_selected, type_selected) {
|
||||
if (type_name_selected.match(/_string$/) == null) {
|
||||
// Hide string fields.
|
||||
$('[id*=str_warning]').hide();
|
||||
@ -1900,10 +1897,7 @@ $(document).ready (function () {
|
||||
$('#percentage_critical').show();
|
||||
// Show dinamic reference.
|
||||
$('#svg_dinamic').show();
|
||||
$('#advanced-made_enabled').show();
|
||||
$('#advanced-caption_made_enabled').show();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Show string fields.
|
||||
$('[id*=str_warning]').show();
|
||||
$('[id*=str_critical]').show();
|
||||
@ -1922,19 +1916,27 @@ $(document).ready (function () {
|
||||
$('#percentage_critical').hide();
|
||||
// Hide dinamic reference.
|
||||
$('#svg_dinamic').hide();
|
||||
$('#advanced-made_enabled').hide();
|
||||
$('#advanced-caption_made_enabled').hide();
|
||||
}
|
||||
|
||||
|
||||
if (type_name_selected.match(/async/) == null) {
|
||||
$('#ff_timeout').hide();
|
||||
$('#ff_timeout_disable').show();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$('#ff_timeout').show();
|
||||
$('#ff_timeout_disable').hide();
|
||||
}
|
||||
|
||||
var madeCompatibleTypes = ["1", "4", "5", "15", "16", "22", "30", "34"];
|
||||
if (madeCompatibleTypes.includes(type_selected)) {
|
||||
$('#advanced-made_enabled').show();
|
||||
$('#advanced-caption_made_enabled').show();
|
||||
} else {
|
||||
$('#advanced-made_enabled').hide();
|
||||
$('#advanced-caption_made_enabled').hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$("#id_module_type").trigger('change');
|
||||
|
||||
@ -1948,17 +1950,14 @@ $(document).ready (function () {
|
||||
//validate post_process. Change ',' by '.'
|
||||
$("#submit-updbutton").click(function() {
|
||||
validate_post_process();
|
||||
});
|
||||
$("#submit-crtbutton").click (function () {
|
||||
}); $("#submit-crtbutton").click(function() {
|
||||
validate_post_process();
|
||||
});
|
||||
|
||||
//Dynamic_interval;
|
||||
disabled_status(disabledBecauseInPolicy); $('#dynamic_interval_select').change(function() {
|
||||
disabled_status(disabledBecauseInPolicy);
|
||||
$('#dynamic_interval_select').change (function() {
|
||||
disabled_status(disabledBecauseInPolicy);
|
||||
});
|
||||
$('#dynamic_interval').change (function() {
|
||||
}); $('#dynamic_interval').change(function() {
|
||||
disabled_status(disabledBecauseInPolicy);
|
||||
});
|
||||
|
||||
@ -1968,26 +1967,22 @@ $(document).ready (function () {
|
||||
$('.hide_dinamic').hide();
|
||||
|
||||
//paint graph stutus critical and warning:
|
||||
paint_graph_values();
|
||||
$('#text-min_warning').on ('input', function() {
|
||||
paint_graph_values(); $('#text-min_warning').on('input', function() {
|
||||
paint_graph_values();
|
||||
if (isNaN($('#text-min_warning').val()) && !($('#text-min_warning').val() == "-")) {
|
||||
$('#text-min_warning').val(0);
|
||||
}
|
||||
});
|
||||
$('#text-max_warning').on ('input', function() {
|
||||
}); $('#text-max_warning').on('input', function() {
|
||||
paint_graph_values();
|
||||
if (isNaN($('#text-max_warning').val()) && !($('#text-max_warning').val() == "-")) {
|
||||
$('#text-max_warning').val(0);
|
||||
}
|
||||
});
|
||||
$('#text-min_critical').on ('input', function() {
|
||||
}); $('#text-min_critical').on('input', function() {
|
||||
paint_graph_values();
|
||||
if (isNaN($('#text-min_critical').val()) && !($('#text-min_critical').val() == "-")) {
|
||||
$('#text-min_critical').val(0);
|
||||
}
|
||||
});
|
||||
$('#text-max_critical').on ('input', function() {
|
||||
}); $('#text-max_critical').on('input', function() {
|
||||
paint_graph_values();
|
||||
if (isNaN($('#text-max_critical').val()) && !($('#text-max_critical').val() == "-")) {
|
||||
$('#text-max_critical').val(0);
|
||||
@ -2050,8 +2045,8 @@ $(document).ready (function () {
|
||||
function disabled_status(disabledBecauseInPolicy) {
|
||||
var dynamic_interval_select_value = $('#dynamic_interval_select').val();
|
||||
var dynamic_interval_value = $('#dynamic_interval_select').val();
|
||||
if(typeof dynamic_interval_select_value != "undefined" && typeof dynamic_interval_value != "undefined"
|
||||
&& dynamic_interval_select_value != 0 && dynamic_interval_value != 0){
|
||||
if (typeof dynamic_interval_select_value != "undefined" && typeof dynamic_interval_value != "undefined" &&
|
||||
dynamic_interval_select_value != 0 && dynamic_interval_value != 0) {
|
||||
$('#text-min_warning').prop('readonly', true);
|
||||
$('#text-min_warning').addClass('readonly');
|
||||
$('#text-max_warning').prop('readonly', true);
|
||||
@ -2122,8 +2117,7 @@ function change_modules_autocomplete_input () {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
module_autocomplete.html(error_icon);
|
||||
}
|
||||
$('#text-autocomplete_module_name').addClass('w90p');
|
||||
@ -2174,11 +2168,14 @@ function add_new_relation () {
|
||||
button.removeClass('working');
|
||||
if (data === false) {
|
||||
iconPlaceholder.html(error_icon);
|
||||
setTimeout( function() { iconPlaceholder.html(''); }, 2000);
|
||||
}
|
||||
else {
|
||||
setTimeout(function() {
|
||||
iconPlaceholder.html('');
|
||||
}, 2000);
|
||||
} else {
|
||||
iconPlaceholder.html(suc_icon);
|
||||
setTimeout( function() { iconPlaceholder.html(''); }, 2000);
|
||||
setTimeout(function() {
|
||||
iconPlaceholder.html('');
|
||||
}, 2000);
|
||||
|
||||
// Add the new row
|
||||
var relationsCount = parseInt($("#hidden-module_relations_count").val());
|
||||
@ -2212,7 +2209,9 @@ function add_new_relation () {
|
||||
error: function(data) {
|
||||
button.removeClass('working');
|
||||
iconPlaceholder.html(error_icon);
|
||||
setTimeout( function() { iconPlaceholder.html(''); }, 2000);
|
||||
setTimeout(function() {
|
||||
iconPlaceholder.html('');
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -2302,22 +2301,34 @@ function validate_post_process() {
|
||||
//function paint graph.
|
||||
function paint_graph_values() {
|
||||
var min_w = parseFloat($('#text-min_warning').val());
|
||||
if(min_w == '0.00' || isNaN(min_w)){ min_w = 0; }
|
||||
if (min_w == '0.00' || isNaN(min_w)) {
|
||||
min_w = 0;
|
||||
}
|
||||
|
||||
var max_w = parseFloat($('#text-max_warning').val());
|
||||
if(max_w == '0.00' || isNaN(max_w)){ max_w = 0; }
|
||||
if (max_w == '0.00' || isNaN(max_w)) {
|
||||
max_w = 0;
|
||||
}
|
||||
|
||||
var min_c = parseFloat($('#text-min_critical').val());
|
||||
if(min_c =='0.00' || isNaN(min_c)){ min_c = 0; }
|
||||
if (min_c == '0.00' || isNaN(min_c)) {
|
||||
min_c = 0;
|
||||
}
|
||||
|
||||
var max_c = parseFloat($('#text-max_critical').val());
|
||||
if(max_c =='0.00' || isNaN(max_c)){ max_c = 0; }
|
||||
if (max_c == '0.00' || isNaN(max_c)) {
|
||||
max_c = 0;
|
||||
}
|
||||
|
||||
var inverse_w = $('input:radio[value=warning_inverse]:checked').val();
|
||||
if(!inverse_w){ inverse_w = 0; }
|
||||
if (!inverse_w) {
|
||||
inverse_w = 0;
|
||||
}
|
||||
|
||||
var inverse_c = $('input:radio[value=critical_inverse]:checked').val();
|
||||
if(!inverse_c){ inverse_c = 0; }
|
||||
if (!inverse_c) {
|
||||
inverse_c = 0;
|
||||
}
|
||||
|
||||
//inicialiced error.
|
||||
var error_w = 0;
|
||||
|
@ -2654,7 +2654,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
|
||||
$values['macros'] = json_encode($module_macros);
|
||||
}
|
||||
|
||||
if (modules_is_string_type($module['id_tipo_modulo']) === true) {
|
||||
if (modules_made_compatible($module['id_tipo_modulo']) === false) {
|
||||
$values['made_enabled'] = 0;
|
||||
}
|
||||
|
||||
|
@ -4762,3 +4762,30 @@ function export_agents_module_csv($filters)
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if modules are compatible with MADE server.
|
||||
*
|
||||
* @param integer $id_tipo_modulo
|
||||
* @retur boolean True if compatible, false otherwise.
|
||||
*/
|
||||
function modules_made_compatible($id_tipo_modulo)
|
||||
{
|
||||
$compatible_types = [
|
||||
1,
|
||||
4,
|
||||
5,
|
||||
15,
|
||||
16,
|
||||
22,
|
||||
30,
|
||||
34,
|
||||
];
|
||||
|
||||
if (array_search($id_tipo_modulo, $compatible_types) === false) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user