HowTo: Reusing JIRA gadgets on the issue operations
10 Jan 2011
Recently I had to implement the following use case:
- Customer has very strict defined issue creation policy and wants to control the every bit of issue creation (things like enhanced priority etc support).
- The main focus is on usability and rich user interface support.
- Basically it's multi-step procedure.
So the initial solution mockup looked like that:
The wizard-gadget itself was tricky to implement as well, but's an another story.
For the sake of this article let's consider that we already have out plugin implemented with the REST services to create / update, read issue data.
Transforming gadget to it an Issue operation
At some complicated updates are required from the user interface.We want to reuse the wizard created previously. The way I decided to proceed is to implement issue operation. So, that does it mean for end user? See the mockup below:
But! Jira does not provide this kind of functionality. So, we need to implement this on out own.
1. See the atlassian-plugin.xml snippet for that
So, we have implemented new Issue Operation which will open web-work action page we have not defined yet so far. Let's do so.
2. See action code.
3. As you may see, MyWebAction depends on GadgetRequestContextFactory and GadgetViewFactory which are OSGi components, so you should import them as component dependencies.
4. Let's add add web-action definition to attlasian-plugin.xml
5. Lets specify /templates/mywebaction/render.vm template.
6. The following code could be used to get the overall idea:
Implementing issue operations the Jira way - using AJS popup dialogs
At this stage you have working and complete issue-gadget-operation. Cool? Yeah!
anyway, purists would argue that it's not inline with Jira Look&Feel. At the moment it does open as separate action, which is not inline with the rest of issue operation actions.
Basically we want our action too look like that (in the popup dialog as all the other actions):
Is it possible? Yes, it is.
2. See the filter definition itself
And finally, all the pieces are tight together and you have Jira-AJS-POPUP style issue operation. And the cool part is - it reuses gadget instance created previously.
Hopefully you will find this stuff useful.
If you've found typos or errors, please
suggest a correction
edit on github