From 35b5de57f15e359b9ee3c837be319e4f622a1731 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Wed, 13 Sep 2023 11:12:11 +0200 Subject: [PATCH 1/3] The filter group is added in the Service View Widget settings. --- pandora_console/include/ajax/tree.ajax.php | 3 ++- pandora_console/include/class/Tree.class.php | 6 ++++- .../include/class/TreeService.class.php | 17 +++++++++--- .../include/javascript/pandora_dashboards.js | 2 +- .../include/lib/Dashboard/Widget.php | 1 + .../lib/Dashboard/Widgets/service_view.php | 26 +++++++++++++++++++ 6 files changed, 49 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/ajax/tree.ajax.php b/pandora_console/include/ajax/tree.ajax.php index 319b98e168..e9dbbecd52 100644 --- a/pandora_console/include/ajax/tree.ajax.php +++ b/pandora_console/include/ajax/tree.ajax.php @@ -187,7 +187,8 @@ if (is_ajax() === true) { $serverID, $childrenMethod, $access, - $metaID + $metaID, + $filter['groupID'] ); break; diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index b4a41c494d..41868748f5 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 b30877a5b5..a2f9257d14 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 79fde538b4..a669b22719 100644 --- a/pandora_console/include/javascript/pandora_dashboards.js +++ b/pandora_console/include/javascript/pandora_dashboards.js @@ -1058,7 +1058,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 9bedc71f50..876e8aacc6 100644 --- a/pandora_console/include/lib/Dashboard/Widget.php +++ b/pandora_console/include/lib/Dashboard/Widget.php @@ -642,6 +642,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 .= '
'; From c9966ed9999947744e1c52eeb6add9bc8f9b0312 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Wed, 11 Oct 2023 16:16:22 +0200 Subject: [PATCH 2/3] #12132 Limit tips --- pandora_console/include/javascript/tipsWindow.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/javascript/tipsWindow.js b/pandora_console/include/javascript/tipsWindow.js index 94d28c9339..c68e7c9b05 100644 --- a/pandora_console/include/javascript/tipsWindow.js +++ b/pandora_console/include/javascript/tipsWindow.js @@ -134,8 +134,9 @@ function render_counter() { $(".counter-tips img:eq(0)").after( "" ); + var limitRound = totalTips > 28 ? 28 : totalTips; if (totalTips > 1) { - for (let i = 1; i <= totalTips - 1; i++) { + for (let i = 1; i <= limitRound - 1; i++) { $(".count-round-tip:eq(0)").after( "" ); From a456912dd7457fdd39284c965755a6b667c5b297 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 16 Oct 2023 12:17:42 +0200 Subject: [PATCH 3/3] #12132 Fix welcome tips --- pandora_console/extras/mr/68.sql | 7 +++++++ pandora_console/include/class/TipsWindow.class.php | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 pandora_console/extras/mr/68.sql 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/class/TipsWindow.class.php b/pandora_console/include/class/TipsWindow.class.php index ae4271fba9..56082611ea 100644 --- a/pandora_console/include/class/TipsWindow.class.php +++ b/pandora_console/include/class/TipsWindow.class.php @@ -744,7 +744,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'), @@ -911,7 +911,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'),