Merge remote-tracking branch 'origin/develop' into ent-6599-errores-en-filtro-de-monitor-detail

This commit is contained in:
fbsanchez 2020-10-29 12:24:39 +01:00
commit 79c927628d
5 changed files with 27 additions and 7 deletions

View File

@ -86,7 +86,6 @@ function mainModuleGroups()
); );
$info = $tree_group->getArray(); $info = $tree_group->getArray();
$info = groupview_plain_groups($info); $info = groupview_plain_groups($info);
$counter = count($info);
$offset = get_parameter('offset', 0); $offset = get_parameter('offset', 0);
$agent_group_search = get_parameter('agent_group_search', ''); $agent_group_search = get_parameter('agent_group_search', '');
$module_group_search = get_parameter('module_group_search', ''); $module_group_search = get_parameter('module_group_search', '');
@ -134,6 +133,8 @@ function mainModuleGroups()
$ids_group = -1; $ids_group = -1;
} }
$counter = count($info);
$condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT); $condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT); $condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT);
$condition_unknown = modules_get_state_condition(AGENT_MODULE_STATUS_UNKNOWN); $condition_unknown = modules_get_state_condition(AGENT_MODULE_STATUS_UNKNOWN);

View File

@ -1313,6 +1313,7 @@ $(document).ready (function () {
var img_delete = '<?php echo $delete_image; ?>'; var img_delete = '<?php echo $delete_image; ?>';
var id_user = '<?php echo io_safe_output($id); ?>'; var id_user = '<?php echo io_safe_output($id); ?>';
var is_metaconsole = '<?php echo $meta; ?>';
var data = []; var data = [];
$('input:image[name="add"]').click(function (e) { $('input:image[name="add"]').click(function (e) {
@ -1357,7 +1358,7 @@ $(document).ready (function () {
$('input:image[name="del"]').click(function (e) { $('input:image[name="del"]').click(function (e) {
e.preventDefault(); e.preventDefault();
var rows = $("#table_profiles tr").length; var rows = $("#table_profiles tr").length;
if (rows <= 3) { if ((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) {
if (!confirm('<?php echo __('Deleting last profile will delete this user'); ?>' + '. ' + '<?php echo __('Are you sure?'); ?>')) { if (!confirm('<?php echo __('Deleting last profile will delete this user'); ?>' + '. ' + '<?php echo __('Are you sure?'); ?>')) {
return; return;
} }
@ -1379,7 +1380,7 @@ $(document).ready (function () {
success: function (data) { success: function (data) {
row.remove(); row.remove();
var rows = $("#table_profiles tr").length; var rows = $("#table_profiles tr").length;
if (rows <= 2) { if ((is_metaconsole === '1' && rows <= 3) || (is_metaconsole === '' && rows <= 2)) {
window.location.replace("<?php echo ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0', false, false, false); ?>"); window.location.replace("<?php echo ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0', false, false, false); ?>");
} }
} }
@ -1389,7 +1390,7 @@ $(document).ready (function () {
$('#submit-crtbutton').click(function (e) { $('#submit-crtbutton').click(function (e) {
e.preventDefault(); e.preventDefault();
var rows = $("#table_profiles tr").length; var rows = $("#table_profiles tr").length;
if (rows <= 2) { if ((is_metaconsole === '1' && rows <= 3) || (is_metaconsole === '' && rows <= 2)) {
alert('<?php echo __('please add a profile'); ?>'); alert('<?php echo __('please add a profile'); ?>');
} else { } else {
this.form.submit(); this.form.submit();

View File

@ -519,7 +519,15 @@ function html_print_select_groups(
} }
} else { } else {
foreach ($selected as $k) { foreach ($selected as $k) {
$fields[$k] = groups_get_name($k); if ($k === null || $k === '') {
continue;
}
$fields[$k] = groups_get_name($k, $returnAllGroup);
}
if (empty($fields) === true && $returnAllGroup) {
$fields[0] = groups_get_name(null, true);
} }
} }

View File

@ -278,6 +278,11 @@ class TopNEventByGroupWidget extends Widget
]; ];
// Groups. // Groups.
$selected_groups = [];
if ($values['groupId']) {
$selected_groups = explode(',', $values['groupId'][0]);
}
$inputs[] = [ $inputs[] = [
'label' => __('Groups'), 'label' => __('Groups'),
'arguments' => [ 'arguments' => [
@ -285,7 +290,7 @@ class TopNEventByGroupWidget extends Widget
'name' => 'groupId[]', 'name' => 'groupId[]',
'returnAllGroup' => true, 'returnAllGroup' => true,
'privilege' => 'AR', 'privilege' => 'AR',
'selected' => explode(',', $values['groupId'][0]), 'selected' => $selected_groups,
'return' => true, 'return' => true,
'multiple' => true, 'multiple' => true,
], ],

View File

@ -277,6 +277,11 @@ class TopNEventByModuleWidget extends Widget
], ],
]; ];
$selected_groups = [];
if ($values['groupId']) {
$selected_groups = explode(',', $values['groupId'][0]);
}
// Groups. // Groups.
$inputs[] = [ $inputs[] = [
'label' => __('Groups'), 'label' => __('Groups'),
@ -285,7 +290,7 @@ class TopNEventByModuleWidget extends Widget
'name' => 'groupId[]', 'name' => 'groupId[]',
'returnAllGroup' => true, 'returnAllGroup' => true,
'privilege' => 'AR', 'privilege' => 'AR',
'selected' => explode(',', $values['groupId'][0]), 'selected' => $selected_groups,
'return' => true, 'return' => true,
'multiple' => true, 'multiple' => true,
], ],