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
Community moderators have prevented the ability to post new answers.
Hi Volodymyr Krupach,
I compiled and added this gadget in the dashboard. I meet two problem:
Universal JIRA Gadget.jpg
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi clint,
Gadgets are tough .
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/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.