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

gadget.common.error.404

clintming August 3, 2015

Hi,

I tried to add a gadget according to sample:https://developer.atlassian.com/jiradev/jira-platform/dashboards/tutorial-writing-gadgets-for-jira.  But I got the error "gadget.common.error.404" on the dashboard after add the new gadget. Please see the attached picture.  

Here I attached the code in atlassian-plugin.xml and code in gadget.xm. file.  Could you help me to analyze the reason?

 

The code in atlassian-plugin.xml:

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>

<gadget key="tutorial-gadget" name="JIRA Tutorial Gadget" location="gadget.xml"/>
<resource type="download" name="i18n/ALL_ALL.xml" location="i18n/ALL_ALL.xml">
<param name="content-type" value="text/xml; charset=UTF-8"/>
</resource>

<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="jira-gadget-tutorial-plugin"/>

<!-- add our web resources -->
<web-resource key="jira-gadget-tutorial-plugin-resources" name="jira-gadget-tutorial-plugin Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>

<resource type="download" name="jira-gadget-tutorial-plugin.css" location="/css/jira-gadget-tutorial-plugin.css"/>
<resource type="download" name="jira-gadget-tutorial-plugin.js" location="/js/jira-gadget-tutorial-plugin.js"/>
<resource type="download" name="images/" location="/images"/>

<context>jira-gadget-tutorial-plugin</context>
</web-resource>

<!-- publish our component -->
<component key="myPluginComponent" class="com.atlassian.plugins.tutorial.MyPluginComponentImpl" public="true">
<interface>com.atlassian.plugins.tutorial.MyPluginComponent</interface>
</component>

<!-- import from the product container -->
<component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" />

</atlassian-plugin>

 

The code in gadget.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="__MSG_gadget.title__" directory_title="__MSG_gadget.title__"
description="__MSG_gadget.description__">
<Optional feature="gadget-directory">
<Param name="categories">
JIRA
</Param>
</Optional>
<Optional feature="atlassian.util" />
<Optional feature="auth-refresh" />
<Require feature="views" />
<Require feature="settitle"/>
<Require feature="oauthpopup" />
#oauth
<Locale messages="__ATLASSIAN_BASE_URL__/download/resources/jira-gadget-tutorial-plugin/i18n/ALL_ALL.xml"/>
</ModulePrefs>
<Content type="html" view="profile">
<![CDATA[
#requireResource("com.atlassian.jira.gadgets:common")
#includeResources()

<h1>Hello from the Atlassian Gadget Tutorial!</h1>

<script type="text/javascript">
(function () {
var gadget = AJS.Gadget({
baseUrl: "__ATLASSIAN_BASE_URL__",
useOauth: "/rest/gadget/1.0/currentUser",
view: {
template: function(args) {
var gadget = this;

var projectList = AJS.$("<ul/>");

AJS.$(args.projectData.projects).each(function() {
projectList.append(
AJS.$("<li/>").append(
AJS.$("<a/>").attr({
target: "_parent",
title: gadgets.util.escapeString(this.key),
href: "__ATLASSIAN_BASE_URL__" + "/browse/" + this.key
}).text(this.name)
)
);
});

gadget.getView().html(projectList);
},
args: [{
key: "projectData",
ajaxOptions: function() {
return {
url: "/rest/tutorial-gadget/1.0/projects.json"
};
}
}]
}
});
})();
</script>
]]>
</Content>
</Module>

 

 

gadgetError.jpg

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
clintming August 4, 2015

Hi Volodymyr Krupach,

I compiled and added this gadget in the dashboard.  I meet two problem:

  1. One is like on the Text box of JavaScript URLs, what kind of url can be filled out? I read the guide document, but it's not clear for me. After write the JavaScript file, Do I need to put the JavaScript on the server first, then fill the JavaScrip file URL of server on this text box?   
  2. The second problem is for Predefined scripts. It occured "Failed to retrieve predefined scripts data" after I installed it first. What should I do?

 

 

 

Universal JIRA Gadget.jpg

Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2015

Hi clint, Fixed the problem with "Failed to retrieve predefined scripts data". Thank you for the notice! If you want do develop your own gadget: ignore 1 & 2 and start modifying the sources as I suggested in the previous comment. If "Universal gadget for JIRA" covers you need (i.e. you can program what you need solely with JavaScript) then take one of the predefined scripts as sample and code only your JavaScript.

0 votes
clintming August 3, 2015

Thanks Volodymyr Krupach

I just read the link you wrote. It's also difficult for me.  For my error, could you help me analyze what's the reason caused this problem?

Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2015

No need to read, just take the sources and use them as a start point for your addon. In ujg-gadget.js throw away initGadget function and all related functions, but do it graduall - first take sources, run the plugin and then start removing pieces that you do need adding your code.

0 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2015

Hi clint,

Gadgets are tough smile.

First time I had to study some Altassian gadget and copy paste pieces to make mine. I suggest you to do the same - take sources of working gadget and built upon it. Here are sources of mine: https://bitbucket.org/vkrupach/universal-jira-gadget/

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events