diff --git a/pandora_console/extras/mr/68.sql b/pandora_console/extras/mr/68.sql new file mode 100644 index 0000000000..3095941187 --- /dev/null +++ b/pandora_console/extras/mr/68.sql @@ -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; \ No newline at end of file diff --git a/pandora_console/include/ajax/tree.ajax.php b/pandora_console/include/ajax/tree.ajax.php index 600b30e74d..7b47fa8b42 100644 --- a/pandora_console/include/ajax/tree.ajax.php +++ b/pandora_console/include/ajax/tree.ajax.php @@ -189,7 +189,8 @@ if (is_ajax() === true) { $serverID, $childrenMethod, $access, - $metaID + $metaID, + $filter['groupID'] ); break; diff --git a/pandora_console/include/class/TipsWindow.class.php b/pandora_console/include/class/TipsWindow.class.php index 6406c69194..d787e7ddea 100644 --- a/pandora_console/include/class/TipsWindow.class.php +++ b/pandora_console/include/class/TipsWindow.class.php @@ -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'), diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 94b9c1b23c..fc02023b3e 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -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); } diff --git a/pandora_console/include/class/TreeService.class.php b/pandora_console/include/class/TreeService.class.php index 177a45a54f..c7e09829cb 100644 --- a/pandora_console/include/class/TreeService.class.php +++ b/pandora_console/include/class/TreeService.class.php @@ -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); diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js index e69414840f..7cfbf40e9c 100644 --- a/pandora_console/include/javascript/pandora_dashboards.js +++ b/pandora_console/include/javascript/pandora_dashboards.js @@ -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; diff --git a/pandora_console/include/lib/Dashboard/Widget.php b/pandora_console/include/lib/Dashboard/Widget.php index 8ed3ece7f9..336caabf20 100644 --- a/pandora_console/include/lib/Dashboard/Widget.php +++ b/pandora_console/include/lib/Dashboard/Widget.php @@ -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); diff --git a/pandora_console/include/lib/Dashboard/Widgets/service_view.php b/pandora_console/include/lib/Dashboard/Widgets/service_view.php index 7e5607af47..b81fbd67ae 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/service_view.php +++ b/pandora_console/include/lib/Dashboard/Widgets/service_view.php @@ -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 .= '
';