• Log inStart now

nerdlet

Usage

import { nerdlet } from 'nr1'

API methods

nerdlet.getSetUrlStateLocation

function (
urlState: Object

New nerdlet URL state.

) => Location

nerdlet.setConfig

function (
config: NerdletConfig

New nerdlet config

) => undefined

nerdlet.setUrlState

function (
urlState: Object,

New nerdlet URL state.

urlStateOptions: UrlStateOptions

Options for the URL state.

) => void

Type definitions

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.

}

NerdletConfig

{
accountPicker: boolean,

Enable or disable the nerdlet's account picker.

accountPickerValues: any[],

Config the available accounts for the account picker. There are only two options: all authorized accounts (default) or all authorized accounts plus the 'All accounts' option (cross-account support). See examples for more details.

actionControls: boolean,

Enable or disable the nerdlet's action controls.

actionControlButtons: ActionControlButton[],

Config of your own custom action controls for the nerldet.

filterBar: boolean,

Enable or disable the nerdlet's filter bar.

header: boolean,

Enable or disable the nerdlet's header.

headerTitle: string,

Set the title of the nerdlet's header.

headerTitleMetadata: string,

Set the title metadata of the nerdlet's header.

headerType: string,

Set the header type of the nerdlet's header. Possible values are from nerdlet.HEADER_TYPE.

headerParentTitle: string,

Set the parent title of the nerdlet's header.

headerParentLocation: Location,

Set the parent location of the nerdlet's header.

timePicker: boolean,

Enable or disable the nerdlet's time picker.

timePickerRanges: TimePickerRange[],

Set of time ranges to display for this nerdlet.

timePickerDefaultOffset: number,

Time range offset to select by default.

}

ActionControlButton

{
label: string,

Label of the action control button.

type: Button.TYPE.PRIMARY | Button.TYPE.PLAIN,

Type of the action control button.

iconType: string,

Name of the icon to display.

hint: string,

Text used for the action control button's tooltip.

onClick: () => void,

Callback fired any time the user clicks on the action control button.

}

TimePickerRange

{
label: string,

Label for this time range.

offset: number,

Offset in ms.

}

UrlStateOptions

{
replaceHistory: boolean,

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

}

Constants

nerdlet.ACCOUNT_PICKER_DEFAULT_VALUES

[
{ id: "authorized-accounts" }
]

nerdlet.ACCOUNT_PICKER_VALUE

{
CROSS_ACCOUNT: { id: "cross-account" }
}

nerdlet.ACTION_CONTROL_BUTTON_TYPES

{
PRIMARY: "primary",
SECONDARY: "secondary",
TERTIARY: "tertiary"
}

nerdlet.HEADER_TYPE

{
CUSTOM: "custom",
ENTITY: "entity"
}

nerdlet.TIME_PICKER_DEFAULT_RANGES

[
{ label: "30 minutes", offset: 1800000 },
{ label: "60 minutes", offset: 3600000 },
{ label: "3 hours", offset: 10800000 },
{ label: "6 hours", offset: 21600000 },
{ label: "12 hours", offset: 43200000 },
{ label: "24 hours", offset: 86400000 },
{ label: "3 days", offset: 259200000 },
{ label: "7 days", offset: 604800000 },
{ label: "Set custom", offset: "Custom" }
]

nerdlet.TIME_PICKER_RANGE

{
CUSTOM: { label: "Set custom", offset: "Custom" },
NONE: { label: "Default", offset: null }
}
Copyright © 2024 New Relic Inc.

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