• EnglishEspañol日本語한국어Português
  • Log inStart now

navigation

Usage

import { navigation } from 'nr1'

Methods

function (
entityGuid: string

GUID of the entity to open.

) => undefined
const entityGuid = 'Mxka102Ak';
const location = navigation.getOpenEntityLocation(entityGuid);
function (
launcher: Launcher

Launcher to open.

) => undefined
const launcher = {
id: 'nr1-core.explorer',
};
const location = navigation.getOpenLauncherLocation(launcher);
// You can also specify a nerdlet and stacked nerdlets to be opened.
// You can combine Nerdpack items from different nerdpacks.
const launcher = {
id: '074e8260-fa9c-4d71-f7a0-51835417a423.my-launcher-id',
nerdlet: {
id: 'nr1-core.listing',
},
stackedNerdlets: [
{
id: 'dashboards.list',
},
],
};
const location = navigation.getOpenLauncherLocation(launcher);
function (
nerdlet: Nerdlet

Nerdlet to replace current nerdlet with.

) => undefined
const nerdlet = {
id: 'dashboards.list',
};
const location = navigation.getOpenNerdletLocation(nerdlet);
// You can also specify nerdlet's state.
const nerdlet = {
id: 'dashboards.list',
urlState: {
foo: 'bar',
},
};
const location = navigation.getOpenNerdletLocation(nerdlet);
function (
overlay: Overlay

Overlay you want to open.

) => undefined
const overlay = {
id: 'nr1-core.search',
};
const location = navigation.getOpenOverlayLocation(overlay);
function (
entityGuid: string

GUID of the entity to open.

) => undefined
const entityGuid = 'Mxka102Ak';
const location = navigation.getOpenStackedEntityLocation(entityGuid);
function (
nerdlet: Nerdlet

Nerdlet to open as stacked nerdlet.

) => undefined
const nerdlet = {
id: 'dashboards.list',
};
const location = navigation.getOpenStackedNerdletLocation(nerdlet);
// You can also specify nerdlet's state.
const nerdletWithState = {
id: 'dashboards.list',
urlState: {
foo: 'bar',
},
};
const location = navigation.getOpenStackedNerdletLocation(nerdletWithState);
// If you want to open nerdlet from the current nerdpack then you can omit its nerdpackId.
const nerdletWithState = {
id: 'my-nerdlet-id',
urlState: {
foo: 'bar',
},
};
const location = navigation.getOpenStackedNerdletLocation(nerdletWithState);
function (
nerdlet: Nerdlet

Nerdlet to replace current nerdlet with.

) => undefined
const nerdlet = {
id: 'dashboards.list',
};
const location = navigation.getReplaceNerdletLocation(nerdlet);
// If the nerdlet you want to replace with is in the current nerdpack then you can omit its nerdpackId.
const nerdlet = {
id: 'my-nerdlet-id',
};
const location = navigation.getReplaceNerdletLocation(nerdlet);
// You can also specify nerdlet's state.
const nerdlet = {
id: 'my-nerdlet-id',
urlState: {
foo: 'bar',
},
};
const location = navigation.getReplaceNerdletLocation(nerdlet);
function (
entityGuid: string,

GUID of the entity to open.

urlStateOptions: UrlStateOptions

Options for the URL state.

) => undefined
const entityGuid = 'Mxka102Ak';
navigation.openEntity(entityGuid);
function (
launcher: Launcher,

Launcher to open.

urlStateOptions: UrlStateOptions

Options for the URL state.

) => undefined
const launcher = {
id: 'nr1-core.explorer',
};
navigation.openLauncher(launcher);
// You can also specify a nerdlet and stacked nerdlets to be opened.
// You can combine Nerdpack items from different nerdpacks.
const launcher = {
id: '074e8260-fa9c-4d71-f7a0-51835417a423.my-launcher-id',
nerdlet: {
id: 'nr1-core.listing',
},
stackedNerdlets: [
{
id: 'dashboards.list',
},
],
};
navigation.openLauncher(launcher);
function (
nerdlet: Nerdlet,

Nerdlet to open.

urlStateOptions: UrlStateOptions

Options for the URL state.

) => undefined
const nerdlet = {
id: 'dashboards.list',
};
navigation.openNerdlet(nerdlet);
// You can also specify nerdlet's state.
const nerdletWithState = {
id: 'dashboards.list',
urlState: {
foo: 'bar',
}
};
const location = navigation.getOpenNerdletLocation(nerdletWithState);
function (
overlay: Overlay,

Overlay you want to open.

urlStateOptions: UrlStateOptions

Options for the URL state.

) => undefined
const overlay = {
id: 'nr1-core.search',
};
navigation.openOverlay(overlay);
function (
entityGuid: string,

GUID of the entity to open.

urlStateOptions: UrlStateOptions

Options for the URL state.

) => undefined
// Opens stacked entity.
const entityGuid = 'Mxka102Ak';
navigation.openStackedEntity(entityGuid);
function (
nerdlet: Nerdlet,

Nerdlet to open as stacked nerdlet.

urlStateOptions: UrlStateOptions

Options for the URL state.

) => undefined
const nerdlet = {
id: 'dashboards.list',
};
navigation.openStackedNerdlet(nerdlet);
// You can also specify nerdlet's state.
const nerdletWithState = {
id: '074e8260-fa9c-4d71-f7a0-51835417a423.my-nerdlet-id',
urlState: {
foo: 'bar',
}
};
navigation.openStackedNerdlet(nerdlet);
// If you want to open nerdlet from the current nerdpack then you can omit its nerdpackId.
const nerdletWithState = {
id: 'my-nerdlet-id',
urlState: {
foo: 'bar',
}
};
navigation.openStackedNerdlet(nerdlet);
function (
nerdlet: Nerdlet,

GUID of the entity to open.

urlStateOptions: UrlStateOptions

Options for the URL state.

) => undefined
const nerdlet = {
id: 'dashboards.list',
};
navigation.replaceNerdlet(nerdlet);
// If the nerdlet you want to replace with is in the current nerdpack then you can omit its nerdpackId.
const nerdlet = {
id: 'my-nerdlet-id',
};
navigation.replaceNerdlet(nerdlet);
// You can also specify nerdlet's state.
const nerdlet = {
id: 'my-nerdlet-id',
urlState: {
foo: 'bar',
},
};
navigation.replaceNerdlet(nerdlet);

Type definitions

Nerdlet

{
id: string,

Id of the nerdlet. You can specify the full nerdlet id: <nerdpack-id>.<nerdlet-id> (i.e. '8ba28fe4-5362-4f7f-8f9a-4b8c6c39d8a6.my-nerdlet') or simply <nerdlet-id> (i.e. 'my-nerdlet'). In the latter case, the nerdlet will be treated as if it belongs to the current nerdpack, meaning that the nerdpack id is automatically added by the platform.

urlState: Object,

State of the nerdlet which is persisted in the url.

}

UrlStateOptions

{
replaceHistory: boolean,

If true, the current entry in the browser history will be replaced with the new one.

}

Overlay

{
id: string,

Id of the overlay to be opened, for example nr1-core.search.

urlState: Object,

State of the overlay which is persisted in the url.

}

Launcher

{
id: string,

Id of the launcher, for example nr1-core.explorer.

nerdlet: Nerdlet,

Nerdlet to be opened in the launcher. If not provided, the root nerdlet of the launcher will be opened.

stackedNerdlets: Nerdlet[],

Nerdlet to be opened as stacked nerdlets.

}

Location

{
pathname: string,

String representing the path to link to.

search: string,

String representing query parameters.

hash: string,

String to put in the URL as hash, e.g. #entities.

}
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.