This page tells you how to add your gadget to an Atlassian application (JIRA, Confluence, etc) as a plugin.
In short: Add a <gadget>
module type to your atlassian-plugin.xml
file.
How feasible is it to create an Atlassian gadget that consists purely of HTML, CSS and Javascript? Assuming that the Confluence or JIRA (or whatever) REST API could do everything that the gadget needs, can you bypass the plugin side of things altogether?
You can choose to write a standalone gadget or a gadget embedded in a plugin.
Limitations if you do not embed your gadget in a plugin:
#supportedLocales
and #includeResources
directives.That said, there are two main reasons why you may be interested in writing standalone gadgets:
The rest of this page describes the gadget module type that you will use to embed your gadget within an Atlassian plugin.
Gadget plugin modules enable you to add your gadget to an Atlassian application (JIRA, Confluence, etc) as a plugin. Your gadget can then make use of the application's remote API to fetch data and interact with the application.
The element for the Gadget plugin module is gadget
. It allows the following attributes for configuration:
key
attribute is a standard module key, so it is required and must be unique within the plugin across all module types. Required.location
attribute can be either the relative path to a resource within the plugin, or the absolute URL of an externally-hosted gadget. Required.publish-location
attribute is used to replace the default URL of published gadgets. See URL for Published Gadgets below.enabled-conditions - As of 3.5: Contains a list of condition or conditions that must be satisfied to make the gadget available for use within the system. Conditions defined under enabled-conditions
are always evaluated by the gadget system without any context.
**local-conditions ** - As of 3.5: Contains a list of condition or conditions that must be satisfied for the gadget to be displayed in various pages within products. For example, dashboard in JIRA. Conditions defined under local-conditions
are evaluated by the individual products with product specific context. If a product does not evaluate these conditions, then these conditions will not have any effect in the system.
The syntax of the module type is:
1 2<atlassian-plugin name="Hello World" key="example.plugin.helloworld" plugins-version="2"> <plugin-info> <description>A basic gadget module</description> <vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/> <version>1.0</version> </plugin-info> <gadget key="unique-gadget-key" location="path/to/gadget.xml" publish-location="my-custom-context/custom/location/gadget.xml"> <enabled-conditions> <condition class="com.atlassian.plugin.awesome.MyEnabledCondition"/> </enabled-conditions> <local-conditions> <conditions type="OR"> <condition class="com.atlassian.plugin.awesome.MyLocalCondition" /> <condition class="com.atlassian.plugin.awesome.MyInvertedLocalCondition" inverted="true" /> </conditions> </local-conditions> </gadget> </atlassian-plugin>
Gadgets published by an Atlassian container (such as JIRA or Confluence) are provided by the REST plugin module built into the Atlassian Gadgets framework. The URL of published gadgets has the following format:
1 2http://my-server.com:port/my-context/rest/gadgets/1.0/g/my-plugin.key:my-gadget/my-path/my-gadget.xml
As of 3.4, gadgets may be published under a customised path if the default path is undesirable using the publish-location attribute.
Example:
Using the default path:
1 2http://mycompany.com/jira/rest/gadgets/1.0/g/com.atlassian.streams.streams-jira-plugin:activitystream-gadget/gadgets/activitystream-gadget.xml
Using the customised path. A gadget module such as the following:
1 2<gadget key="activitystream-gadget" location="gadgets/activitystream-gadget.xml" publish-location="activitystream/gadgets/gadget.xml" />
Will be published under the URL below:
1 2http://mycompany.com/jira/rest/gadgets/1.0/g/activitystream/gadgets/gadget.xml
Creating your Gadget XML Specification
Writing an Atlassian Gadget
REST Plugin Module
Rate this page: