Live Platform
  • Introduction
  • Release Notes
    • Live 3
      • 3.59.0
      • 3.58.0
      • 3.57.0
      • 3.56.0
      • 3.55.0
      • 3.54.0
      • 3.53.0
      • 3.52.0
      • 3.51.0
      • 3.50.0
      • 3.49.0
      • 3.48.0
      • 3.47.0
      • 3.46.0
      • 3.45.0
      • 3.44.0
      • 3.43.0
      • 3.42.0
      • 3.41.0
      • 3.40.0
      • 3.39.0
      • 3.38.0
      • 3.37.0
      • 3.36.0
      • 3.35.0
      • 3.34.0
      • 3.33.0
      • 3.32.0
      • 3.31.0
      • 3.30.0
      • 3.29.0
      • 3.28.0
      • 3.27.0
      • 3.26.0
      • 3.25.0
      • 3.24.0
      • 3.23.0
      • 3.22.0
      • 3.21.0
      • 3.20.0
      • 3.19.0
      • 3.18.0
      • 3.17.0
      • 3.16.0
      • 3.15.0
      • 3.14.0
      • 3.13.0
      • 3.12.0
      • 3.11.0
      • 3.10.0
      • 3.9.0
      • 3.8.0
      • 3.7.0
      • 3.6.0
      • 3.5.0
      • 3.4.0
      • 3.3.0
      • 3.2.0
      • 3.1.0
      • 3.0.0
    • Live 2
  • Articles
    • Creating an aggregation
    • Creating a pipe
  • Theoretical Background
    • Fundamentals
    • Key Advantages
  • Platform Architecture
    • Introduction
    • Queries
    • Glossary
  • Featured plugins
    • Annotations
    • Groovy support
    • Messenger
    • Microsoft Teams
    • MongoDB
    • MongoDB Timeseries
    • MongoDB Kit
    • Purge plugin
    • SQL
    • TCP Input
    • TimescaleDB
  • Data visualization
    • Pipes widgets
      • Temporal
      • Cartesian
      • Multi-value snapshot
      • Single-value snapshot
      • Tables
      • Heatmap
      • JSX Widgets
      • Lollipop
      • Histogram
      • State Timeline
      • Boxplot
    • Pipes modifiers on Pipes charts
  • Alerts and notifications
    • Pipes modifiers on rules
  • Pipes Queries
    • Introduction
    • Dynamic filters
    • Meta parameters
    • Reducer
      • Uniform compress
      • PIP
    • Storage Hints
    • Execution Context
    • Event flow modifiers
  • Developers
    • Plugins
    • Packages
    • Backend API
      • Lookup Tables
      • Extensions
      • Settings
      • Storage Providers
      • Web Services
      • Web Setup
      • Entity Audit
    • Web application
      • Services
        • Point service
        • Menu service
      • Browser Compatibility
      • Runtime modules
        • Core Javascript modules
        • Library modules
        • Adding modules to runtime
      • Localization (i18n)
      • Date formatting
      • Dashboard and Widgets
        • Widget API
        • Custom widget editors
        • Live Event Types
        • Live Widget Configuration
        • Live Widget Packaging
        • Widget Request Interceptors
      • React Contexts
        • Dashboard
        • Dashboard widget
      • Registering Home Page options
    • Python application
    • Subscribing to Live Events
  • Administration
    • Configuration
      • Home Page Customization
      • live.properties
    • Infrastructure Monitoring
    • Storage Monitoring
    • Queries Monitoring
    • Logs Monitoring
    • Data Purging
  • Features
    • Access Permission
    • Datasources
    • Export Dashboard
    • Partial Indexes
    • WebApp Metrics
    • Entity Audit
Powered by GitBook
On this page
  • Standard API
  • Menu service
  • How to import
  • Methods
  • Menu Item Base
  • Menu Right Item
  • Menu Preferences Item
  • Menu Console Item
  • Examples
  • Regular menu example:
  • Regular menu with selectedAliases:
  • Regular menu with replaces:
  • Right menu example:
  • Preferences menu example:
  • Console menu example:

Was this helpful?

  1. Developers
  2. Web application
  3. Services

Menu service

Live provides an API to register new menu items at navigation bar.

Standard API

Since Live @ 2

Menu service

The menuService is a javascript module that allows registering custom menu items to Live navigation bar or an item that already exists at the navigation bar. Every menu item must have a unique name and alias to represent itself.

How to import

import MenuService from 'live/services/menu'

Methods

register(menu: MenuItem, type: MenuType): void

Register a new menu item.

unregister(menu: MenuItem, type: MenuType): void

Unregister an already existing menu item.

