I defined the “issue-contact-panel”-context and try to load it in my ContextProvider. When I navigate to the Issue-View it works just fine (URL is /browse/ISSUE-KEY), but when Im browsing through the projects issues (URL is projects/PROJECT-KEY/issues/ISSUE-KEY) the Resources are not loaded.
It seems the resource is not loaded in every case and I just wonder why? There is no error when the PageBuilderService require the context, so what did I missed?
Could you provide mode context?
How is your plugin loaded? Via webwork action? Web section?
How is IssueContactPanelContextProvider being invoked?
Loading web resources in getContextMap seems like a hack…
Chances are it is only configured to show up in issue view…
<web-panel> can only have one resource so looks like your options are to do $webResourceManager.requireResource() inside the velocity template or what you’re doing now.
Why does it only show up in issue view?
Because you configured it with location="atl.jira.view.issue.right.context".
So it’ll only be loaded in jira pages that has this plugin point, which is probably only the main view issue page.
<web-panel> can only have one resource so looks like your options are to do $webResourceManager.requireResource() inside the velocity template or what you’re doing now.
ok, but Im developing for Jira 7.13.X and the WebResourceManager is deprecated since at least 4 years, so why should I use it?
Why does it only show up in issue view?
Because you configured it with location="atl.jira.view.issue.right.context" .
So it’ll only be loaded in jira pages that has this plugin point, which is probably only the main view issue page.
Okay sorry that doesnt make sense to me. The Panel will be rendered, no matter if its the “main” view issue page, or the view issue page with the issue-list on the left side. The panel is rendered and the ContextProvider got invoked. The PageBuilderService calls the function to require my resource, there is no error or warning in the logs, so it should load my resources.
In the first screen you can see the “main” view issue page. You can see the “Kontakt”-Panel on the right side, its rendered and the JS-resources are provided (I can see the log entrys in the console).
Now, on the next screen you can see that I’m still in the view issue page, the only difference is the list view of the other issues in the current project. You can also see the panel on the right side again, and when I debug it, I can ensure the ContextProvider is invoked and the PageBuilderService requires the resources. But the JS-File is NOT loaded, there is no console log, no error nor a warning about anything.
If I understood this issue correctly, this is a limitation of WRM - it doesn’t append scripts to an already loaded page, unless the request for resources is made via WRM’s client side API.
When you switch between issue navigation “details” view via issues on the left sidebar, page is not re-rendered.
Another example would be trying to load resources in a “dialog”, which doesn’t refresh the page.
In such cases you should load an “initializer” (my-plugin-init.js) JavaScript file using pageBuilderService when page the parent page loads, with content similar to this:
/**
* IssueNav plugin (issueviewer/js/IssueViewer.js ) triggers following event when issue panels are rendered
* Events.trigger(Types.NEW_CONTENT_ADDED, [renderedPanel, Reasons.panelRefreshed]);
*/
Events.bind(Types.NEW_CONTENT_ADDED, function (e, $renderedPanel) {
// Or dialog init in the case of a dialog
wrmRequire(['wr!my-plugin-web-resource'], function () {
// resources loaded
});
}
This will then request and download the resources when user interactions happen on the page after initial load.