Menu Templates
The menu organization is configured by the use of JSON menu templates.
Currently these can be found in the opennms/jetty-webapps/opennms/WEB-INF
folder in your Horizon installation.
Eventually these will be moved to the opennms/etc
folder.
The menu-template.json
file controls the menu configuration.
It is read by the Rest API v2 Menu service and displayed by the UI.
Configuration changes made in the file will take effect as soon as the browser page is refreshed (no need to restart Horizon).
Currently there are 3 menu templates:
-
menu-template-default.json
: This is the default template (the same as themenu-template.json
that is installed by default) and represents our latest recommended design. -
menu-template-alt.json
is an alternative configuration. -
menu-template-legacy.json
organizes the menu similar to previous versions of Horizon.
To use any of these menus, simply copy one of them to menu-template.json
.
If you wish to create your own configuration, we recommend creating a new file, then copying it to menu-template.json
.
Template structure
The menu template structure can be found in the Java code in: org.opennms.web.rest.support.menu.model.MainMenu
and org.opennms.web.rest.support.menu.model.MenuEntry
.
Main menu configuration
Item | Description |
---|---|
templateName |
A name for the template. |
baseHref, homeUrl, formattedDateTime, formattedDate, formattedTime, noticeStatus, username, baseNodeUrl, zenithConnectEnabled, zenithConnectBaseUrl, zenithConnectRelativeUrl, copyrightDates, version |
These are filled in at runtime with values. Any values you enter will be ignored. |
displayAddNodeButton |
Whether to display the "Add A Node" button on the top menu. |
sideMenuInitialExpand |
Whether the side menu is initially expanded. |
userTileProviders |
Tile provider information for the Geographical Map. We strongly suggest using the values provided in the existing templates. |
helpMenu, selfServiceMenu, userNotificationMenu, provisionMenu, flowsMenu, configurationMenu |
Control some specific menus. Most of these are deprecated and may be removed in a future version, we suggest not editing them. |
menus |
An array of top level menus, containing menu items. This is the place to configure what is displayed in the side menu, see the table below. |
Top level menu item configuration
Within the menus
array, each item is a top-level menu item for the side menu.
Item | Description |
---|---|
id |
A unique id for the top-level menu item.
These are used in the HTML markup so we recommend using only something
suitable for an HTML element id.
For top-level items, the convention is to have a suffix of |
name |
The name of the top-level menu item which is displayed in the menu UI. |
url |
The URL that the top-level menu links to.
Generally this is |
locationMatch |
Used by the Search feature. |
icon |
An icon path ID for the icon to display.
These must be Feather icons, see https://feather.nanthealth.com/Components/Icon/ for a list. For example |
roles |
An array of roles that the user must have in order to see the menu item.
If this is |
items |
An array of individual menu items, see the table below. |
type |
The type of the top-level menu item. The default is |
Menu item configuration
The items
under each top level menu contain the individual menu items.
Item | Description |
---|---|
id |
A unique ID for the menu item. |
name |
The display name for the menu item. |
url |
The url that the menu item links to.
If it is non-external, should be a relative link under the main |
locationMatch |
See above. |
roles |
See above.
Set to |
isExternalLink |
If |
linkTarget |
If present, specifies a target for the link, like the HTML |
icon |
See above. However, currently this is only supported for the top-level menu items. |
requiredSystemProperties |
This is an array of name/value pairs, where the |
action |
Used for performing some special actions when the item is clicked,
rather than navigating to a link.
Currently the only action is |
Here the requiredSystemProperties
is used to display this menu item only if
opennms.zenithConnect.enabled=true
is found in a .properties
file.
requiredSystemProperties
:{
"id": "zenithConnect",
"name": "Zenith Connect",
// other properties...
"requiredSystemProperties": [
{
"name": "opennms.zenithConnect.enabled",
"value": "true"
}
]
}