From c0b889ceee0edf907fd57d707d56295530ab8e7f Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 7 Apr 2025 09:00:44 -0700 Subject: [PATCH] 19073 review changes --- docs/configuration/plugins.md | 12 ++++-------- netbox/core/plugins.py | 11 ++++------- netbox/core/tables/plugins.py | 2 +- netbox/netbox/settings.py | 2 +- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/docs/configuration/plugins.md b/docs/configuration/plugins.md index ec40777db..aa00c3115 100644 --- a/docs/configuration/plugins.md +++ b/docs/configuration/plugins.md @@ -37,16 +37,12 @@ Note that a plugin must be listed in `PLUGINS` for its configuration to take eff Default: Empty -This parameter holds configuration settings for how the individual plugins are displayed in the plugins table under Admin->System->Plugins. Declaring `hidden` as True will make it so the plugin is not shown in the table. Declaring `disabled` will make it show the plugin in the table, but it won't be linked to the details and installation page for the plugin. An example configuration is shown below: +This parameter holds configuration settings for how the individual plugins are displayed in the plugins table under Admin->System->Plugins. Adding a plugin to `hidden` will make it so the plugin is not shown in the table. Adding a plugin to `unlinked` will make it show the plugin in the table, but it won't be linked to the details and installation page for the plugin. An example configuration is shown below: ```python -PLUGINS_TABLE_CONFIG = { - 'plugin1': { - 'hidden': True, - }, - 'plugin2': { - 'disabled': True, - }, +PLUGINS_CATALOG_CONFIG = { + 'hidden': ['plugin1'], + 'unlinked': ['plugin2'], } ``` diff --git a/netbox/core/plugins.py b/netbox/core/plugins.py index f95601e0c..d6e3c8f23 100644 --- a/netbox/core/plugins.py +++ b/netbox/core/plugins.py @@ -110,14 +110,11 @@ def get_local_plugins(plugins=None): plugins[k] = v # Update plugin table config for hidden and disabled plugins + hidden = settings.PLUGINS_CATALOG_CONFIG.get('hidden', []) + unlinked = settings.PLUGINS_CATALOG_CONFIG.get('unlinked', []) for k, v in plugins.items(): - v.hidden = False - v.disabled = False - if k in settings.PLUGINS_TABLE_CONFIG: - if 'hidden' in settings.PLUGINS_TABLE_CONFIG[k]: - v.hidden = settings.PLUGINS_TABLE_CONFIG[k]['hidden'] - if 'disabled' in settings.PLUGINS_TABLE_CONFIG[k]: - v.disabled = settings.PLUGINS_TABLE_CONFIG[k]['disabled'] + v.hidden = k in hidden + v.disabled = k in unlinked return plugins diff --git a/netbox/core/tables/plugins.py b/netbox/core/tables/plugins.py index a6c23bd9c..0853f8b1f 100644 --- a/netbox/core/tables/plugins.py +++ b/netbox/core/tables/plugins.py @@ -43,7 +43,7 @@ class PluginVersionTable(BaseTable): class CatalogPluginTable(BaseTable): title_long = tables.Column( - verbose_name=_('Name') + verbose_name=_('Name'), ) author = tables.Column( accessor=tables.A('author__name'), diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index b76310e33..c453817d0 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -141,7 +141,7 @@ MEDIA_ROOT = getattr(configuration, 'MEDIA_ROOT', os.path.join(BASE_DIR, 'media' METRICS_ENABLED = getattr(configuration, 'METRICS_ENABLED', False) PLUGINS = getattr(configuration, 'PLUGINS', []) PLUGINS_CONFIG = getattr(configuration, 'PLUGINS_CONFIG', {}) -PLUGINS_TABLE_CONFIG = getattr(configuration, 'PLUGINS_TABLE_CONFIG', {}) +PLUGINS_CATALOG_CONFIG = getattr(configuration, 'PLUGINS_CATALOG_CONFIG', {}) PROXY_ROUTERS = getattr(configuration, 'PROXY_ROUTERS', ['utilities.proxy.DefaultProxyRouter']) QUEUE_MAPPINGS = getattr(configuration, 'QUEUE_MAPPINGS', {}) REDIS = getattr(configuration, 'REDIS') # Required