mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 08:38:16 -06:00
fix: don't generate final navbar on file import
This commit is contained in:
parent
36df9228a6
commit
1102c8d291
@ -1,6 +1,5 @@
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from netbox.registry import registry
|
|
||||||
from . import *
|
from . import *
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -464,13 +463,27 @@ MENUS = [
|
|||||||
OPERATIONS_MENU,
|
OPERATIONS_MENU,
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add top-level plugin menus
|
has_initialized_function_menus = False
|
||||||
for menu in registry['plugins']['menus']:
|
|
||||||
|
|
||||||
|
def add_plugin_menus():
|
||||||
|
"""
|
||||||
|
Build the plugin navigation menu and add plugin defined
|
||||||
|
menus to the global context.
|
||||||
|
"""
|
||||||
|
|
||||||
|
global has_initialized_function_menus
|
||||||
|
if has_initialized_function_menus:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
has_initialized_function_menus = True
|
||||||
|
|
||||||
|
from netbox.registry import registry
|
||||||
|
|
||||||
|
for menu in registry['plugins']['menus']:
|
||||||
MENUS.append(menu)
|
MENUS.append(menu)
|
||||||
|
|
||||||
# Add the default "plugins" menu
|
if registry['plugins']['menu_items']:
|
||||||
if registry['plugins']['menu_items']:
|
|
||||||
|
|
||||||
# Build the default plugins menu
|
# Build the default plugins menu
|
||||||
groups = [
|
groups = [
|
||||||
MenuGroup(label=label, items=items)
|
MenuGroup(label=label, items=items)
|
||||||
@ -483,5 +496,5 @@ if registry['plugins']['menu_items']:
|
|||||||
)
|
)
|
||||||
MENUS.append(plugins_menu)
|
MENUS.append(plugins_menu)
|
||||||
|
|
||||||
# Add the admin menu last
|
# Add the admin menu last
|
||||||
MENUS.append(ADMIN_MENU)
|
MENUS.append(ADMIN_MENU)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from django import template
|
from django import template
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
from netbox.navigation.menu import MENUS
|
from netbox.navigation.menu import MENUS, add_plugin_menus
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'nav',
|
'nav',
|
||||||
@ -14,6 +14,8 @@ register = template.Library()
|
|||||||
|
|
||||||
@register.inclusion_tag("navigation/menu.html", takes_context=True)
|
@register.inclusion_tag("navigation/menu.html", takes_context=True)
|
||||||
def nav(context):
|
def nav(context):
|
||||||
|
add_plugin_menus()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Render the navigation menu.
|
Render the navigation menu.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user