How to render html content in postfuntion name of jira workflow add-on?

I'm building a JIRA add on that contains some workflow post-functions. I want to customize the description UI when attempting to select a post function for a transition from the available choices. I know this can be done, because the Jira Workflow Toolkit plugin does just this by placing some HTML content after the description.

https://i.stack.imgur.com/mt8eJ.jpg

In the atlassian-plugin.xml, the workflow function is listed with a name key and a description key, like so:

<workflow-function key="abcdefg" name="Abcdef G" i18n-name-key="abcdefg.name" class="jira.plugins.postFunctions.workflow.AbcdefGFactory">
  <description key="abcdefg.description">This is what Abcdef G does...</description>
  ...
</workflow>

There is a resource file also listed in the plugin xml that contains the previously mentioned keys,

abcdefg.name = Abcdef G
abcdefg.description = This is what Abcdef G does...

I have velocity templates for view and input, but those don't correspond to the view of selecting a post function for a transition. I can't seem to find a factory method that would over-ride that display either.

How can I tap into the rendering of that Name or Description field in the Add Post Function To Transition view?

1 answer

1 accepted

I found out that all I had to do was add a WebResource consisting of a javascript file with the right contexts. The javascript looks for my postfunction labels and adds the little bit.

In the atlassian-plugin.xml:

<webresource ...>
<description>...</description>
<resource name="..." type="download" location="js/doit.js"/>
<context>atl.admin</context>
</webresource>

Then the javascript file looks something like this:

AJS.$( document ).ready(function() {
annotateWorkflowPostFunctions();
});

function annotateWorkflowPostFunctions() {
var labels = AJS.$("label[for*='mykey']");
labels.each(function() {
$( this ).append(
'<span class="aui-lozenge aui-lozenge-error">By Mike</span>'
);
});
}

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

64 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you