diff --git a/pandora_console/include/ajax/inventory.ajax.php b/pandora_console/include/ajax/inventory.ajax.php new file mode 100644 index 0000000000..71fac8d0ec --- /dev/null +++ b/pandora_console/include/ajax/inventory.ajax.php @@ -0,0 +1,45 @@ + $id_server]); + if (is_array($server_name) === true && count($server_name) > 0) { + $agent_modules = inventory_get_agent_modules($id_agent, 'all', $id_server, reset($server_name)); + } + } else { + $agent_modules = inventory_get_agent_modules($id_agent); + } + + echo json_encode($agent_modules); +} diff --git a/pandora_console/operation/inventory/inventory.php b/pandora_console/operation/inventory/inventory.php index bdfaa529fc..432ee3e8d8 100755 --- a/pandora_console/operation/inventory/inventory.php +++ b/pandora_console/operation/inventory/inventory.php @@ -680,6 +680,7 @@ $params['print_hidden_input_idagent'] = true; $params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent'; $params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_value'] = $inventory_id_agent; +$params['javascript_function_action_after_select'] = 'loadModulesFromAgent'; if ($is_metaconsole === true) { $params['print_input_id_server'] = true; $params['input_id_server_id'] = 'hidden-autocomplete_id_server'; @@ -1361,7 +1362,7 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript /* - active_inventory_submit(); + //active_inventory_submit(); $("#id_group").click ( function () { @@ -1439,5 +1440,38 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript closeText: '' });*/ }); + + function loadModulesFromAgent(e){ + const id_agent = $('#hidden-autocomplete_id_agent').val(); + const text_agent = $('#text-agent').val(); + let server = 0; + if($('#hidden-autocomplete_id_server').length > 0) { + server = $('#hidden-autocomplete_id_server').val(); + } + + if(text_agent === 'All') return; + jQuery.ajax ({ + data: { + id_agent, + page: 'include/ajax/inventory.ajax', + id_server: server + }, + type: "POST", + url: action="", + dataType: "json", + success: function (data) { + if (data) { + console.log(data); + $("#module_inventory_general_view").empty(); + $("#module_inventory_general_view").append ($("")); + $("#module_inventory_general_view").append ($("")); + jQuery.each (data, function (id, value) { + $("#module_inventory_general_view").append ($("")); + }); + } + } + }); + } + /* ]]> */