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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,138
Community Members
 
Community Events
184
Community Groups

Can not import amd Module: No test/jira

Deleted user Dec 21, 2018

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 14, 2019

@[deleted] 

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.

0 votes
Answer accepted
Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 14, 2019

Hi @[deleted] 

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.

Deleted user Nov 14, 2019

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). 

Hi @Nir Haimov 

Have you found the solution for the gadgets not loading?

Getting the same error intermittently

Can not import amd Module dashboard-items/scenario-count-dashboard-item gadget with id '10314': No dashboard-items/scenario-count-dashboard-item Error: No dashboard-items/scenario-count-dashboard-item

 The issue seems to be related to Chrome only as I cannot reproduce it other browsers.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events