How to Connect Plugin to Dashboard?

Working with the Dashboards tool enables the user to extend its functionality by connecting external modules (plugins).

Plugins are connected in the desktop application of Foresight. Analytics Platform.

To connect a plugin to the desktop and web application:

  1. Create a visualizer form. This form contains components that form plugin appearance, and a code that describes logic of component work in the plugin. The visualizer form must be inherited from the AdhocUserViewForm class. Features of visualizer form code:

  2. Create a master form. This form contains components that form side panel tabs that are used to set up the plugin, and a code that describes logic of applying settings to the plugin. The master form must be inherited from the AdhocUserMasterForm class.

  1. Create a plugin js-script that will be used in the web application. The script must be described according to the JavaScript development specification. Features of plugin js-script are given in the JS Script Structure of Plugin section.

Place the created script to the directory with the installed web application.

Form the URL of the plugin js-script used in the web application.
Example of URL:

http://test/fp_App_v9.2/app/plugin.js

Where:

  1. Run the mule that contains the following procedure:

Sub AddPlugin;
Var
    mb: IMetabase;
    plugins: ISharedPlugins;
    cont: ISharedPluginsContainer;
    adhoc_plugs: ISharedAdhocPlugins;
    plugin: ISharedAdhocPlugin;
Begin
    // Get an object to work with the current repository
    mb := MetabaseClass.Active;
    // Get an object to work with plugin container
    cont := mb.SpecialObject(MetabaseSpecialObject.SharedParams).Edit As ISharedPluginsContainer;
    // Get an object to work with plugins
    plugins := cont.Plugins;
    // Get collection of plugins of the Dashboards tool
    adhoc_plugs := plugins.AdhocPlugins;
    // Create a new plugin
    plugin := plugins.AdhocPlugins.Add;
    // Set plugin name and identifier  
    plugin.Id := "ID"// Instead of ID, determine a unique identifier of plugin in uppercase mathicng the identifier in the js script structure of plugin
    plugin.Name := "name"// Specify the plugin name that will be displayed in the dashboard instead of "name"
    // Set visualizer form and master form
    plugin.ViewForm := mb.ItemById("ViewForm_Id"); // Specify visualizer form identifier instead of "ViewForm_Id"
    plugin.MasterForm := mb.ItemById("MasterForm_Id"); // Specify master form identifier instead of "MasterForm_Id"
    // Set URL with js-script to be used in the web application
    plugin.WebUrl := "url"// Instead of url determine a relative path of plugin from the root directory of web application
    // Save created plugin
    (cont As IMetabaseObject).Save;

End Sub AddPlugin;

  1. Activate plugin.

Connecting Plugin to the Desktop Application

To connect a plugin to the desktop application only, follow the steps:

  1. Create a visualizer form.

  2. Create a master form.

  3. Create a module that contains a procedure. Delete the string from the procedure code:

plugin.WebUrl := "url";

  1. Execute the module.

A more detailed description of the steps is given above.

Connecting Plugin to the Web Application

To connect a plugin to the web application only, follow the steps:

  1. Create a plugin js-script.

  2. Create a module that contains a procedure. Delete the strings from the procedure code:

plugin.ViewForm := mb.ItemById("ViewForm_Id");
plugin.MasterForm := mb.ItemById("MasterForm_Id");

  1. Execute the module.

  2. Activate plugin.

A more detailed description of the steps is given above.

See also:

Questions and Answers | Inserting and Setting Up Plugins