Skip to content

Commit

Permalink
Implement top_level_menu toggle
Browse files Browse the repository at this point in the history
Closes #42
Based on @erichester76's #44

Signed-off-by: wkoot <[email protected]>
  • Loading branch information
Eric Hester authored and wkoot committed Oct 14, 2024
1 parent 72646a6 commit d791694
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ci/configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ def _read_secret(secret_name, default = None):
# Plugins configuration settings. These settings are used by various plugins that the user may have installed.
# Each key in the dictionary is the name of an installed plugin and its value is a dictionary of settings.
PLUGINS_CONFIG = {
"netbox_slm": {
"top_level_menu": True
},
}

# When determining the primary IP address for a device, IPv6 is preferred over IPv4 by default. Set this to True to
Expand Down
16 changes: 14 additions & 2 deletions netbox_slm/navigation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from netbox.plugins import PluginMenuButton, PluginMenuItem
from django.conf import settings

menu_items = (
from netbox.plugins import PluginMenuButton, PluginMenuItem, PluginMenu
from . import SLMConfig

slm_items = (
PluginMenuItem(
link="plugins:netbox_slm:softwareproduct_list",
link_text="Software Products",
Expand Down Expand Up @@ -54,3 +57,12 @@
),
),
)

if settings.PLUGINS_CONFIG["netbox_slm"].get("top_level_menu") is True:
menu = PluginMenu(
label="Software Lifecycle",
groups=((SLMConfig.verbose_name, slm_items),),
icon_class="mdi mdi-content-save",
)
else:
menu_items = slm_items

0 comments on commit d791694

Please sign in to comment.