Merge remote-tracking branch 'origin/develop' into ent-9640-agrupacion-de-graficas-en-periodos-de-tiempo

This commit is contained in:
daniel 2023-12-14 13:27:03 +01:00
commit ea97bb8f60
8 changed files with 58 additions and 8 deletions

View File

@ -0,0 +1,7 @@
START TRANSACTION;
DELETE FROM `twelcome_tip` WHERE `title` = 'Automatic agent provision system';
INSERT INTO `twelcome_tip` (`id_lang`,`id_profile`,`title`,`text`,`url`,`enable`) VALUES ('en_GB',0,'Automatic agent provision system','The agent self-provisioning system allows an agent recently entered into the system to automatically apply changes to their configuration (such as moving them from group, assigning them certain values in custom fields) and of course applying certain monitoring policies. It is one of the most powerful functionalities, aimed at managing very large system parks.','https://pandorafms.com/manual/start?id=en/documentation/02_installation/05_configuration_agents#conf',1);
COMMIT;

View File

@ -189,7 +189,8 @@ if (is_ajax() === true) {
$serverID,
$childrenMethod,
$access,
$metaID
$metaID,
$filter['groupID']
);
break;

View File

@ -761,7 +761,7 @@ class TipsWindow
);
$table->data[1][1] = html_print_label_input_block(
__('Url'),
html_print_input_text('url', '', '', 35, 100, true)
html_print_input_text('url', '', '', 35, 255, true)
);
$table->data[2][0] = html_print_label_input_block(
__('Text'),
@ -928,7 +928,7 @@ class TipsWindow
);
$table->data[1][1] = html_print_label_input_block(
__('Url'),
html_print_input_text('url', $tip['url'], '', 35, 100, true)
html_print_input_text('url', $tip['url'], '', 35, 255, true)
);
$table->data[2][0] = html_print_label_input_block(
__('Text'),

View File

@ -32,6 +32,8 @@ class Tree
protected $rootType = null;
protected $idGroup = null;
protected $id = -1;
protected $rootID = -1;
@ -87,13 +89,15 @@ class Tree
$serverID=false,
$childrenMethod='on_demand',
$access='AR',
$id_meta_server=0
$id_meta_server=0,
$id_group=0
) {
$this->type = $type;
$this->rootType = !empty($rootType) ? $rootType : $type;
$this->id = $id;
$this->rootID = !empty($rootID) ? $rootID : $id;
$this->serverID = $serverID;
$this->idGroup = $id_group;
if (is_metaconsole() && $id_meta_server == 0) {
$this->serverName = metaconsole_get_server_by_id($serverID);
}

View File

@ -88,7 +88,8 @@ class TreeService extends Tree
$serverID=false,
$childrenMethod='on_demand',
$access='AR',
$id_server_meta=0
$id_server_meta=0,
$id_group=0
) {
global $config;
@ -105,7 +106,8 @@ class TreeService extends Tree
$serverID,
$childrenMethod,
$access,
$id_server_meta
$id_server_meta,
$id_group
);
$this->L1fieldName = 'id_group';
@ -268,6 +270,13 @@ class TreeService extends Tree
$groups_acl = 'AND ts.id_group IN ('.implode(',', $this->userGroupsArray).')';
}
// Filter group.
if ((int) $this->idGroup !== 0) {
$filter_group = 'AND ts.id_group = '.$this->idGroup;
} else {
$filter_group = '';
}
$exclude_children = 'ts.id NOT IN (
SELECT DISTINCT id_service_child
FROM tservice_element
@ -300,11 +309,13 @@ class TreeService extends Tree
%s
%s
%s
%s
GROUP BY ts.id',
$exclude_children,
$is_favourite,
$service_search,
$groups_acl
$groups_acl,
$filter_group
);
$stats = db_get_all_rows_sql($sql);

View File

@ -1056,7 +1056,7 @@ function processServiceTree(settings) {
parameters["filter"]["statusAgent"] = "";
parameters["filter"]["searchModule"] = "";
parameters["filter"]["statusModule"] = "";
parameters["filter"]["groupID"] = "";
parameters["filter"]["groupID"] = settings.id_group;
parameters["filter"]["tagID"] = "";
parameters["filter"]["searchHirearchy"] = 1;
parameters["filter"]["show_not_init_agents"] = 1;

View File

@ -676,6 +676,7 @@ class Widget
$values = [];
$values['title'] = \get_parameter('title', '');
$values['background'] = \get_parameter('background', '#ffffff');
$values['id_group'] = \get_parameter('id_group', '');
if ((bool) \is_metaconsole() === true) {
if ($this->shouldSelectNode() === true) {
$values['node'] = \get_parameter('node', null);

View File

@ -218,6 +218,10 @@ class ServiceViewWidget extends Widget
$values['type'] = $decoder['type'];
}
if (isset($decoder['id_group']) === true) {
$values['id_group'] = $decoder['id_group'];
}
return $values;
}
@ -239,6 +243,13 @@ class ServiceViewWidget extends Widget
$values['type'] = 'tree';
}
// Groups.
$return_all_group = false;
if (users_can_manage_group_all('AR') === true) {
$return_all_group = true;
}
// Type services view.
$fields = [
'tree' => __('Tree'),
@ -256,6 +267,20 @@ class ServiceViewWidget extends Widget
],
];
$inputs[] = [
'label' => __('Group'),
'arguments' => [
'name' => 'id_group',
'id' => 'id_group',
'input_class' => 'flex-row',
'type' => 'select_groups',
'returnAllGroup' => $return_all_group,
'selected' => $values['id_group'],
'return' => true,
'class' => 'w50p',
],
];
return $inputs;
}
@ -335,6 +360,7 @@ class ServiceViewWidget extends Widget
$settings['cellId'] = $this->cellId;
$settings['baseURL'] = \ui_get_full_url('/', false, false, false);
$settings['ajaxURL'] = \ui_get_full_url('ajax.php', false, false, false);
$settings['id_group'] = (empty($values['type']) === false) ? $values['id_group'] : 0;
// Show the modal window of an module.
$output .= '<div id="module_details_window" class="">';