Skip to content

Commit

Permalink
Fixing Issue #4598 - Remote Tab Visibility
Browse files Browse the repository at this point in the history
Plugin tab does not stay visible when main poller is offline
  • Loading branch information
TheWitness committed Mar 10, 2022
1 parent 2f189bd commit 335575c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Cacti CHANGELOG
-issue#4587: Cacti could benefit from reducing turns to settings table by caching common variables ahead of time
-issue#4588: Cannot use multibyte in host.php
-issue#4589: db_update_table should ALTER table engine/row_format/charset before ADD/ALTER column/index
-issue#4598: Plugin tab does not stay visible when main poller is offline
-feature: Expose hidden Language Translation setting l10n_language_handler
-feature: Allow a Device to be a part of a Report outside of a Tree
-feature: Allow Basic Authentication to display customer login failed message
Expand Down
20 changes: 13 additions & 7 deletions lib/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function api_plugin_hook($name) {
if (file_exists($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file'])) {
include_once($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file']);
}

$function = $hdata['function'];
if (function_exists($function)) {
api_plugin_run_plugin_hook($name, $hdata['name'], $function, $args);
Expand Down Expand Up @@ -179,12 +180,12 @@ function api_plugin_run_plugin_hook($hook, $plugin, $function, $args) {
'poller_exiting' => array('remote_collect'), // Poller exception handling

// GUI Related
'page_head' => array('online_view', 'offline_view'), // Navigation, api_plugin_hook
'top_header_tabs' => array('online_view', 'offline_view'), // Top Tabs, api_plugin_hook
'top_graph_header_tabs' => array('online_view', 'offline_view'), // Top Tabs, api_plugin_hook
'graph_buttons' => array('online_view', 'offline_view'), // Buttons by graphs, api_plugin_hook
'graphs_new_top_links' => array('online_mgmt', 'offline_mgmt'), // Buttons by graphs, api_plugin_hook
'page_head' => array('online_view', 'offline_view') // Content, api_plugin_hook
'page_head' => array('online_view', 'offline_view', 'offline_mgmt'), // Navigation, api_plugin_hook
'top_header_tabs' => array('online_view', 'offline_view', 'offline_mgmt'), // Top Tabs, api_plugin_hook
'top_graph_header_tabs' => array('online_view', 'offline_view', 'offline_mgmt'), // Top Tabs, api_plugin_hook
'graph_buttons' => array('online_view', 'offline_view', 'offline_mgmt'), // Buttons by graphs, api_plugin_hook
'graphs_new_top_links' => array('online_mgmt', 'offline_view', 'offline_mgmt'), // Buttons by graphs, api_plugin_hook
'page_head' => array('online_view', 'offline_view', 'offline_mgmt') // Content, api_plugin_hook
);

$plugin_capabilities = api_plugin_remote_capabilities($plugin);
Expand All @@ -204,7 +205,12 @@ function api_plugin_run_plugin_hook($hook, $plugin, $function, $args) {
}

// See if we need to restore the menu to original
if (($hook == 'config_arrays' || 'config_insert') && $config['connection'] == 'offline') {
$remote_hooks = array(
'config_arrays',
'config_insert',
);

if (in_array($hook, $remote_hooks) && $config['connection'] == 'offline') {
if (!api_plugin_has_capability($plugin, 'offline_mgmt')) {
if ($orig_menu !== $menu) {
$menu = $orig_menu;
Expand Down

0 comments on commit 335575c

Please sign in to comment.