You can create any type of gadgets and add it to WSO2 DS, so that you can make use of them when creating a dashboard. The following instructions explain how you can create a gadget at a high level:
Step 1 - Create a folder structure for the new gadget
You need to create the gadget related configurations within a tenant folder as follows:
- Navigate to the
<DS_HOME>/repository/deployment/server/jaggeryapps/portal/store
directory. - Create a folder by the name of the tenant.
<DS_HOME>/repository/deployment/server/jaggeryapps/portal/store/<TENANT_NAME>
Example:<DS_HOME>/repository/deployment/server/jaggeryapps/portal/store/kim
- Create a folder based on the name of the gadget in the newly created tenant directory.
<DS_HOME>/repository/deployment/server/jaggeryapps/portal/store/<TENANT_NAME>/<GADGET_NAME>
Example:<DS_HOME>/repository/deployment/server/jaggeryapps/portal/store/kim/age_group
Step 2 - Define the Gadget XML
Gadgets are defined using an XML file, which can be later rendered using Shindig to HTML document. Create this XML file within the <DS_HOME>/repository/deployment/server/jaggeryapps/portal/store/<TENANT_NAME>/<GADGET_NAME>
directory, and use any name to name the gadget XML file.
...
Tip |
---|
If you wish to learn more on creating gadget XMLs, go to https://developers.google.com/gadgets/docs/gs |
Step 3 - Define the gadget.json
file
The gadget.json
file is a configuration file that is specifically used by the WSO2 Dashboard Server (DS) for a gadget. Create the gadget.json
file in the the <DS_HOME>/repository/deployment/server/jaggeryapps/portal/store/<TENANT_NAME>/<GADGET_NAME>
directory.
...
- type - This defines the type of this document to be rendered by the Shindig.
- data - This contains the URL of the location of the
index.xml
that corresponds to the gadget. - notify - This is the most important. This is the property that defines whether this gadget is a publisher or not. By adding this property we can define a channel to publish messages. In this sample, a channel named history is being created. The notify property has two sub properties which are as follows: type and description. The property named type is used to define the type of the publisher.
- listen - This property defines whether this specific gadget can subscribe to a channel or not. A listener named state has been created for this sample, which has the same properties that a publisher channel has. Type will filter the publisher channels that the gadget can listen to.
Step 4 - Add any other required folders
The gadget that is being created may need supporting files such as images etc. These files too need to be added in the <DS_HOME>/repository/deployment/server/jaggeryapps/portal/store/<TENANT_NAME>/<GADGET_NAME>
directory.