Usage
import { navigation } from 'nr1'
Methods
navigation.getOpenEntityLocation
function (entityGuid: string GUID of the entity to open.
) => undefined
const entityGuid = 'Mxka102Ak';
const location = navigation.getOpenEntityLocation(entityGuid);
navigation.getOpenLauncherLocation
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);
navigation.getOpenNerdletLocation
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);
navigation.getOpenOverlayLocation
function (overlay: Overlay Overlay you want to open.
) => undefined
const overlay = { id: 'nr1-core.search',};
const location = navigation.getOpenOverlayLocation(overlay);
navigation.getOpenStackedEntityLocation
function (entityGuid: string GUID of the entity to open.
) => undefined
const entityGuid = 'Mxka102Ak';
const location = navigation.getOpenStackedEntityLocation(entityGuid);
navigation.getOpenStackedNerdletLocation
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);
navigation.getReplaceNerdletLocation
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);
navigation.openEntity
function (entityGuid: string, GUID of the entity to open.
urlStateOptions: UrlStateOptions Options for the URL state.
) => undefined
const entityGuid = 'Mxka102Ak';
navigation.openEntity(entityGuid);
navigation.openLauncher
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);
navigation.openNerdlet
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);
navigation.openOverlay
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);
navigation.openStackedEntity
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);
navigation.openStackedNerdlet
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);
navigation.replaceNerdlet
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.
}