Fix issue with modules

This commit is contained in:
Jose Gonzalez 2022-01-06 16:23:13 +01:00
parent 68e63bd5fb
commit 8cdf1acd42
2 changed files with 20 additions and 15 deletions

View File

@ -1480,7 +1480,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
'return' => true,
'nothing' => __('All'),
'nothing_value' => 0,
'script' => 'fmModuleChange(\''.$uniqId.'\')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
]
);
$output .= '</div>';
@ -1533,7 +1533,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
]
);
@ -1550,7 +1550,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
'name' => 'filtered-module-show-common-modules-'.$uniqId,
'selected' => $data['mShowCommonModules'],
'return' => true,
'script' => 'fmModuleChange(\''.$uniqId.'\')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
]
);
@ -1565,11 +1565,10 @@ function html_print_select_multiple_modules_filtered(array $data):string
$all_modules = [];
}
if ($data['mShowSelectedOtherGroups']) {
if (isset($data['mShowSelectedOtherGroups']) === true) {
$selected_modules_ids = explode(',', $data['mModules']);
foreach ($selected_modules_ids as $id) {
if (!array_key_exists($id, $all_modules)) {
if (array_key_exists($id, $all_modules) === false) {
$module_data = modules_get_agentmodule($id);
$all_modules[$id] = $module_data['nombre'];
}

View File

@ -211,7 +211,7 @@ function fmAgentChange(uniqId) {
}
// eslint-disable-next-line no-unused-vars
function fmModuleChange(uniqId) {
function fmModuleChange(uniqId, isMeta) {
var idModuleGroup = $("#filtered-module-module-group-" + uniqId).val();
var idAgents = $("#filtered-module-agents-" + uniqId).val();
var showCommonModules = $(
@ -230,14 +230,20 @@ function fmModuleChange(uniqId) {
$("#filtered-module-modules-" + uniqId).html("");
if (data) {
jQuery.each(data, function(id, value) {
var option = $("<option></option>")
.attr(
"value",
value["id_node"]
? value["id_node"] + "|" + value["id_agente_modulo"]
: value["id_agente_modulo"]
)
.html(value["nombre"]);
var option = $("<option></option>");
if (isMeta === true) {
option
.attr(
"value",
value["id_node"]
? value["id_node"] + "|" + value["id_agente_modulo"]
: value["id_agente_modulo"]
)
.html(value["nombre"]);
} else {
option.attr("value", value).html(value);
}
$("#filtered-module-modules-" + uniqId).append(option);
});
}