Trigger-dialog method of showing a dialog no longer works in JIRA >= 7.10.x

I have a JIRA add-on that displays a dialog using the method described on this page.

Sample atlassian-plugin.xml:

<web-item key="do-thing-menu-item" name="Do Thing Menu Item" section="operations-attachments">
  <description key="thing.description"/>
  <label key="thing.label"/>
  <link linkId="do-thing-action">/secure/DoThing!default.jspa?id=${}</link>

<webwork1 key="do-thing-action" name="Do Thing Action" class="java.lang.Object">
    <action name="com.example.DoThing" alias="DoThing">
      <view name="input">/templates/do-thing.vm</view>
      <view name="error">/templates/do-thing.vm</view>

The <web-item> module adds an entry to the “More” menu on the view issue page, with a target of /secure/DoThing!default.asp?id={issue id}.

When the link is clicked, <styleClass>trigger-dialog</styleClass> tells JIRA to show a dialog instead of navigating to the target URL.

The linkId in the web-item maps to a <webwork1> module, backed by the com.example.DoThing class (a subclass of JiraWebActionSupport).
When invoked, the class performs some server-side processing (e.g. reading an entity property stored in the database), and returns HTML content for the dialog.

In all versions of JIRA 7.x up to and including 7.9.x; this worked as described in the documentation link above.

As of JIRA 7.10.x, when the new UI design was introduced, this method of triggering a dialog no longer appears to work.

Clicking the menu item no longer opens a dialog, but instead navigates to the link URL /secure/DoThing!default.asp?id={issue id}.

This also means that the Submit button / cancel link rendered by the velocity template no longer correctly return to the view issue page. Previously, clicking Submit would submit the form in the dialog, then close the dialog and reload the view issue page; while the cancel link would just close the dialog.

I’m aware that the AUI Dialog 2 now seems to be the recommended way of showing a dialog; but it is unclear from the documentation how to use Dialog2 with a webwork item that has a server-side JiraWebActionSupport class?

In other words, what specific steps do I need to take to transition from using trigger-dialog?

1 Like

Hi @scottohara!
Thank you for your time and detailed description.

I’ve found the culprit and raised JAC ticket where you can also find other ways of achieving your goal in Workarounds section.

Best regards,
Jira Server Team

1 Like

Thank you so much, @mrzymski!

@mrzymski I tried to use a custom styleClass on my web-item and tried to override the click event via Javascript (as suggested in JRASERVER-67719). However, I really struggle to make this work consistently across different issue view pages (issue navigator, backlog view etc.) Single issue view (/browse/{issue-key}) works just fine but on other pages I believe the JS gets executed before the page is fully loaded (coz issues are loaded via Ajax).

Do pages that render lists of issues have any sort of hook/event to inform us when we can attach a custom click handler?

Ohhh, I think I just figured it out (with the help of the Jira source). Instead of trying to replace the handler on the actual element, it is easier to simply attach an event listener to the document like so:

jQuery(document).on("click", ".custom-trigger-dialog", function (e) {

I’d omit “a” element from the selector since it’s not adding much to the specificity and the code is not bound to certain HTML tag name, e.g. you can use custom element in the future with the same class name without changing your selector.

1 Like

Thanks for highlighting this @mrzymski! In fact, that’s what I did. :slight_smile: just forgot to remove the afrom the code that I copied from the Jira source.