The package

The pentaho-dashboard project develops a "wrapper" for the embedding technology that Pentaho offers with CTools. Pentaho CTools are a set of community-driven tools, which are installed as a stack on top of the Pentaho BA server and are commonly used to easily develop and render fancy and interactive dashboards. Pentaho CTools uses RequireJS as module loader. For its nature, RequireJS can be used with Node.js and this makes it particularly suitable to be integrated with Angular framework.

The pentaho-dashboard project is composed by a collection of Angular objects, listed below.

The pentaho-dashboardcomponent

The pentaho-dashboardcomponent is used to render a Pentaho dashboard, simply using the pentaho-dashboardtag into your Angular HTML code. Below some examples with the related attributes.

<!-- Example n.1 - Simple dashboard. -->
<pentaho-dashboard
  id = "dashboard1"
  pentahoPath = "/public/sample1.wcdf">
</pentaho-dashboard>
<!-- Example n.2 - Dashboard using an external parameter. -->
<select id="externalHtmlElementId">
  <option value="value1">Value 1</option>
  ...
</select>
<pentaho-dashboard
  id = "dashboard1"
  pentahoPath = "/public/sample1.wcdf"
  [params] = "['param1']"
  masterHtmlElementId = "externalHtmlElementId">
</pentaho-dashboard>
<!-- Example n.3 - Dashboard interacting with another dashboard through parameters. -->
<pentaho-dashboard
  id = "dashboard1"
  pentahoPath = "/public/sample1.wcdf"
  [params] = "['param1']"
  masterDashboardId = "dashboard2"
  [masterDashboardParams] = "['param2']">
</pentaho-dashboard>

Below a brief description of each available attribute.

Attribute Type Description
id string Unique identifier of the dashboard. This attribute is mandatory.
pentahoPath string Path of the dashboard into the Pentaho repository. This attribute is mandatory.
params string[] Array of names of parameters used into the current dashboard. Used only if masterDashboardId or masterHtmlElementId is specified.
masterDashboardId string Identifier of the related dashboard. If specified, the masterDashboardParams should be filled.
masterDashboardParams string[] Array of names of parameters used into the master dashboard. The array is related to the params attribute.
masterHtmlElementId string Identifier of the related HTML element. This attribute is optional.

The PentahoDashboardService service

The PentahoDashboardService service implements all the interactions with the Pentaho Business Analytics platform, through the HTTP/HTTP protocol. Below a brief description (and examples) of all the available methods the service exposes.

Getters and setters

Getters and setters are standard methods used to get values and set values on the local properties. The local properties are listed below.

  • username (string). Contains the user name logged in Pentaho Business Analytics platform.
  • password (string).Contains the password of the user logged in Pentaho Business Analytics platform.

Below the full list of available getters.

  • getUsername. Gets the username value.

  • getPassword. Gets the password value.

Below the full list of available setters.

  • setUsername. Sets theusernamevalue.

  • setPassword. Sets thepasswordvalue.

isLoggedIn and isNotLoggedIn

The isLoggedIn and isNotLoggedIn methods check the availability of a valid session on Pentaho Business Analytics platform. In both cases, a boolean value is returned as a result.

Below an example of usage.

if (this.pentahoDashboardService.isLoggedIn()) {
  this.router.navigate(['/']);
}
else {
  ...
}

logIn

The logIn method requests for a valid session into the Pentaho Business Analytics platform. The method is provided with a string as parameter, corresponding to the target URL if the login succeeds. If the null value is passed as parameter, no redirection is executed if the login succeeds.

Below an example of usage.

this.pentahoDashboardService.setUsername('admin');
this.pentahoDashboardService.setPassword('password');
this.pentahoDashboardService.logIn('/');

logOut

The logOut method deletes a valid session into Pentaho Business Analytics platform. The method is provided with a string as parameter, corresponding to the target URL if the logout succeeds. If the null value is passed as parameter, no redirection is executed if the logout succeeds.

Below an example of usage.

if (this.pentahoDashboardService.isLoggedIn()) {
  this.pentahoDashboardService.logOut(null);
}

The addHeaderLinks method adds the inclusion of some links in the HTML head tag of the page. No parameters are provided with this method. This method is automatically used and no need to call it in your source code.

renderDashboard

The renderDashboard method renders a simple dashboard. Below the parameters used by the method.

  • path (string). Contains the path of the dashboard in the Pentaho repository.
  • htmlId (string). Contains the unique identifier of the dashboard in the local HTML page.

Below an example of usage.

this.pentahoDashboardService.renderDashboard('/public/sample1.wcdf', 'dashboard1');

renderDashboardDependingOnDashboard

The renderDashboardDependingOnDashboard method renders a dashboard dependant to another. Below the parameters used by the method.

  • path (string). Contains the path of the dashboard in the Pentaho repository.
  • htmlId (string). Contains the unique identifier of the dashboard in the local HTML page.
  • params (string[]). Contains the array of parameters used by the local dashboard to interact with the other one.
  • masterDashboardHtmlId (string). Contains the unique identifier of the master dashboard in the local HTML page.
  • masterParams (string[]). Contains the corresponding array of parameters in the master dashboard.

Below an example of usage.

this.pentahoDashboardService.renderDashboardDependingOnDashboard(
  '/public/sample2.wcdf', 
  'dashboard2', 
  ['param2'], 
  'dashboard1', 
  ['param1']);

renderDashboardDependingOnHtmlElement

The renderDashboardDependingOnHtmlElement method renders a dashboard dependant to an HTML element in the page (usually an input tag or a select, etc.). Below the parameters used by the method.

  • path (string). Contains the path of the dashboard in the Pentaho repository.
  • htmlId (string). Contains the unique identifier of the dashboard in the local HTML page.
  • params (string[]). Contains the array of parameters used by the local dashboard to interact with the HTML element.
  • masterHtmlElementId (string). Contains the unique identifier of the HTML element in the page.

Below an example of usage.

this.pentahoDashboardService.renderDashboardDependingOnHtmlElement(
  '/public/sample1.wcdf', 
  'dashboard1', 
  ['param1'], 
  'inputElementId');

results matching ""

    No results matching ""