Implement top_level_menu toggle (#45)
Closes #42 Based on @erichester76's https://github.com/ICTU/netbox_slm/pull/44 Signed-off-by: wkoot <3715211+wkoot@users.noreply.github.com> Co-authored-by: Eric Hester <eric.hester@umbrella.tech>
This commit is contained in:
@@ -206,6 +206,9 @@ PLUGINS = ['netbox_slm']
|
||||
# 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
|
||||
|
||||
@@ -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",
|
||||
@@ -54,3 +57,12 @@ menu_items = (
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user