I recently explored the possibility to include web-resources automatically on certain pages using contexts:
<web-resource key="some-scripts" name="Required for some operation">
<resource type="download" name="title.js" location="path/to/file.js" />
<context>jira.view.issue</context>
<context>jira.issue.create</context>
<context>jira.navigator.advanced</context>
<context>jira.navigator.simple</context>
<context>atl.error</context>
<context>atl.dashboard</context>
</web-resource>
The first tests work fine. Available context-names are documented here: http://confluence.atlassian.com/display/JIRADEV/Web+Resource+Plugin+Module#WebResourcePluginModule-contextsforjira
My questions:
Is this the complete list of ALL available contexts?
Can I use arbitrary substrings of this contexts? (If not, what are the limitatins?)
So e.g. can I use "jira.navigator" when I want "jira.navigator.advanced" AND "jira.navigator.simple", or "jira" when I want my resources being included everywhere?
Already tried the "jira.navigator" example and it worked (scripts were included in simple and advanced view), but when I tried "jira" for global scripts it failed..
This feature is very useful and exactly what I was looking for, so clarification would be nice.
Thanks in advice. Cheers, Stefan
Community moderators have prevented the ability to post new answers.
Guys i think that it is impossible to list ALL available contexts. That would depend on:
Remember that JIRA consits of many bundled plugins (e.g. new project administration is a plugin, REST API too). In the future you can expect even more plugins constituting standard JIRA package.
Context is something which anything can request. It's just a string. It's not something pre-defined/hard-coded.
If you scan for the invocation of com.atlassian.plugin.webresource.WebResourceManager#requireResourcesForContext you will see thigs like:
Any plugin in its page (while rendering it on the server side) can call WebResourceManager.requireResourcesForContext(...) "creating" by itself another custom context this plugin (or other) would prepare.
So as always: docs are great, but... use the force, read the source. JIRA makes it possible - you have the source code with any commercial license (even Starter).
Cheers,
Wojtek
Ok, this might be a solution. And yes, obviously custom contexts cannot be documented. But I do not think that stepping through hundreds of WebResourceModuleDescriptor's looking for context strings is an appropriate development approach for all of your customers.
It would save us much time and headache if even the contexts of the plugins bundled with Jira by default were documented completely.
However, now I found the "jira.navigator" context as well as some more that could be useful - "jira.inline.dialog" for example. I will create a remark on the documentation page with a listing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sure, documentation should be up to date. Just I wanted to raise the fact that the list of available contexts is in flux.
Neverthess I hope it's visible that plugin documentation is getting better and better (e.g. visual examples of what can be hooked where and how).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Take this list with care:
<context>atl.admin</context> <context>atl.dashboard</context> <context>atl.general</context> <context>atl.global</context> <context>atl.plugins.webhooks.admin</context> <context>atl.userprofile</context> <context>browse-user</context> <context>com.atlassian.jira.board</context> <context>gh-rapid-config</context> <context>gh-rapid-exception</context> <context>gh-rapid-welcome</context> <context>gh-rapid</context> <context>global</context> <context>greenhopper-rapid-non-gadget</context> <context>greenhopper</context> <context>issue</context> <context>issueaction</context> <context>issuenavigation</context> <context>issuenavigationF</context> <context>jira-g-common-lite</context> <context>jira.edit.issue</context> <context>jira.global</context> <context>jira.navigator.advanced</context> <context>jira.navigator.simple</context> context>jira.view.issue</context> <context>jira.workflow.administration</context> <context>jira.workflow.view</context> <context>scheduler-admin</context>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for this command
I need a context for JIRA Service Desk and the documentation has nothing about this:
So i extracted all plugins and run the command.
<context>admin.mail.incoming</context> <context>customerportal</context> <context>jira.admin</context> <context>jira.general</context> <context>jira.userprofile</context> <context>jira.view.issue</context> <context>sd.agent.view</context> <context>sd.error.page</context> <context>sd.project.admin</context> <context>sd.project.reports</context> <context>sd.project.settings</context> <context>sd.project.sidebar.content</context> <context>sd.project.view</context>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"but when I tried "jira" for global scripts it failed" - it should be jira.general, there is no context called "jira".
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.
I don't think the match method has much to do with handling the contexts. There is only one implementation com.atlassian.plugin.webresource.DefaultWebResourceFilter. Setting a breakpoint shows that it receives just filenames like "jquery.js" and checks whether it is a .js or .css file.
After looking through the sources a bit deeper, I found the com.atlassian.plugin.webresource.WebResourceManagerImpl::requireResourcesForContext method, which iterates over all webResourceModuleDescriptors and checks whether the given context-name is in a java.util.Set<String> collection returned by getContexts(). The comparison is done using the contains method of the Set, which usually only fires on equality.
So my conclusion is, that there is no provision for such a generalization approach (although this would make the mechanism extremely flexible). As a result I guess in real there are more contexts than docs listing provides.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
true. com.atlassian.plugin.webresource.WebResourceFilter has one method called "match", which makes me think maybe you're right about substrings, but I can't find any source for it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok thats right. but..there is also no context called "jira.navigator" listed in the docs. may this listing be incomplete?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.