Hi!
I tried edit tutorial code from Atlassian (DASHBOARD-TUTORIAL), but when I change "amd module" in atlassian-plugin.xml and javascript file on my namespace, I get only error
"Unknown error occurred initializing this gadget."
console say:
"Can not import amd Module test/jira gadget with id '10102': No test/jira Error: No test/jira"
My atlassian-plugin.xml:
<atlassian-plugin key="${atlassian.plugin.key}" 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>
<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="dashboard-item-tutorial"/>
<!-- add our web resources -->
<web-resource key="dashboard-item-tutorial-resources" name="dashboard-item-tutorial Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<transformation extension="soy">
<transformer key="soyTransformer"/>
</transformation>
<resource type="download" name="dashboard-item-tutorial.css" location="/css/dashboard-item-tutorial.css"/>
<resource type="download" name="dashboard-item-tutorial.js" location="/js/dashboard-item-tutorial.js"/>
<resource type="download" name="images/" location="/images"/>
<resource type="download" location="soy/dashboard-item.soy" name="soy/dashboard-item.soy.js"/>
<resource type="soy" location="/soy/dashboard-item.soy" name="Dashboard.Item.Tutorial.Templates.Static"/>
<context>atl.dashboard</context>
<context>dashboard-item-tutorial</context>
</web-resource>
<dashboard-item key="new-dashboard-item"
i18n-name-key="com.example.plugins.tutorial.dashboard.item.title"
configurable="true">
<definition>
<title key="com.example.plugins.tutorial.dashboard.item.title"/>
<categories>
<category>Jira</category>
</categories>
<author>
<name>Author's name</name>
</author>
<thumbnail location="/download/resources/${atlassian.plugin.key}:dashboard-item-tutorial-resources/images/pluginLogo.png"/>
</definition>
<description key="com.example.plugins.tutorial.dashboard.item.description"/>
<resource name="view" type="soy" location=":dashboard-item-tutorial-resources/Dashboard.Item.Tutorial.Templates.Static"/>
<amd-module>test/jira</amd-module>
</dashboard-item>
</atlassian-plugin>
My JS script:
define('test/jira', ['underscore', 'jquery', 'wrm/context-path'], function (_, $, contextPath) {
var DashboardItem = function (API) {
this.API = API;
this.issues = [];
};
/**
* Called to render the view for a fully configured dashboard item.
*
* @param context The surrounding <div/> context that this items should render into.
* @param preferences The user preferences saved for this dashboard item (e.g. filter id, number of results...)
*/
DashboardItem.prototype.render = function (context, preferences) {
this.API.showLoadingBar();
var $element = this.$element = $(context).find("#dynamic-content");
var self = this;
this.requestData().done(function (data) {
self.API.hideLoadingBar();
self.issues = data.issues;
if (self.issues === undefined || self.issues.length === 0) {
$element.empty().html(Dashboard.Item.Tutorial.Templates.Empty());
}
else {
$element.empty().html(Dashboard.Item.Tutorial.Templates.IssueList({issues: self.issues}));
}
self.API.resize();
$element.find(".submit").click(function (event) {
event.preventDefault();
self.render(element, preferences);
});
});
this.API.once("afterRender", this.API.resize);
};
DashboardItem.prototype.requestData = function () {
return $.ajax({
method: "GET",
url: contextPath() + "/rest/api/2/search?jql=due<=3d"
});
};
return DashboardItem;
});