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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

744 views 1 18
Join discussion

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