Fixed issue with all modules

This commit is contained in:
Jose Gonzalez 2021-02-25 16:08:02 +01:00
parent dc5a0eb5b9
commit 7cfc1d2f9a
2 changed files with 15 additions and 2 deletions

View File

@ -166,7 +166,12 @@ if ($insert_downtime_agent === 1) {
$agents = (array) get_parameter('id_agents');
$module_names = (array) get_parameter('module');
$all_modules = (empty($module_names) || ($module_names[0] === '0'));
$all_modules = ($modules_selection_mode === 'all' && (empty($module_names) || (int) $modules[0] === 0));
$all_common_modules = ($modules_selection_mode === 'common' && (empty($module_names) || (int) $modules[0] === 0));
if ($all_common_modules === true) {
$module_names = explode(',', get_parameter('all_common_modules'));
}
// 'Is running' check.
$is_running = (bool) db_get_value(
@ -928,6 +933,7 @@ if ($id_downtime > 0) {
echo '<div id="available_modules_selection_mode" style="padding-top:20px">';
}
html_print_input_hidden('all_common_modules', '');
echo html_print_select(
[
'common' => __('Show common modules'),

View File

@ -275,7 +275,10 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
);
}
}
jQuery.each(data, function(i, val) {
var all_common_modules = [];
$.each(data, function(i, val) {
var s = js_html_entity_decode(val);
$("#module").append(
@ -285,8 +288,12 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
.attr("title", s)
);
all_common_modules.push(i);
$("#module").fadeIn("normal");
});
$("#hidden-all_common_modules").val(all_common_modules.toString());
if (typeof selected !== "undefined") $("#module").attr("value", selected);
$("#module")