Skip to content

Commit 3539539

Browse files
wkootEric Hester
and
Eric Hester
authored
Implement top_level_menu toggle (#45)
Closes #42 Based on @erichester76's #44 Signed-off-by: wkoot <[email protected]> Co-authored-by: Eric Hester <[email protected]>
1 parent 72646a6 commit 3539539

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

ci/configuration/configuration.py

+3
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ def _read_secret(secret_name, default = None):
206206
# Plugins configuration settings. These settings are used by various plugins that the user may have installed.
207207
# Each key in the dictionary is the name of an installed plugin and its value is a dictionary of settings.
208208
PLUGINS_CONFIG = {
209+
"netbox_slm": {
210+
"top_level_menu": True
211+
},
209212
}
210213

211214
# When determining the primary IP address for a device, IPv6 is preferred over IPv4 by default. Set this to True to

netbox_slm/navigation.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
from netbox.plugins import PluginMenuButton, PluginMenuItem
1+
from django.conf import settings
22

3-
menu_items = (
3+
from netbox.plugins import PluginMenuButton, PluginMenuItem, PluginMenu
4+
from . import SLMConfig
5+
6+
slm_items = (
47
PluginMenuItem(
58
link="plugins:netbox_slm:softwareproduct_list",
69
link_text="Software Products",
@@ -54,3 +57,12 @@
5457
),
5558
),
5659
)
60+
61+
if settings.PLUGINS_CONFIG["netbox_slm"].get("top_level_menu") is True:
62+
menu = PluginMenu(
63+
label="Software Lifecycle",
64+
groups=((SLMConfig.verbose_name, slm_items),),
65+
icon_class="mdi mdi-content-save",
66+
)
67+
else:
68+
menu_items = slm_items

0 commit comments

Comments
 (0)