Merge branch 'ent-11094-modulo-tipo-plugin-usando-snmp_remote-no-muestra-opciones-de-configuracion-al-actualizar' into 'develop'

Ent 11094 modulo tipo plugin usando snmp remote no muestra opciones de configuracion al actualizar

See merge request artica/pandorafms!5827
This commit is contained in:
Rafael Ameijeiras 2023-05-17 08:05:09 +00:00
commit d57e9c4f16
3 changed files with 38 additions and 4 deletions

View File

@ -153,18 +153,24 @@ foreach ($password_fields as $k => $p) {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function changePluginSelect() { function changePluginSelect() {
if (flag_load_plugin_component) { if (typeof flag_load_plugin_component !== 'undefined' && flag_load_plugin_component) {
flag_load_plugin_component = false; flag_load_plugin_component = false;
return; return;
} }
const moduleId = <?php echo $id_agent_module; ?>;
load_plugin_description($("#id_plugin").val()); load_plugin_description($("#id_plugin").val());
load_plugin_macros_fields('simple-macro'); load_plugin_macros_fields('simple-macro', moduleId);
forced_title_callback(); forced_title_callback();
$('select#id_plugin').select2('close'); $('select#id_plugin').select2('close');
} }
$(document).ready(function () {
changePluginSelect();
});
</script> </script>

View File

@ -38,6 +38,7 @@ if (check_login()) {
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
$get_plugin_macros = get_parameter('get_plugin_macros'); $get_plugin_macros = get_parameter('get_plugin_macros');
$get_module_macros = get_parameter('get_module_macros');
$search_modules = get_parameter('search_modules'); $search_modules = get_parameter('search_modules');
$get_module_detail = get_parameter('get_module_detail', 0); $get_module_detail = get_parameter('get_module_detail', 0);
$get_module_autocomplete_input = (bool) get_parameter( $get_module_autocomplete_input = (bool) get_parameter(
@ -118,6 +119,28 @@ if (check_login()) {
return; return;
} }
if ($get_module_macros && $get_module_macros > 0) {
if (https_is_running()) {
header('Content-type: application/json');
}
$module_id = $get_module_macros;
$module_macros = db_get_value(
'macros',
'tagente_modulo',
'id_agente_modulo',
$module_id
);
$macros = [];
$macros['base64'] = base64_encode($module_macros);
$macros['array'] = json_decode($module_macros, true);
echo json_encode($macros);
return;
}
if ($search_modules) { if ($search_modules) {
if (https_is_running()) { if (https_is_running()) {
header('Content-type: application/json'); header('Content-type: application/json');

View File

@ -997,13 +997,18 @@ function add_macro_field(macro, row_model_id, type_copy, k) {
$("#" + row_id).show(); $("#" + row_id).show();
} }
function load_plugin_macros_fields(row_model_id) { function load_plugin_macros_fields(row_model_id, moduleId = 0) {
// Get plugin macros when selected and load macros fields // Get plugin macros when selected and load macros fields
var id_plugin = $("#id_plugin").val(); var id_plugin = $("#id_plugin").val();
var params = []; var params = [];
params.push("page=include/ajax/module"); params.push("page=include/ajax/module");
if (moduleId > 0) {
params.push("get_module_macros=" + moduleId);
} else {
params.push("get_plugin_macros=1"); params.push("get_plugin_macros=1");
}
params.push("id_plugin=" + id_plugin); params.push("id_plugin=" + id_plugin);
jQuery.ajax({ jQuery.ajax({