getAll(): MenuItems

Obtain all registered menu items.

withMenuItems(Component: React.ComponentType<{ menus: MenuItems }>): React.FC

Allow a React component to receive all listed menus.

Menu Item Base

The base properties that are commom between all types of menu are explained in more detail in the table below:

Property
Required
Description

name

Yes

Textual name of the menu that will be displayed in the navbar.

alias

Yes

Textual representation of the menu, used to apply the "selected" status to the option at the navbar. It must be the same alias of the registered route.

url

Yes

Route to access the menu component (it must be the same path registered previously by live/services/router or other compatible route API you want). Must respect the format /#/${path}/.

Component

No

Instead of a url route, you can use this property to render a component (like Configurations dropdown), but will need to style the menu item manually inside it. * It will not use the url if you don't use the props.href inside it.

selectedAliases

No

Array with all textual names the menu will have. If your registered menu alias and route alias are different, you should add the route alias to the selectedAliases array so the "selected" status is applied correctly.

order

No

Numeric representation of the order that the menu will appear (if not set, it will appear just before the Configurations menu).

replaces

No

Textual representation of an alias of another menu item you want to replace with the one you're creating.

config.showOnMobile

No

If set to false, it will not show the menu option when Live is in mobile mode.

onClick

No

Function that must be executed when clicking the menu item

Menu Right Item

The 'right' type menu has the component property instead of the Component described before. It also have the same properties, with an extra described as follows:

Property
Required
Description

config.iconCls

No

Icon you want to use to represent the new menu. It already has the far class applied (or fal if showOnMobile is true).

Menu Preferences Item

The preferences menu has some extra properties that are described down below:

Property
Required
Description

description

No

This text will appear right after the menu name in the dropdown menu, like the "Email, password, permissions" of "My account" menu.

icon

No

Icon that will represent your menu. It will be located aside the menu name and description.

Menu Console Item

The console menu has the same component, name, url, onClick, icon and description described above, but have its own particularities. See the table below to know about the extra properties of it:

Property
Required
Description

config.iconCls

No

Same behavior of the icon property. It's the class of the icon you want to appear.

config.iconPath

No

If you want to show a pre-defined image to act as your icon, you should use it as the path to find the it.

Examples

Regular menu example:

const Test = (): JSX.Element => <h1 style={{ padding: '50px 0 0 20px' }}>Test</h1>

Router.route('test', Test, 'test')

MenuService.register(
    {
        alias: 'test',
        name: 'Test Menu',
        url: '/#/test/'
    },
    'regular'
)

Regular menu with selectedAliases:

const Test = (): JSX.Element => <h1 style={{ padding: '50px 0 0 20px' }}>Test</h1>

Router.route('test-url', Test, 'test-route-alias')

MenuService.register(
    {
        alias: 'test',
        name: 'Test Menu',
        url: '/#/test-url/',
        selectedAliases: ['test-route-alias'],
    },
    'regular'
)

Regular menu with replaces:

const Test = (): JSX.Element => <h1 style={{ padding: '50px 20px'}}>Test</h1>

Router.route('test', Test, 'test')

MenuService.register(
    {
        alias: 'test',
        name: 'Test Menu',
        url: '/#/test',
        replaces: 'dashboards'
    },
    'regular'
)

Right menu example:

const Test = (): JSX.Element => <h1 style={{ padding: '50px 20px'}}>Test</h1>

Router.route('test', Test, 'test')

MenuService.register(
    {
        alias: 'test',
        name: 'Test Menu',
        url: '/#/test/',
        config: { iconCls: 'fa-info-circle' }
    },
    'right'
)

Preferences menu example:

const Test = (): JSX.Element => <h1 style={{ padding: '50px 20px'}}>Test</h1>

Router.route('test', Test, 'test')

MenuService.register(
    {
        alias: 'test',
        name: 'Test Menu',
        url: '/#/test/',
        icon: 'far fa-info-circle',
        description: 'This is a test menu'
    },
    'preferences'
)

Console menu example:

const Test = (): JSX.Element => <h1 style={{ padding: '50px 20px'}}>Test</h1>

Router.route('test', Test, 'test')

MenuService.register(
    {
        alias: 'test',
        name: 'Test Menu',
        url: '#/test',
        icon: 'far fa-info-circle'
    },
    'console'
)
PreviousPoint serviceNextBrowser Compatibility

Last updated 1 year ago

Was this helpful?

This prop must not be used to replace the Home button, instead, you can use the .

⚠️
custom home page API
Regular menu output
Regular menu with selectedAliases
Regular menu with replaces
Right menu output
Preferences menu output
Console menu output