Options
All
  • Public
  • Public/Protected
  • All
Menu

Entry class of the LeanIX Reporting Library. An instance of this class is globally available as lx variable.

example
// The sequence to initialise the library for a report looks like this:
lx.init()
.then(function (setupInfo) {
  // Process setupInfo and create config object
  var config = {};
  lx.ready(config);
});

Hierarchy

  • LxCustomReportLib

Index

Constructors

constructor

Properties

dataModelHelpers

dataModelHelpers: DataModelHelpers

table

Accessors

latestPublishedState

  • get latestPublishedState(): any
  • Returns any

Methods

executeGraphQL

  • executeGraphQL(query: string, variables?: string): Promise<any>
  • Execute a custom GraphQL query to the LeanIX GraphQL API.

    example
    lx.executeGraphQL(`{
     allFactSheets(factSheetType: ITComponent) {
       edges {
         node {
           id
           name
           type
           description
         }
       }
     }
    }`)

    Parameters

    • query: string

      GraphQL query

    • Optional variables: string

      GraphQL variables

    Returns Promise<any>

    A promise that resolves to the resulting data

executeParentOriginXHR

  • executeParentOriginXHR(method: "GET" | "POST" | "PUT", path: string, body?: any): Promise<any>
  • Allows to make a XHR requests through the parents origin.

    Parameters

    • method: "GET" | "POST" | "PUT"

      GET, PUT and POST requests are permitted. For POST and PUT requests not every endpoint is allowed.

    • path: string

      Relative URL

    • Optional body: any

      Optional body for POST and PUT requests

    Returns Promise<any>

    A promise that resolves to the returned data

formatCurrency

  • formatCurrency(value: number, minimumFractionDigits?: number, compact?: boolean, locale?: string): string
  • Returns a formatted currency number according to the users currency settings.

    example
    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. €'

    Parameters

    • value: number

      Value to be formatted

    • Optional minimumFractionDigits: number

      Minimum number of digits to use for the fraction

    • Optional compact: boolean

      Defines whether to show compact display

    • Optional locale: string

      Defines locale info 'de-DE', 'en-EN'

    Returns string

    Currency string

getFactSheetFieldMetaData

  • Returns the configured or default meta data for a field at a Fact Sheet.

    example
    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

    Parameters

    • fsType: string

      Fact Sheet type

    • fieldName: string

      Name of a Fact Sheet field or relation

    Returns FieldViewMetaData

    Meta data

getFactSheetRelationFieldMetaData

  • getFactSheetRelationFieldMetaData(fsType: string, relationName: string, fieldName: string): FieldViewMetaData
  • Returns the configured or default meta data for a field of a Fact Sheet relation.

    example
    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

    Parameters

    • fsType: string

      Fact Sheet type

    • relationName: string

      Name of the directed relation

    • fieldName: string

      Name of a field on the relation

    Returns FieldViewMetaData

    Meta data

getFilterResult

  • getFilterResult(): any[]
  • Get the current filter result.

    Returns any[]

    Current filter result

getMetricsMeasurements

  • Get a list of measurements from the metrics service.

    beta

    Parameters

    • Optional nameOnly: boolean

      Set this to true to receive only the measurement names

    Returns Promise<MetricsMeasurement[]>

    A promise that resolves to an array of measurements

getMetricsRawSeries

  • getMetricsRawSeries(query: string): Promise<number[][]>
  • Get raw data for a metrics time series.

    beta

    Parameters

    • query: string

      A metrics service query

    Returns Promise<number[][]>

    A promise that resolves to the raw series data

getProjections

  • Get projections from the impact service.

    beta

    Parameters

    • attributes: ProjectionAttribute[]

      Fact Sheet attributes that the projection items should include.

    • filters: ProjectionFilter[]

      Filter definition for the projection items

    • pointsOfView: PointOfViewInput[]

      Amount of different point of views that the projection should include.

    Returns Promise<ProjectionsResponse>

hideEditToggle

  • hideEditToggle(): void

hideSpinner

  • hideSpinner(): void

init

  • 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.

    Returns Promise<ReportSetup>

    A promise that resolves to the ReportSetup object

isFeatureEnabled

  • isFeatureEnabled(featureId: string): Promise<boolean>
  • Check if a given Feature is enabled for the current Workspace.

    Parameters

    • featureId: string

      Feature identifier

    Returns Promise<boolean>

    Boolean expressing if the feature is enabled.

navigateToInventory

  • Navigate to inventory using provided filters

    Parameters

    Returns void

