# Global Interface: window.prism

The prism global is available on the window scope anywhere within the Sisense web client, providing access to global APIs.

Example:

// Access the current Sisense version:
console.log(prism.version);

# Properties

Name Type Description Example
version string Current Sisense version '8.1.1.10050'
platform string Current platform 'desktop'
proxyurl string If set, the proxy URL ''
activeDashboard Dashboard When viewing a dashboard or widget, a reference to the current Dashboard object
activeWidget Widget When viewing a widget (in widget editor), a reference to the current Widget object
brand BrandingConfiguration White-labeling feature settings
consts GlobalConstants Global constants
features FeatureConfiguration[] Current feature flags
globalization GlobalizationConfiguration Current globalization settings
user User Current user information

# Methods

# debugging.GetJaql

debugging.GetJaql(widget) → string

Get a Widget's JAQL query, including applicable Dashboard-level filters

Arguments

Name Type Description Example
widget Widget Widget to get

Returns

A string representing a JSON-stringified JAQL query.

Example

console.log(prism.debugging.GetJaql(prism.activeWidget));

# debugging.GetSql

debugging.GetSql(widget) → string

Generate a SQL query from the provided Widget, including applicable Dashboard-level filters.

Arguments

Name Type Description Example
widget Widget Widget to get

Returns

A string of the SQL query.

Example

console.log(prism.debugging.GetSql(prism.activeWidget));

# getApi

getApi(apiName) → object

Access point for new client APIs.

Arguments

Name Type Description Example
apiName string Name of API module to retrieve 'api.v1.header'

Returns

An API module instance.

Example

var header = prism.getApi('api.v1.header');

# on

on(eventName, eventHandler)

Subscribe to a global event

Arguments

Name Type Description Example
eventName string Event to register to 'beforemenu'
eventHandler function Event handler function

Returns

N/A

Example

prism.on('beforemenu', function () {
    console.log('a menu was opened');
});

# registerWidget

registerWidget(widgetName, manifest)

Register a new widget type (visualization) for use in Dashboards.

Arguments

Name Type Description Example
widgetName string Unique widget type name 'funnelWidget'
manifest WidgetManifest Object describing the widget type (see reference)

Returns

N/A

Example

prism.registerWidget('myWidget', {
    // Widget manifest
});

# Events

# apploaded

Fired when the whole Sisense Web Application is loaded.

Arguments

N/A

# beforemenu

Fired before every menu is opened and allows the removal of existing menu items and the addition of custom menu items.

Available menu names to customize:

  • datapoint
  • dashboard
  • widget
  • widgetindashboard
  • widget-metadataitem
  • widget-metadataitem-sort
  • widget-metadataitem-type
  • databrowser-field
  • databrowser-formula
  • formula-metadataitem
  • dashboard-filter

Arguments

Name Type Description
ev Event Object describing the event
args Object Event arguments
args.ui Object Menu UI properties
args.settings Object Menu configuration
args.settings.items MenuItem[] Array of menu items
args.settings.name string Menu name (used to identify which menu was opened)

Example

prism.on('beforemenu', (ev, args) => {
    if (args.settings.name === 'widget') {
        console.log('widget menu was opened!');
    }
});

# beforewidgetmenu

Fired when clicking the widget menu while in Edit Widget mode.

Arguments

Name Type Description
widget Widget Widget instance.
items object[] Array of items to be displayed.
element DOMElement Source element that triggers. the event.
cancel boolean Determines whether the menu is displayed or not.

# beforewidgetindashboardmenu

Fired when clicking the widget's menu while viewing a dashboard.

Arguments

Name Type Description
widget Widget Widget instance.
items object[] Array of items to be displayed.
element DOMElement Source element that triggers. the event.
cancel boolean Determines whether the menu is displayed or not.

# homeloaded

Fired when the home page in the Sisense Web Application is loaded.

Arguments

N/A

# widgetloaded

Fired when a widget model was loaded to the widget editor.

Arguments

Name Type Description
widget Widget Widget instance.

# unwidgetloaded

Fired when a dashboard model was unloaded from the widget editor.

Arguments

Name Type Description
widget Widget Widget instance.

# beforedashboardloaded

Fired before a dashboard JSON is loaded into a dashboard model.

Arguments

Name Type Description
dashboard Dashboard Dashboard instance.

# dashboardloaded

Fired when a dashboard model is loaded into the environment.

Arguments

Name Type Description
dashboard Dashboard Dashboard instance.

# dashboardunloaded

Fired when a dashboard model is unloaded from the environment.

Arguments

Name Type Description
dashboard Dashboard Dashboard instance.

# Sub-types

# Branding Configuration

An object containing the branding/white-labeling configuration

Example

{
  "dummy": {
    "small": null,
    "large": null
  },
  "contactUsText": null,
  "emails": {
    "passwordRecoverySubject": null,
    "createdUserSubject": null,
    "senderEmail": null,
    "shareWithExistingUserSubject": null,
    "transferOwnership": null,
    "shareWithNewUserSubject": null,
    "senderName": null,
    "newUserInviteSubject": null,
    "templates_directory": null
  },
  "homePage": null,
  "logo": {
    "tablet": {
      "large": null,
      "small": null
    },
    "phone": {
      "small": null,
      "large": null
    },
    "desktop": {
      "large": null,
      "small": null
    }
  },
  "activationTitle": null,
  "forumUrl": null,
  "poweredBySisense": true,
  "homePageConfig": {
    "marketingPart": null,
    "documentationLink": null,
    "tutorialsLink": null,
    "hideSearchInNavver": "true"
  },
  "favicon": null,
  "loginTitle": null,
  "documentationUrl": null,
  "pageTitle": null,
  "activationSubtitle": null,
  "loginSubtitle": null,
  "copyrightText": null,
  "enabled": true
}

# Global Constants

An object containing various global constants used within the Sisense UI application

Properties

Name Type Description Example
nullValue string A string to replace null values with 'N\\A'

Example

{
  "nullValue": "N\\A"
}

# Feature Configuration

An object representing a feature flag - indicating whether a Sisense feature is turned on or off.

Properties

Name Type Description Example
key string Feature name 'alerting'
active boolean Is Feature turned on true

Example

[
    { "key":"alerting",  "active":true  },
    { "key":"liveQuery", "active":false },
    { "key":"embedCode", "active":false }
]

# Globalization Configuration

An object defining configuration for globalization

Properties

Name Type Description Example
language string Current language 'en-US'
localization.autoDetectEnabled boolean Should language be detected automatically true
localization.default string Default configured language en-US

Example

{
    "language": "en-US",
    "localization": {
        "autoDetectEnabled": true,
        "default": "en-US"
    }
}