From ed38596a7cf3eda2e7927b24b8189dadf1fd7940 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Thu, 8 May 2025 11:02:59 +0100 Subject: [PATCH] Added debug endpoint to plugin --- invenio/plugin/custom_invenio_plugin/views.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/invenio/plugin/custom_invenio_plugin/views.py b/invenio/plugin/custom_invenio_plugin/views.py index b32d696..0b90748 100644 --- a/invenio/plugin/custom_invenio_plugin/views.py +++ b/invenio/plugin/custom_invenio_plugin/views.py @@ -16,3 +16,27 @@ def init_menu(): external_url="https://am-d-model.eu", order=0, ) + + +@blueprint.route("/debug-menu") +def debug_menu(): + """Debug endpoint to view menu structure.""" + result = [] + + def inspect_menu(menu_node, level=0): + indent = " " * level + for child in menu_node.children: + item_info = { + "name": child.name, + "endpoint": getattr(child, "_endpoint", None), + "url": getattr(child, "url", None), + "text": getattr(child, "_text", None), + "order": child.order, + "has_children": bool(child.children), + } + result.append(f"{indent}{item_info}") + if child.children: + inspect_menu(child, level + 1) + + inspect_menu(current_menu.submenu("main")) + return "
" + "\n".join(result) + "
"