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:
In Windows OS: C:\Program Files (x86)\Foresight\Analytics Platform 10.x Web Application.
In Linux OS: /opt/foresight/fp10.x-webserver.
The path to the folder with installed designer of business applications:
In Windows OS: C:\Program Files (x86)\Foresight\Designer of Business Application 10.x Web Server.
In Linux OS: /opt/foresight/dba/10.x.
TIP. To facilitate the use of plugins, create the plugins folder, which will store plugins.
Add plugin description in the PP.xml configuration file for the web application or DBA.config.json for the designer of business applications.
<plugins>
<plugin type="PP.Ui.Dashboard.MyLabel" path="../plugins/MyLabel.js" css="../plugins/MyLabel.css" loaded="false" name="MyLabel"/>
<plugin ... />
</plugins>
"plugins": [
{
"Type": "PP.Ui.Dashboard.MyLabel", //plugin identifier corresponding to object instance type
"Path": "../plugins/MyLabel.js", //relative path to plugin JS file
"Css": "../plugins/MyLabel.css", //relative path to CSS file with plugin styles
"Name": "MyLabel", //plugin name
"Loaded": false //plugin loading method
},
{
...
}
]
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 "type" attribute has the identifier that is different from the reserved ones.
Restart the web server.
Along with the specified method, the web application allows for connecting a plugin in the repository.
Connect a plugin in the repository
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 to work with the current repository
mb := MetabaseClass.Active;
// Get object to work with plugin container
cont := mb.SpecialObject(MetabaseSpecialObject.SharedParams).Edit As ISharedPluginsContainer;
// Get 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 identifier and name
plugin.Id := "ID"; // Specify unique plugin identifier in upper case instead of "ID", identifier should match with identifier in plugin JS script structure
plugin.Name := "name"; // Specify plugin name that be displayed in 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"
// Save 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 plugin 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 plugin name and identifier
plugin.Id := "ID"; // Instead of "ID" specify unique plugin identifier in the upper case that matches with the identifier in plugin JS script structure
plugin.Name := "name"; // Instead of "name" specify plugin name that will be displayed in dashboard
// Set relative path of JS script
plugin.WebUrl := "url"; // Instead of "url" specify relative path of JS script from web application root folder
// Save 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: