Skip to content

About

Library to develop custom reports for LeanIX.

Topics

Resources

Code of conduct

Security policy

Stars

17 stars

Watchers

11 watching

Forks

Latest commit

 

History

354 Commits

Folders and files

Repository files navigation

@leanix/reporting

npm version

This library allows you to develop your own custom reports for SAP LeanIX Enterprise Architecture Management. To scaffold, develop, and deploy custom reports, use the SAP LeanIX custom report tools.

For official documentation, see the Custom Reports and Reporting Library and Custom Report Tools pages on the SAP Help Portal.

Installation

Simply install the library via npm:

npm install @leanix/reporting --save

Usage

Modern Usage (ES Module Imports)

import { lx, lxr } from "@leanix/reporting";

lx.init().then((setup: lxr.ReportSetup) => {
  const config: lxr.ReportConfiguration = {};
  lx.ready(config);
});

All types are accessed via the lxr namespace (e.g., lxr.ReportSetup, lxr.ReportConfiguration, lxr.FactSheet).

Legacy Usage (Global Variables)

As a simple script tag inside your HTML

<script src="node_modules/@leanix/reporting/index.js"></script>
<script>
  // Now we have a global lx object.
  console.log(lx);
</script>

Using ES6 Module syntax with global variables

import "@leanix/reporting";

// Now we have a global `lx` object.
console.log(lx);
lx.init().then(function (setupInfo) {
  // Process setupInfo and create config object
  var config = {};
  lx.ready(config);
});

Documentation

AI Agent Development Guide

For AI agents assisting with custom report development: See ./ai_agent_guide for comprehensive instructions, best practices, and workflows.

Typedoc

Since the reporting library is created using TypeScript we are able to provide documentation of the typings that you can find here: https://leanix.github.io/leanix-reporting/

Examples

Sometimes its easier to look at a few code examples than read through lines of documentation. Therefore we provide some snippets with code examples in the examples folder.

Basic concept of the SAP LeanIX reporting framework

A report for SAP LeanIX consists of HTML, JavaScript and CSS files, which are loaded into an iframe inside of the application. The report which is running within the iframe and the host application that contains the iframe communicate via a predefined set of messages (see: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage).

As a report developer you do not have to know about the messages. This library takes care of the communication with the host application and provides a simple API that you can use to request data, send commands to the host application or be informed about events happening outside of your report.

Init sequence

Config object

The config object which has to be passed to lx.ready() acts as an interface between your report code and the reporting library. It allows you to define the requirements for your report, such as which data you want to fetch from SAP LeanIX backend. In addition to that you have to register callback functions in the config object, which are called by the reporting library once certain events occur (for example when data has been fetched from the backend).

You can find the interface definition of the config object here: https://leanix.github.io/leanix-reporting/interfaces/lxr.ReportConfiguration.html

Issues and Support

In case you encounter issues with the reporting framework, please contact support@leanix.net.

About

Library to develop custom reports for LeanIX.

Topics

Resources

Code of conduct

Security policy

Stars

17 stars

Watchers

11 watching

Forks

Releases

Packages

Used by

Contributors