33from typing import TYPE_CHECKING
44
55from infrahub .core import registry
6- from infrahub .core .constants import InfrahubKind
76from infrahub .core .protocols import CoreMenuItem
87from infrahub .log import get_logger
98
10- from .constants import FULL_DEFAULT_MENU , TEMPLATE_MENU
9+ from .constants import FULL_DEFAULT_MENU
1110from .models import MenuDict , MenuItemDict
1211
1312if TYPE_CHECKING :
@@ -82,11 +81,6 @@ async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[C
8281
8382 items_to_add = {schema .kind : False for schema in full_schema .values () if schema .include_in_menu is True }
8483
85- # Object templates should go into a dedicated menu item
86- object_templates_menu = MenuItemDict (
87- identifier = InfrahubKind .OBJECTTEMPLATE , label = TEMPLATE_MENU .title (), icon = "mdi:pencil-ruler" , order_weight = 20000
88- )
89-
9084 nbr_remaining_items_last_round = len (items_to_add .values ())
9185 nbr_remaining_items = len ([value for value in items_to_add .values () if value is False ])
9286 while not all (items_to_add .values ()):
@@ -101,10 +95,7 @@ async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[C
10195 items_to_add [item_name ] = True
10296 continue
10397
104- if schema .namespace == "Template" :
105- object_templates_menu .children [menu_item .identifier ] = menu_item
106- items_to_add [item_name ] = True
107- elif not schema .menu_placement :
98+ if not schema .menu_placement :
10899 first_element = MenuItemDict .from_schema (model = schema )
109100 first_element .identifier = f"{ first_element .identifier } Sub"
110101 first_element .order_weight = 1
@@ -121,9 +112,6 @@ async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[C
121112 break
122113 nbr_remaining_items_last_round = nbr_remaining_items
123114
124- if object_templates_menu .children :
125- structure .data [object_templates_menu .identifier ] = object_templates_menu
126-
127115 # ----------------------------------------------------------------------------
128116 # Assign the remaining items for which we couldn't find the menu_placement to the default menu
129117 # ----------------------------------------------------------------------------
0 commit comments