To enhance capabilities of building a dashboard one can connect a plugin.
To connect a plugin to a dashboard:
In the web application and in the designer of business applications:
Add the plugin files <plugin name>.js and <plugin name>.css to the folder with installed web application or designer of business applications.
The path to the folder with installed web application:
If plugin description is added in the config.json configuration file:
In Linux OS: /opt/foresight/fp10.x-webserver/r.
In Windows OS: C:\Program Files (x86)\Foresight\Analytics Platform 10.x Web Application\r.
If plugin description is added in the PP.xml configuration file:
In Linux OS: /opt/foresight/fp10.x-webserver.
In Windows OS: C:\Program Files (x86)\Foresight\Analytics Platform 10.x Web Application.
The path to the folder with installed designer of business applications:
If the designer of business applications back end is installed automatically on Apache2 web server or manually on IIS:
In Linux OS: /opt/foresight/fp10.x-dba.
In Windows OS: C:\Program Files (x86)\Foresight\DBA_10.x. The DBA_10.x folder is created manually and may differ.
If the designer of business applications back end is installed manually on Apache2 web server, Java or automatically on IIS:
In Linux OS: /opt/foresight/dba/10.x.
In Windows OS: C:\Program Files (x86)\Foresight\Designer of Business Application 10.x Web Server.
TIP. To facilitate the use of plugins, create the Plugins folder, which will store plugins. In the Plugins folder create the CSS folder that will store plugin styles.
In Linux OS grant permissions for the custom folder with plugin files in Debian-based distributions for the www-data user. When working in other Linux OS distributions replace www-data with apache for RedHat-based distributions or with apache2 for ALT Linux.
Add a plugin description in the configuration file:
In the config.json file of the web application/designer of business applications use the plugins field to describe plugin:
"modules": {
"8448": {
"customization": {
"plugins": [
{
"name": "Test",
"path": "./Plugins/Test.js",
"css": "./Plugins/CSS/Test.css",
"id": "PP.Ui.Dashboard.Test",
"params": [
{
"name": "APIKey",
"value": "AIzaSyCT36DH2CuXQ8GHtNSZASvoxQtbidhuWCU"
}
]
},
{
...
}
]
}
}
}
NOTE. The 8448 value is a numeric value of the Dashboard object class. Set the 2561 class value for the Express Report object.
To describe plugin in the PP.xml web application file, use the <plugins> section:
<plugins>
<plugin type="PP.Ui.Dashboard.MyLabel" path="../Plugins/MyLabel.js" css="../Plugins/CSS/MyLabel.css" loaded="false" name="MyLabel"/>
<plugin ... />
</plugins>
To describe plugin in the DBA.config.json file of designer of business applications, use the plugins field:
"plugins": [
{
"Type": "PP.Ui.Dashboard.MyLabel",
"Path": "./Plugins/MyLabel.js",
"Css": "./Plugins/CSS/MyLabel.css",
"Name": "MyLabel",
"Loaded": false
},
{
...
}
]
IMPORTANT. The following identifiers are reserved for the preset plugins: PP.Ui.Dashboard.Sankey - Sankey Chart; PP.Ui.Dashboard.Gantt - Gantt Chart; PP.Ui.Dashboard.Indicator - Indicator. Make sure that the PP.xml and DBA.config.json configuration files contain the type attribute that has the identifier that is different from the reserved ones.
In the config.json configuration file of the web application/designer of business applications plugin settings are combined, if the id attribute of the plugin matches with identifiers of preconfigured plugins.
Restart the back end of web application/designer of business applications property.
Along with the specified method, the web application allows for connecting a plugin in the repository.
Connect plugin via repository using the PP.xml file
After executing the operations, the plugin is autonomously registered on opening a dashboard in the web application. The plugin can be inserted to a dashboard.
When developing the web application by means of DHTML components connect a plugin in the repository using the KapBox constructor or the Kap.regPluginBlock method used as an independent plugin connection method.
In the desktop application register a plugin in services. After executing the operation the plugin will be registered in common resources and can be inserted to a dashboard.
To insert the connected plugin, execute one of the operations in the dashboard:
Execute the command corresponding to plugin name in the drop-down menu of the
Plugins button on the Home or Insert ribbon tab.
Execute the command corresponding to plugin name in the drop-down menu of the New Block > Plugins item in the dashboard's context menu.
After executing the operations the plugin will be inserted to the dashboard as a single object.
A plugin can be registered in the development environment in the Fore programming language using the ISharedPluginsContainer.Plugins property.
To register a plugin in services, add links to the Metabase and Fore system assemblies and execute the unit:
For the desktop application:
Sub UserProc;
Var
mb: IMetabase;
plugins: ISharedPlugins;
cont: ISharedPluginsContainer;
adhoc_plugs: ISharedAdhocPlugins;
plugin: ISharedAdhocPlugin;
Begin
// Get object for working with the current repository
mb := MetabaseClass.Active;
// Get object for working with plugins container
cont := mb.SpecialObject(MetabaseSpecialObject.SharedParams).Edit As ISharedPluginsContainer;
// Get object for working 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 identifier and name of plugin
plugin.Id := "ID"; // Instead of "ID" specify unique identifier of plugin in upper case that matches with identifier in plugin JS script structure
plugin.Name := "name"; // Instead of "name" specify plugin name that will be displayed in dashboard
// Set visualizer form and master form
plugin.ViewForm := mb.ItemById("ViewForm_Id"); // Instead of "ViewForm_Id" specify visualizer form identifier
plugin.MasterForm := mb.ItemById("MasterForm_Id"); // Instead of "MasterForm_Id" specify master form identifier
// Save the created plugin
(cont As IMetabaseObject).Save;
End Sub UserProc;
For the web application:
Sub UserProc;
Var
mb: IMetabase;
plugins: ISharedPlugins;
cont: ISharedPluginsContainer;
adhoc_plugs: ISharedAdhocPlugins;
plugin: ISharedAdhocPlugin;
Begin
// Get object for working with the current repository
mb := MetabaseClass.Active;
// Get object for working with plugins container
cont := mb.SpecialObject(MetabaseSpecialObject.SharedParams).Edit As ISharedPluginsContainer;
// Get object for working 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 identifier and name of plugin
plugin.Id := "ID"; // Instead of "ID" specify unique identifier of plugin in upper case that matches with identifier in plugin JS script structure
plugin.Name := "name"; // Instead "name" specify plugin name that will be displayed in dashboard
// Set relative path to JS script
plugin.WebUrl := "url"; // Instead of "url" specify relative path to JS script from root folder of the web application
// Save the created plugin
(cont As IMetabaseObject).Save;
End Sub UserProc;
After executing the unit the plugin will be registered in services and can be inserted to a dashboard.
See also: