In order to get our app working in Jira 9, I have marked the javascript in my velocity file with type=“module” attribute that the Preparing for Jira 9.0 article suggested. This has allowed for the javascript to function properly on the main issue view. The problem is that the javascript does not function at all on other views, like the Open Issues view when a record is displayed in the right panel. Even worse, when you click the link to expand the record, it doesn’t seem to trigger any jira events, so it still won’t load the javascript.
Here is a paired down version of what we are doing:
panel.vm
$webResourceManager.requireResource("com.atlassian.auiplugin:ajs")
$webResourceManager.requireResource("com.atlassian.auiplugin:aui-experimental-table-sortable")
$webResourceManager.requireResource("com.atlassian.auiplugin:aui-spinner")
$webResourceManager.requireResource("com.custom:resources")
<script type="module">
function loadWebPanel() {
//process data from the context and update the various divs below
}
//Tried to bind to various jira events
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context, reason) {
if (reason=="pageload" || reason=="panelRefreshed"){
loadWebPanel();
}
});
JIRA.bind(JIRA.Events.ISSUE_REFRESHED, function (e, context) {
loadWebPanel();
});
JIRA.bind(JIRA.Events.PANEL_REFRESHED, function (e, context) {
loadWebPanel();
});
//Tried using the DOMContentLoaded
document.addEventListener("DOMContentLoaded", loadWebPanel);
</script>
<!--context for displaying error messages-->
<div id="messageInformation"></div>
<div id="loadingInformation"><aui-spinner size="small"></aui-spinner>Please wait.</div>
None of these worked of course. Any ideas?