Merge branch 'ent-2140-Faltan-OIDs-SNMP-Interface-Wizard' into 'develop'
Added selector for all or common modules- #2140 See merge request artica/pandorafms!2540
This commit is contained in:
commit
657515d79c
|
@ -77,6 +77,7 @@ if (is_ajax()) {
|
|||
}
|
||||
|
||||
$get_modules_json_for_multiple_snmp = (bool) get_parameter('get_modules_json_for_multiple_snmp', 0);
|
||||
$get_common_modules = (bool) get_parameter('get_common_modules', 1);
|
||||
if ($get_modules_json_for_multiple_snmp) {
|
||||
include_once 'include/graphs/functions_utils.php';
|
||||
|
||||
|
@ -100,7 +101,16 @@ if (is_ajax()) {
|
|||
if ($out === false) {
|
||||
$out = $oid_snmp;
|
||||
} else {
|
||||
$out = array_intersect($out, $oid_snmp);
|
||||
$commons = array_intersect($out, $oid_snmp);
|
||||
if ($get_common_modules) {
|
||||
// Common modules is selected (default)
|
||||
$out = $commons;
|
||||
} else {
|
||||
// All modules is selected
|
||||
$array1 = array_diff($out, $oid_snmp);
|
||||
$array2 = array_diff($oid_snmp, $out);
|
||||
$out = array_merge($commons, $array1, $array2);
|
||||
}
|
||||
}
|
||||
|
||||
$oid_snmp = [];
|
||||
|
|
|
@ -595,7 +595,24 @@ if (!empty($interfaces_list)) {
|
|||
$table->data[0][2] = '<b>'.__('Modules').'</b>';
|
||||
|
||||
$table->data[1][0] = html_print_select($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
|
||||
$table->data[1][1] = html_print_image('images/darrowright.png', true);
|
||||
|
||||
$table->data[1][1] = __('When selecting interfaces');
|
||||
$table->data[1][1] .= '<br>';
|
||||
$table->data[1][1] .= html_print_select(
|
||||
[
|
||||
1 => __('Show common modules'),
|
||||
0 => __('Show all modules'),
|
||||
],
|
||||
'modules_selection_mode',
|
||||
1,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
$table->data[1][2] = html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
|
||||
|
||||
|
@ -645,10 +662,16 @@ $(document).ready (function () {
|
|||
$("#form_interfaces").hide ();
|
||||
});
|
||||
|
||||
// When select interfaces changes
|
||||
$("#modules_selection_mode").change (function() {
|
||||
$("#id_snmp").trigger('change');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||
var idSNMP = Array();
|
||||
var get_common_modules = $("#modules_selection_mode option:selected").val();
|
||||
|
||||
jQuery.each ($("#id_snmp option:selected"), function (i, val) {
|
||||
idSNMP.push($(val).val());
|
||||
|
@ -660,6 +683,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
|||
jQuery.post ('ajax.php',
|
||||
{"page" : "godmode/agentes/agent_manager",
|
||||
"get_modules_json_for_multiple_snmp": 1,
|
||||
"get_common_modules" : get_common_modules,
|
||||
"id_snmp[]": idSNMP,
|
||||
"id_snmp_serialize": $("#hidden-id_snmp_serialize").val()
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue