Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Problem adding Atlassian Javascript Framework to a gadget

kevin anderson September 12, 2013

I am building an externally hosted gadget for our local jira instance that will graph some of our issues. I am having a problem with the tutorials that utilize the Atlassian Gadgets Javscript Framework.

Using the script example on this page:

https://developer.atlassian.com/display/GADGETS/Using+the+Atlassian+Gadgets+JavaScript+Framework

I am unable to instanciate the gadget object, and I get the message :

Uncaught ReferenceError: AJS is not defined

It seems the require statement : #requireResource("com.atlassian.gadgets.publisher:ajs-gadgets") is not loading the components. I am using the follwing script which is based on the tutorial:

<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="__MSG_gadget.title__" directory_title="__MSG_gadget.title__" description="__MSG_gadget.description__">
<Require feature="dynamic-height" />
<Optional feature="auth-refresh"/>
<Require feature="oauthpopup" />
<Require feature="setprefs" />
<Require feature="settitle" />
<Require feature="views" />
<Optional feature="atlassian.util" />
<Optional feature="gadget-directory">
<Param name="categories">Other</Param>
</Optional>
#oauth
#supportedLocales("gadget.common,your.gadget.resource.prefix")
</ModulePrefs>
<Content type="html">
<![CDATA[
/* (1) This resource is required for using the gadget framework */
#requireResource("com.atlassian.gadgets.publisher:ajs-gadgets")
#includeResources()

<script type="text/javascript">
(function () {
/* (2) Construct and initialise the gadget */
var gadget = AJS.Gadget({
baseUrl: "//someurl.com/Dashboard.jspa"

});
})();
</script>
]]>
</Content>
</Module>

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
kevin anderson October 27, 2013

I am still unable to load Atalssian Gadget framework via the require statements in the gadget xml file. My only option has been to crawl up the DOM, and access AJS from the gadget host browser window after the gadget fully loads.

0 votes
Kannan S November 27, 2013

i think u missed

#requireResource("com.atlassian.jira.gadgets:common")

Tukaram Bhukya December 9, 2016

#supportedLocales("gadget.common,your.gadget.resource.prefix")

could some one give example to "your.gadget.resource.prefix"

I mean how to give path to resource here for my below example 

my group id is => com.jira.test

artifact id is => rgadget

package =>com.jira.test

my gadget module name is => mgadget

 

 

 

 

TAGS
AUG Leaders

Atlassian Community Events