diff --git a/backend/infrahub/menu/generator.py b/backend/infrahub/menu/generator.py index a9bd8f1868..49459797fc 100644 --- a/backend/infrahub/menu/generator.py +++ b/backend/infrahub/menu/generator.py @@ -109,6 +109,10 @@ async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[C continue if not schema.menu_placement: + first_element = MenuItemDict.from_schema(model=schema) + first_element.identifier = f"{first_element.identifier}Sub" + first_element.order_weight = 1 + menu_item.children[first_element.identifier] = first_element structure.data[menu_item.identifier] = menu_item items_to_add[item_name] = True elif menu_placement := structure.find_item(name=schema.menu_placement): diff --git a/backend/tests/unit/menu/test_generator.py b/backend/tests/unit/menu/test_generator.py index 29e8baadbe..f9d8b597a3 100644 --- a/backend/tests/unit/menu/test_generator.py +++ b/backend/tests/unit/menu/test_generator.py @@ -86,6 +86,7 @@ async def test_generate_menu_top_level( assert menu assert "TestMenu0" in menu.data.keys() assert "TestCar" in menu.data.keys() + assert "TestCarSub" in menu.data["TestCar"].children.keys() async def test_generate_menu_default(