It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can not import amd Module: No test/jira

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;
});

2 answers

2 accepted

0 votes
Answer accepted
Nir Haimov Community Leader Nov 14, 2019

Hi @Paweł “mrpajax” Jamroziak 

Have you find any solution for this?
I just got into the same problem, actually i created 3 gadgets already and they work fine, but now the forth giving the exact same error as you had.

Hi @Nir Haimov

In my case, answer was really simple:

Jira is dump.

JavaScript files are store in browser cache, so if I don't change plugin version in pom file (this force browser to recreate JavaScript file), dashboard item will use cached version. Another solution is use incognito mode in browser (in my case, it was best solution). 

0 votes
Answer accepted
Nir Haimov Community Leader Nov 14, 2019

@Paweł “mrpajax” Jamroziak 

Found out that for me it was just that I missed to add my JS module to the download resources.

I am familiar with the version in pom.xml and caching thing :)

Good to know you figured that out and solved your issue too.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you