openFormModal

  • Show a customisable configuration dialog to the user, in which the user can adjust report settings.

    example
    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');
      }
    });

    Parameters

    Returns Promise<FormModalValues | false>

    A promise that resolves to the configuration confirmed by the user or to false if the user canceled the configuration

  • Show a customisable configuration dialog to the user, in which the user can adjust report settings.

    example
    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');
      }
    });

    Parameters

    Returns Promise<FormModalValues | false>

    A promise that resolves to the configuration confirmed by the user or to false if the user canceled the configuration

openLink

  • openLink(url: string, _target?: string): void
  • Since reports run inside an iframe, they are not allowed to open links. 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 (Firefox, Internet Explorer) show a popup warning whenever a link is opened via a message coming from an iframe.

    example
    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 });

    Parameters

    • url: string

      Link-URL

    • Optional _target: string

    Returns void

openRouterLink

  • openRouterLink(url: string): void
  • Navigate to a route within the LeanIX single-page app.

    Parameters

    • url: string

      Relative URL within LeanIX to navigate to

    Returns void

openSidePane

publishState

  • publishState(state: any): 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)

    Parameters

    • state: any

      Custom report state

    Returns void

ready

  • 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.

    Parameters

    Returns void

requestFactSheetSelection

  • Show a dialog to the user to select one or more Fact Sheets.

    Parameters

    Returns Promise<false | any | any[]>

    A promise that resolves to the selected Fact Sheet(s) or to false if the user canceled the selection

sendExcludedFactSheets

  • sendExcludedFactSheets(excludedFactSheets: any[]): void
  • Send list of Fact Sheets that could not be displayed in the report due to missing data. A warning will be shown the user to inform them of this.

    Parameters

    • excludedFactSheets: any[]

      List of excluded Fact Sheets

    Returns void

showEditToggle

  • showEditToggle(): void

showLegend

  • 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.

    example
    lx.showLegend([
      { label: 'foo', bgColor: '#ff0000' },
      { label: 'bar', bgColor: '#0000ff' }
    ])

    Parameters

    • items: LegendItem[]

      Legend items to be displayed

    Returns void

showSpinner

  • showSpinner(): void

showToastr

  • showToastr(type: ToastrType, message: string, title?: string): void
  • Show toastr of different types, with a custom message and a optional title.

    example
    lx.showToastr('error', 'Something went wrong');
    lx.showToastr('warning', 'This is a warning', 'Attention');

    Parameters

    • type: ToastrType

      toastr type

    • message: string

      message content

    • Optional title: string

    Returns void

translateCustomKey

  • translateCustomKey(key: string, interpolationData?: Record<string, string | number>): string | any
  • 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.

    example
    // 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'

    Parameters

    • key: string

      Translation key

    • Optional interpolationData: Record<string, string | number>

      Interpolation data

    Returns string | any

    Translation string or object

translateFactSheetType

  • translateFactSheetType(fsType: string, grammaticalNumber?: "singular" | "plural"): string
  • Returns the translation of a Fact Sheet type in singular or plural form. If multiplicity is not provided the singular version will be returned.

    example
    lx.translateFactSheetType('BusinessCapability')            // => 'Business Capability'
    lx.translateFactSheetType('BusinessCapability', 'plural')  // => 'Business Capabilities'

    Parameters

    • fsType: string

      Fact Sheet type

    • Optional grammaticalNumber: "singular" | "plural"

      Grammatical number, i.e., 'singular' or 'plural'. Defaults to 'singular'.

    Returns string

    Translation

translateField

  • translateField(fsType: string, fieldName: string): string
  • 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.

    example
    lx.translateField('Application', 'release') // => 'Release'

    Parameters

    • fsType: string

      Fact Sheet type

    • fieldName: string

      Name of the Fact Sheet field

    Returns string

    Translation

translateFieldValue

  • translateFieldValue(fsType: string, fieldName: string, value: string): string
  • 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.

    example
    lx.translateFieldValue('Application', 'functionalSuitability', 'appropriate')  // => 'Appropriate'

    Parameters

    • fsType: string

      Fact Sheet type

    • fieldName: string

      Name of the Fact Sheet field

    • value: string

      Value of this field

    Returns string

    Translation

translateRelation

  • translateRelation(relationName: string): string
  • 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.

    example
    lx.translateRelation('relDataObjectToApplication')  // => 'Applications'
    lx.translateRelation('relToChild')                  // => 'Children'

    Parameters

    • relationName: string

      Name of the relation

    Returns string

    Translation

updateConfiguration

  • In case the report has new requirements towards the report framework it can update the configuration that was initially passed to LxCustomReportLib.ready.

    Parameters

    Returns void

updateTableConfig

  • 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.

    Parameters

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc