Class RevealSdkSettings

This class is used to specify global settings for the SDK.

Hierarchy

  • RevealSdkSettings

Index

Properties

Static fieldFormattingSettingsProvider

fieldFormattingSettingsProvider: function

Specifies a callback function that will be invoked when working with a dashboard and might return the formatting to be used for the given field.

@param

Information about the field, including name, data type and current formatting settings.

@param

provides Context information for the formatting request. In particular, the dashboard ID (if applicable).

@returns

The formatting to apply to the given field. If null, the original formatting will be applied.

Type declaration

Static localizedStringsProvider

localizedStringsProvider: function

Specifies a callback function that will be invoked when working with a dashboard and might return a replacement text -usually a localized value- to be used instead of the original.

@param

the element that needs to be localized, e.g. a Widget title. The current text is a property of this object.

@param

provides context information for the localization request. In particular, the dashboard ID containing the element to be localized.

@returns

The replacement text. A null return value is the same as returning the current text.

Type declaration

Accessors

Static enableActionsOnHoverTooltip

  • get enableActionsOnHoverTooltip(): boolean
  • set enableActionsOnHoverTooltip(value: boolean): void
  • Returns boolean

  • Parameters

    • value: boolean

    Returns void

Static enableBetaFeatures

  • get enableBetaFeatures(): boolean
  • set enableBetaFeatures(value: boolean): void
  • Returns boolean

  • Parameters

    • value: boolean

    Returns void

Static enableNewCharts

  • get enableNewCharts(): boolean
  • set enableNewCharts(value: boolean): void
  • Returns boolean

  • Parameters

    • value: boolean

    Returns void

Static measuringHostElement

  • get measuringHostElement(): null | string
  • set measuringHostElement(selector: null | string): void
  • Specifies a dom element that could host few invisible helper span elements, which are used by the RevealView to measure text sizes. If no dom element is set the RevealView would add these helper spans to the element where a dashboard is rendered. This would work fine as long as you need a single RevealView instance rendered at a given moment. In case you need to have multiple instances rendered simultaneously you will need to set a selector, pointing to an element in dom where these helper span elements will be created.

    Returns null | string

  • Specifies a dom element that could host few invisible helper span elements, which are used by the RevealView to measure text sizes. If no dom element is set the RevealView would add these helper spans to the element where a dashboard is rendered. This would work fine as long as you need a single RevealView instance rendered at a given moment. In case you need to have multiple instances rendered simultaneously you will need to set a selector, pointing to an element in dom where these helper span elements will be created.

    Parameters

    • selector: null | string

      that references to an element that could host these helper objects.

    Returns void

Static requestWithCredentialsFlag

  • get requestWithCredentialsFlag(): boolean
  • set requestWithCredentialsFlag(flag: boolean): void
  • Configures if the AJAX requests sent by Reveal to the backend should include authentication cookies or not. You might need to set this flag to true when your backend uses cookies for authentication and session handling and the frontend is in a different domain (CORS rules applies), for example if you're using Angular or React.

    Returns boolean

  • Configures if the AJAX requests sent by Reveal to the backend should include authentication cookies or not. You might need to set this flag to true when your backend uses cookies for authentication and session handling and the frontend is in a different domain (CORS rules applies), for example if you're using Angular or React.

    Parameters

    • flag: boolean

      true if the AJAX request sent by Reveal when it sends a request to the backend should have "withCredentials: true" or not.

    Returns void

Static shapeFilesUrl

  • get shapeFilesUrl(): string
  • set shapeFilesUrl(url: string): void
  • The URL where the MapData.json could be retrieved from. ShapesMetadataFileUrl + "MapData.json" should be pointing to valid MapData.json.

    Returns string

  • The URL where the MapData.json could be retrieved from. ShapesMetadataFileUrl + "MapData.json" should be pointing to valid MapData.json.

    Parameters

    • url: string

    Returns void

