Skip to content

Commit

Permalink
add menu definition file reference to the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
wvandeun committed Oct 25, 2024
1 parent e61adf4 commit 10531c9
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions docs/docs/reference/menu.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title: Menu definition file
---

# Menu definition file

A menu definition file allows you to control the layout and structure of the menu on the left side of the Infrahub web interface. More information can be found in the [Controlling the menu guide](/guides/menu).

The menu definition file is a YAML file that follows a particular structure or schema.

At the top of the file we define a bit of boilerplate statements, to define the version of the schema of the file and the kind of content that it contains. We also define a spec mapping with a data key.

```yaml
---
apiversion: infrahub.app/v1
kind: Menu
spec:
data:
```
The value of the data key in the spec mapping, is a sequence (or list) that of menu items.
A menu item is a mapping in which you can define the following key/value pairs:
| Key | Type | Description | Mandatory |
|--------------|----------|-----------------------------------------------------------------------------|--------------------|
| name | string | the name of the menu item | :white_check_mark: |
| namespace | string | the namespace of the menu item | :white_check_mark: |
| label | string | the name of the menu item in UI | :x: |
| kind | string | selecting this menu item will take you to the list view of this schema node | :x: |
| path | string | selecting this menu will take you to this path (URL) | :x: |
| icon | string | the icon of the menu item | :x: |
| order_weight | integer | controls the ordering of menu items (lower values are ordered first) | :x: |
| children | sequence | list of nested menu items | :x: |
## Example
```yaml
---
apiversion: infrahub.app/v1
kind: Menu
spec:
data:
- namespace: Location
name: Mainmenu
label: Location
icon: "mingcute:location-line"
children:
data:
- namespace: Location
name: Country
label: Countries
kind: LocationCountry
icon: "gis:search-country"

- namespace: Location
name: Site
label: Sites
kind: LocationSite
icon: "ri:building-line"

- namespace: Infrastructure
name: Mainmenu
label: Infrastructure
icon: "mdi:domain"
children:
data:
- namespace: Network
name: Device
label: Devices
kind: NetworkDevice
icon: "mdi:router"

- namespace: Network
name: Interface
label: Interface
kind: NetworkInterface
icon: "mdi:ethernet"
```

0 comments on commit 10531c9

Please sign in to comment.