Skip to content

Implement top_level_menu toggle #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading