Hello,
I'm developing a JIRA plugin which consists of a java script.
The script shows up in issue view screen and changes the look and feel of issue view screen.
It works fine when I open a single issue (such as /browse/ISSUE-1).
However, it doesn't work in issue navigator with "Detail view".
I want this script to work for an issue displayed in the right pane of the issue navigator.
How can I achieve this?
I'm using JIRA version 6.4.2 and here are my code snippets.
<web-resource key="my-plugin-resources" name="my-plugin Web Resources"> <dependency>com.atlassian.auiplugin:ajs</dependency> <resource type="download" name="my-plugin.js" location="/js/my-plugin.js"/> <context>jira.view.issue</context> </web-resource>
AJS.$(document).ready(function () { // my code here console.log("my-plugin.js") // This code is called when issue navigator is opened. // However, it is not called again even if I chose another issue in the issue navigator. });
Community moderators have prevented the ability to post new answers.
Hi Shun!
In your <
web-resource> tag y
ou need to add navigator contexts to load your script on the issue navigator page:
<context>jira.navigator.advanced</context> <context>jira.navigator.simple</context>
==== update:
You need to put your code inside of the JIRA event listener:
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context, reason) { if (reason !== JIRA.CONTENT_ADDED_REASON.panelRefreshed) { // You code here } });
You can search for "NEW_CONTENT_ADDED" in chrome dev tools while you are on the navigator page and will find that JIRA uses this event for invoking scripts after the new issue is loaded. Just debugged this and strange thing is that it's invoked 2 times, but anyway this is how it's done in JIRA.
Hi Volodymyr, Thank you for your comment! <context>jira.view.issue</context> seems to work in the issue navigator page as well. My code is called when the issue navigator is opened without jira.navigator context. The problem is that my code is not called again when I chose another issue in the issue navigator.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Shun, please see edited initial response.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Volodymyr, You code worked! I really appreciate your kind support.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.