Skip to content

Commit

Permalink
Move mega menu registration from import time 2/2
Browse files Browse the repository at this point in the history
Change-Id: Ib790ec0b11c271c46c1e2b4db6047ca94057a201
  • Loading branch information
LarsMichelsen committed Oct 1, 2024
1 parent 46562f1 commit 667c7af
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 14 additions & 13 deletions cmk/gui/help_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from cmk.gui.http import request
from cmk.gui.i18n import _, _l
from cmk.gui.logged_in import user
from cmk.gui.main_menu import mega_menu_registry
from cmk.gui.main_menu import MegaMenuRegistry
from cmk.gui.type_defs import MegaMenu, TopicMenuItem, TopicMenuTopic
from cmk.gui.utils.html import HTML
from cmk.gui.utils.urls import doc_reference_url, DocReference, makeuri_contextless
Expand All @@ -21,6 +21,19 @@
from cmk.gui.cse.utils.roles import user_may_see_saas_onboarding


def register(mega_menu_registry: MegaMenuRegistry) -> None:
mega_menu_registry.register(
MegaMenu(
name="help_links",
title=_l("Help"),
icon="main_help",
sort_index=18,
topics=_help_menu_topics,
info_line=lambda: f"{edition(paths.omd_root).title} {__version__}{_license_status()}",
)
)


def _help_menu_topics() -> list[TopicMenuTopic]:
learning_items = [
TopicMenuItem(
Expand Down Expand Up @@ -157,18 +170,6 @@ def _help_menu_topics() -> list[TopicMenuTopic]:
]


mega_menu_registry.register(
MegaMenu(
name="help_links",
title=_l("Help"),
icon="main_help",
sort_index=18,
topics=_help_menu_topics,
info_line=lambda: f"{edition(paths.omd_root).title} {__version__}{_license_status()}",
)
)


def _license_status() -> HTML | str:
status_message: HTML | str = get_license_message()
if not status_message:
Expand Down
2 changes: 2 additions & 0 deletions cmk/gui/plugins/main_modules/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
default_permissions,
graphing,
gui_background_job,
help_menu,
hooks,
inventory,
login,
Expand Down Expand Up @@ -118,6 +119,7 @@ def register_sites_options() -> None:

def register() -> None:
pagetypes.register(mega_menu_registry)
help_menu.register(mega_menu_registry)
crash_handler.register(crash_report_registry)
default_permissions.register(permission_section_registry, permission_registry)
register_cre_licensing_handler()
Expand Down

0 comments on commit 667c7af

Please sign in to comment.