PP.App.openMetabase

Syntax

openMetabase(settings: Object);

Parameters

settings. Repository connection settings. As the parameter, you can specify the JSON object returned by the PP.App.getMetabaseConfig method.

Description

The openMetabase method opens repository connection.

Example

Executing the example requires a opened login page of Foresight Analytics Platform web application. The scenario specified below must be started in the browser console.

Open repository connection using user name and password:

// Get metabase configuration
var metabaseConfig = PP.App.getMetabaseConfig(false);
// Specify username and password
metabaseConfig['UserCreds'] = {
    UserName: "user",
    Password: "password"
};
metabaseConfig['Authentication'] = PP.App.AuthenticationMode.Ignore;
// Open repository connection
PP.App.openMetabase(metabaseConfig);

After executing the example a repository connection is opened. Then determine connection identifier and open application toolbar:

// Check if the repository connection is opened
if (PP.App.isMetabaseOpened()) {
    // Determine repository connection identifier
    console.log("Connection identifier: " + PP.App.getConnectionId());
};
// Determine application settings
var settings = {
    RenderAddressBar: false
};
// Initialize application
PP.App.init(undefined, settings);

After executing this scenario the browser console displays repository connection identifier:

Connection identifier: NMIHPGEHMCBEEOAEEOEIENGPAEGFCDKEGLIGIGHBBPKFMNAE!M
 

The application toolbar also opens.

Now close the repository connection and display a notification concerning the operation execution result in the browser console:

// Determine the function executed after closing the connection 
var callback = function () {
    if (!PP.App.isMetabaseOpened()) {
        console.log("Repository connection is closed.");
    } else {
        console.log("Repository connection is not closed.");
    }
};
// Determine the function executed if closing repository error occurs 
var errorcallback = function () {
    console.log("Closing connection error");
};
// Close repository connection
PP.App.closeMetabase(callback, errorcallback);

After executing the example the repository connection is closed, and the browser console displays an appropriate notification:

The repository connection is closed.

See also:

PP.App