Static theme

  • Get/sets the theme to be used by RevealView when rendering a dashboard. Make sure to set the theme before you have any RevealView rendering a dashboard.

    Returns RevealTheme

  • Get/sets the theme to be used by RevealView when rendering a dashboard. Make sure to set the theme before you have any RevealView rendering a dashboard.

    Parameters

    Returns void

Static visualizations

Methods

Static ensureFontsLoaded

  • ensureFontsLoaded(): Promise<void>
  • Call and await this before you render a RevealView component to make sure all the needed fonts are loaded in the browser. You might also want to call and await this if you update the RevealSdkSettings.theme with another theme that's using different fonts that might not be loaded. Not awaiting this might result on some texts(like dashboard title) being cropped on initial load.

    Returns Promise<void>

Static ensureFontsLoadedAsync

  • ensureFontsLoadedAsync(): Promise<void>
  • @deprecated

    Call and await this before you render a RevealView component to make sure all the needed fonts are loaded in the browser. You might also want to call and await this if you update the RevealSdkSettings.theme with another theme that's using different fonts that might not be loaded. Not awaiting this might result on some texts(like dashboard title) being cropped on initial load.

    Please use the ensureFontsLoaded method, as this method will be removed in a future release.

    Returns Promise<void>

Static getCurrentLocale

  • Returns the current locale to be used to localize Reveal Sdk UI.

    Returns SupportedLocales

Static getOAuthAuthenticatedBaseUrl

  • getOAuthAuthenticatedBaseUrl(): null | string
  • Returns null | string

Static overrideLocale

  • Overrides current localization locale, which is picked up by the browser's, by default. Make sure you await the promise before overriding the locale again. Supported locales are "de","es", "fr", "it", "ja", "ko", "ms", "nl", "pt", "ru", "zh-cn" and "zh-tw".

    await RevealApi.RevealSdkSettings.overrideLocale(RevealApi.SupportedLocales.De);
    

    Parameters

    Returns Promise<void>

Static setAdditionalHeadersProvider

  • setAdditionalHeadersProvider(provider: function): void
  • Specifies a callback function that will be invoked before a request to the Reveal backend and might return additional headers to be included in the request. The specified function is expected to return an object with the headers, like: { 'Session-Id': sessionId } This is useful to send authentication headers to the backend.

    JavaScript:

    RevealSdkSettings.setAdditionalHeadersProvider(function (url) {
      var headers = {};
      headers["x-header-one"] = "single_value";
      headers["x-header-two"] = ["value_1", "value_2"];
      return headers;
    });
    

    TypeScript:

     RevealSdkSettings.setAdditionalHeadersProvider((url: string) => {
     var headers: Record<string, any> = {};
     headers["x-header-one"] = "single_value";
     headers["x-header-two"] = ["value_1", "value_2"];
     return headers;
    });
    

    Parameters

    • provider: function
        • (url: string): null | Record<string, any>
        • Parameters

          • url: string

          Returns null | Record<string, any>

    Returns void

Static setBaseUrl

  • setBaseUrl(base: string): void
  • Set the base url where Reveal SDK Server component is running. You'll need to use this in cases where the backend and the front-end are served from different urls.

    Parameters

    • base: string

      address of the reveal server component.

    Returns void

Static setOAuthAuthenticatedBaseUrl

  • setOAuthAuthenticatedBaseUrl(base: string): void
  • Set the base url that will be used to redirect the final OAuth authentication step, /oauth/authenticated will be added to the provided URL. This is usually just a fake URL that is used only to detect the authentication completed and to get the token ID to be used in the next step of the authentication flow. By default this URL is set to the same value specified with setBaseUrl, you might need to change it if your backend and frontend are running on separate base URLs, as this URL needs to match the frontend URL so some JS scripts can run properly. You might need to put a valid web page under {base}/oauth/authenticated/* so the browser doesn't display an error when redirected to this URL.

    Parameters

    • base: string

      The URL to use as the base URL for OAuth authentication complete.

    Returns void