Skip to main content

Menu Manager

Skill: infrahub-managing-menus

The Menu Manager produces and restructures YAML menu definition files that customize the Infrahub web UI sidebar. Menus can be flat or deeply nested, with group headers, icons, and ordering. The skill keeps the nesting valid: items sharing a namespace and name collapse into one entry, and an item missing either is rejected by the menu loader.

When to use​

  • Adding a custom structure alongside Infrahub's auto-generated sidebar navigation
  • Grouping schema nodes into logical sections (e.g., "Network Topology", "Inventory", "Circuits")
  • Placing your own nodes inside a section Infrahub already ships, such as IPAM
  • Adding nested sub-menus and section headers
  • Controlling the ordering of menu items
  • Reordering, renaming, or regrouping an existing menu, or working out why an item does not appear or sits in the wrong group

What it produces​

  • YAML file with apiVersion, kind: Menu, and a spec.data block containing the menu tree
  • Loaded into Infrahub alongside schema and object files

Example prompts​

  • "Create a menu with sections for Network Topology, Circuits, and Inventory, each with relevant schema nodes nested underneath"
  • "Put my VLAN and VRF entries under the IPAM section Infrahub already has"
  • "Build a flat menu that lists Device, Interface, Site, and Rack in that order"
  • "Add a nested sub-menu under Network Topology for BGP with entries for BGP Sessions and BGP Peers"
  • "Move BGP Sessions out of Network Topology into its own section, placed after IP Management"

Key rules enforced​

  • spec.data wrapping: the top-level menu items must be in spec.data; a common mistake is writing spec: followed by a list directly
  • children.data wrapping: nested items must use children.data: not children: directly; this is the most common nesting mistake
  • kind vs path: each item uses either kind: (links to a schema node's list view) or path: (links to a custom URL), never both
  • Built-in sections: Infrahub ships its own top-level sections; the skill attaches your nodes to the two that hold object data (Other and IPAM) with parent: [Builtin, IPAM] instead of declaring a second one, and keeps clear of the platform sections such as Branches and Object Management
  • Group headers: section headers with no link (no kind or path) are valid and used for visual grouping
  • Icon format: icons use the Material Design Icons format with mdi: prefix (e.g., mdi:server, mdi:ip-network)
  • order_weight: integer controlling item display order; lower numbers appear first

Common mistakes it catches​

MistakeWhat the skill does instead
Registering the menu under menu: (singular) in .infrahub.ymlUses menus: (plural), matching every other registration key; the singular form is rejected as extra_forbidden
Nesting children directly under children:Wraps nested items in children.data, the same shape every paginated Infrahub response uses
Setting both kind and path on one itemUses exactly one; both together fail the whole menu file to load, and the sidebar falls back to the auto-generated menu
Leaving the menu unregistered in .infrahub.ymlIncludes the registration comment in the output file so it isn't missed
Deviating from the fixed envelopeAlways emits apiVersion, kind: Menu, and spec.data; a deviation fails to load and falls back to the auto-generated menu

Loading it​

Load a menu file into a running Infrahub instance:

infrahubctl menu load <menu-file>