Private
_currentPrivate
_latestPrivate
createPrivate
createPrivate
customReadonly
dataPrivate
doPrivate
encodePrivate
encodePrivate
encodePrivate
getPrivate
getPrivate
latestPrivate
latestPrivate
latestPrivate
messengerPrivate
mountPrivate
mountPrivate
mountPrivate
mountPrivate
mountPrivate
mountPrivate
mountPrivate
mountPrivate
mountPrivate
mountPrivate
mountPrivate
mountPrivate
mountPrivate
mountPrivate
mountUIButtonPrivate
mountUIElementsPrivate
mountUISelectionPrivate
mountUISelectionPrivate
replacePrivate
setupPrivate
translatePrivate
validatePrivate
waitGetter to receive the current state of the report setup. The object is only available if the report already called a successful init() LxCustomReportLib.init.
Execute a custom GraphQL query to the LeanIX GraphQL API.
GraphQL query
Optional
variables: stringGraphQL variables
A promise that resolves to the resulting data
lx.executeGraphQL(`{
allFactSheets(factSheetType: ITComponent) {
edges {
node {
id
name
type
description
}
}
}
}`)
Allows making XHR requests through the parent's origin.
The HTTP method for the request. GET, PUT, and POST requests are permitted. For POST and PUT requests, not every endpoint is allowed.
Relative URL for the request.
Optional
body: anyOptional body for POST and PUT requests. Defaults to an empty object.
Optional
responseType: "text" | "blob"The expected type of the response. Can be 'text' or 'blob'. Defaults to 'text'.
Optional
extendedHandling: booleanOptional boolean to add a custom header for extended request handling. If true, adds 'x-gateway-handle-request: EXTENDED' header. Defaults to false.
A promise that resolves to the returned data.
Returns a formatted currency number according to the users currency settings.
Value to be formatted
Optional
minimumFractionDigits: numberMinimum number of digits to use for the fraction
Optional
compact: booleanDefines whether to show compact display
Optional
locale: stringDefines locale info 'de-DE', 'en-EN'
Currency string
lx.formatCurrency(123.50, 2) => '€123.50'
lx.formatCurrency(12333.50, 0, true) => '€12K'
lx.formatCurrency(1288893.50, 2, true, 'de-DE') => '1,29 Mio. €'
Beta
Get all Fact Sheets from the GraphQL endpoint.
Fact Sheet type that needs to match.
Fact Sheet attributes that the response should include.
Filter definition for the Fact Sheets, if Composite Filters are defined, they are used instead of the normal Facet Filters.
A record of different point of views and their associated keys that the response should include and will return the Fact Sheets per each point of view key.
Optional
options: GraphQLOptionsOptional options to further specify the Fact Sheets
Returns the configured or default meta data for a field at a Fact Sheet.
Fact Sheet type
Name of a Fact Sheet field or relation
Meta data
lx.getFactSheetFieldMetaData('Application', 'functionalSuitability')
// Returns:
// {
// values: {
// perfect: {
// bgColor: '#fff',
// color: '#000'
// }
// ...
// }
// }
// Getting the actual background color for a field value:
lx.getFactSheetFieldMetaData('Application', 'functionalSuitability').values['perfect'].bgColor
Returns the configured or default meta data for a field of a Fact Sheet relation.
Fact Sheet type
Name of the directed relation
Name of a field on the relation
Meta data
lx.getFactSheetRelationFieldMetaData('Application', 'relApplicationToITComponent', 'technicalSuitability')
// Returns:
// {
// values: {
// fullyAppropriate: {
// bgColor: '#fff',
// color: '#000'
// }
// ...
// }
// }
// Getting the actual background color for a field value:
lx.getFactSheetRelationFieldMetaData(
'Application',
'relApplicationToITComponent',
'technicalSuitability'
).values['perfect'].bgColor
Beta
Get a list of measurements from the metrics service.
Optional
nameOnly: booleanSet this to true to receive only the measurement names
A promise that resolves to an array of measurements
Beta
Get projections from the impact service.
Fact Sheet attributes that the projection items should include.
Filter definition for the projection items
Amount of different point of views that the projection should include.
This method allows reports to check on users' workspace permissions. Therefore, reports can enable features according to given workspace permissions. See: [Authorization Model]https://docs-eam.leanix.net/docs/authorization-model
Shiro permissions string array to check (example: ['BOOKMARKS:CREATE:VISUALIZER', 'BOOKMARKS:CREATE:REPORTS']
creation of diagram bookmarks)
Promise of all requested permissions as key-value pair of the requested user permissions.
@deprecated. UI Elements are created or removed on ReportConfiguration.ui.
Hide the button shown via LxCustomReportLib.showEditToggle.
Hide the spinner that was previously shown via LxCustomReportLib.showSpinner.
Starts initialisation of the reporting framework. Returns a promise which is resolved once initialisation with the framework is finished. The resolved promise contains a ReportSetup instance with information provided to you through the framework. With that information you should be able to set up your report properly. Once that is done the LxCustomReportLib.ready function needs be called to signal that the report is ready to receive and process data and user events.
A promise that resolves to the ReportSetup object
Navigate to inventory using provided filters
Specified filters will be applied to inventory
Show a customisable configuration dialog to the user, in which the user can adjust report settings.
An object containing the form fields to be displayed in this dialog.
An object with the same keys as fields containing the initial values of those fields.
Optional
update: ((form) => FormModal)A promise that resolves to the configuration confirmed by the user or to false
if the user canceled the configuration
const fields = {
level: {
type: 'SingleSelect',
label: 'Level to be displayed',
options: [
{ value: '1', label: 'First level' },
{ value: '2', label: 'Both levels' }
]
},
hideEmpty: {
type: 'Checkbox',
label: 'Hide empty elements'
}
};
const initialValues = {
level: '2',
hideEmpty: false
};
lx.openFormModal(fields, initialValues).then((values) => {
if (values) {
console.log('Selection:', values.level, values.hideEmpty);
} else {
console.log('Selection cancelled');
}
});
Show a customisable configuration dialog to the user, in which the user can adjust report settings.
A promise that resolves to the configuration confirmed by the user or to false
if the user canceled the configuration
const fields = {
level: {
type: 'SingleSelect',
label: 'Level to be displayed',
options: [
{ value: '1', label: 'First level' },
{ value: '2', label: 'Both levels' }
]
},
hideEmpty: {
type: 'Checkbox',
label: 'Hide empty elements'
}
};
const values = {
level: '2',
hideEmpty: false
};
const messages = {
level: {type: 'error', message:'example message'}
}
const update = (formModal: lxr.FormModal): lxr.FormModal => {return createFormModal()}
lx.openFormModal({fields, values, messages, valid: true}, updated).then((values) => {
if (values) {
console.log('Selection:', values.level, values.hideEmpty);
} else {
console.log('Selection cancelled');
}
});
This method allows you to open any link in a new browser tab. Only Chrome and Safari allows you to open a new tab out of an iframe. Since reports run inside an iframe, they are not allowed to open links in other browsers. Therefore, the framework allows you to request to open a link. This will show a popup box outside the iframe containing the link. The user can click on it in order to open the link in a new tab.
It is not possible to directly open the link outside the iframe, since some browsers (e.g. Firefox) show a popup warning whenever a link is opened via a message coming from an iframe.
Link-URL
Optional
_target: string_target (target is ignored due to new popup behavior)
lx.openLink(this.baseUrl + '/factsheet/Application/28fe4aa2-6e46-41a1-a131-72afb3acf256');
// The baseUrl can be found in the setup returned by lx.init() like this:
// lx.init().then(setup => { this.baseUrl = setup.settings.baseUrl });
Beta
This function opens a "new" instance of the report in a separate tab. The state and facet filter parameters can be used as initial values for the new opened instance of the report.
Custom report state
Facet filter selection (UISelection.facets)
Optional
name: stringPreset name of the new report opened in new tab. If not set, falls back to default name.
Beta
Shows an overlaying sidepane with the provided elements.
Optional
update: ((factSheetUpdate) => void)Optional
onClick: ((sidepaneClick) => void)In case the report has some sort of internal state it should be published to the framework. The state will be persisted when the user saves a certain report configuration. Once that report configuration is restored the framework will pass the saved state to the report on initialisation (LxCustomReportLib.init and ReportSetup.savedState)
Custom report state
Signals that the custom report is ready. A configuration must be provided to tell the framework about the requirements of the report (most importantly which data it needs). The provided configuration acts as an interface between the report code and the report framework.
Optional
configuration: ReportConfigurationConfiguration object
Show a dialog to the user to select one or more Fact Sheets.
Configures the Fact Sheet selection.
A promise that resolves to the selected Fact Sheet(s)
or to false
if the user canceled the selection
@deprecated. UI Elements are created on ReportConfiguration.ui.
Display a button to toggle edit mode. Call LxCustomReportLib.hideEditToggle to hide it again. ReportConfiguration.allowEditing and ReportConfiguration.toggleEditingCallback need to be set to enable edit mode.
Display a custom legend for a given number of items. If a legend from a view is currently displayed, the calls to this function are ignored.
Legend items to be displayed
the spinner that was previously shown via
lx.showLegend([
{ label: 'foo', bgColor: '#ff0000' },
{ label: 'bar', bgColor: '#0000ff' }
])
Show a spinner on top of the report. Call LxCustomReportLib.hideSpinner to hide it again.
Show toastr of different types, with a custom message and a optional title.
toastr type
message content
Optional
title: stringoptional title
lx.showToastr('error', 'Something went wrong');
lx.showToastr('warning', 'This is a warning', 'Attention');
Track report framework events with amplitude tracking.
event type and content
lx.trackReportEvent(
{
type: 'DataChange'
reportType: 'net.leanix.matrix'
baseFactSheetType: 'Application'
view: 'lifecycle'
cluster: ['relApplicationToBusinessCapability']
drilldown: ['relToChild']
}
);
Returns the translation of a custom translation key according to the user's current language. If the translation key can be resolved to a translated string interpolation will be applied. If the translation key resolves to an object the object will be returned.
Translation key
Optional
interpolationData: Record<string, string | number>Interpolation data
Translation string or object
// For the custom translation json
{
"header": {
"title": "The title",
"subtitle": "Subtitle",
"description": "Hello {{name}}"
}
}
lx.translateCustomKey('header.title') // => 'The title'
lx.translateCustomKey('header') // => { "title": "The title", "subtitle": "Subtitle", "description": "Hello {{name}}" }
lx.translateCustomKey('header.description', { name: 'John' }) // => 'Hello John'
Returns the translation of a Fact Sheet type in singular or plural form. If multiplicity is not provided the singular version will be returned.
Fact Sheet type
Optional
grammaticalNumber: "singular" | "plural"Grammatical number, i.e., 'singular' or 'plural'. Defaults to 'singular'.
Translation
lx.translateFactSheetType('BusinessCapability') // => 'Business Capability'
lx.translateFactSheetType('BusinessCapability', 'plural') // => 'Business Capabilities'
Returns the translation of a field on a Fact Sheet. In case the field is not present in the translation model, the fieldName would be returned.
Fact Sheet type
Name of the Fact Sheet field
Translation
lx.translateField('Application', 'release') // => 'Release'
Returns the translation of a field value for fields with predefined set of values (e.g. Single Select). In case the field value is not present in the translation model, the value would be returned.
Fact Sheet type
Name of the Fact Sheet field
Value of this field
Translation
lx.translateFieldValue('Application', 'functionalSuitability', 'appropriate') // => 'Appropriate'
Returns the translation of the items a Fact Sheet relation links to. In case the relation is not present in the translation model, the relationName would be returned.
Name of the relation
Translation
lx.translateRelation('relDataObjectToApplication') // => 'Applications'
lx.translateRelation('relToChild') // => 'Children'
Returns the translation of a field present in a relation. In case the relation is not present in the translation model, the fieldName would be returned.
Name of the relation
Field of the relation
Translation
lx.translateRelationField('relDataObjectToApplication', 'usage') // => 'Usage'
lx.translateRelationField('relApplicationToBusinessCapability', 'functionalSuitability') // => 'Functional Fit'
Returns the translation of a field value for fields with predefined set of values (e.g. Single Select) present in a relation. In case the relation, fieldName or fieldValue is not present in the translation model, the fieldValue would be returned.
Name of the relation
Field of the relation
Value of this field
Translation
lx.translateRelationFieldValue('relApplicationToBusinessCapability', 'functionalSuitability', 'appropriate') // => 'Appropriate'
In case the report has new requirements towards the report framework it can update the configuration that was initially passed to LxCustomReportLib.ready.
A static tableConfig should be returned via ReportConfiguration.tableConfigCallback, but if the tableConfig is dynamic, this function can be used to update it at any time.
Hint: if the provided attribute is a string field name, which is not present in the data model, this field would be ignored, and not shown as a table column.
Generated using TypeDoc
Entry class of the LeanIX Reporting Library. An instance of this class is globally available as
lx
variable.Example