Reputation: 935
I am currently developing a JIRA plugin of type Workflow post function.
This means I dont have a use for the vm file (velocity template).
I have a java class which extends AbstractJiraFunctionProvider. it basically calls a web service (asynchronously) using SOAP to update a remote system on the status of the JIRA issue.
I have got it all working and configured to be triggered when certain JIRA status transitions are done.
What I am trying to do is to show a message to notify the user if the web service has been called successfully or not.
How do I show a popup message with some text.
I tried JOptionPane.showMessageDialog(null,"Text","Text 2")
to my Plugin class
But this doesn't seem to do anything from the plugin java class which extends AbstractJiraFunctionProvider.
Any thoughts or ideas for me to try?
Upvotes: 1
Views: 1243
Reputation: 2996
I had a similar question but didn't get a satisfactory answer so far. My further research lead me to a different direction (to log everything to a log file and let the jira admin deal with it). But, you can try with another workflow plugin module which you can use for this purpose: a validator module. Its code is triggered right after a user submits the transition dialog, but prior the transition is accepted (it's used to validate if all the input parameters in the dialog are valid for the current transition). So, you might take an approach of using a validator to check if the service is up and throw an exception if it's not. This way, of course, you are preventing normal workflow in JIRA, if the remote service is not available.
Another solution (which you might find more convenient for your case) is to extend the JIRA View action by adding a webwork module. First, add a new webwork module in your atlassian-plugin.xml file:
<webwork1 key="view-issue" name="View issue with warnings" class="java.lang.Object">
<description>View issue with warnings</description>
<actions>
<action name="com.my.jira.plugin.blah.blah.ExtendedViewIssue" alias="ViewIssue">
<view name="success">/secure/views/issue/extended-viewissue.jsp</view>
<view name="issuenotfound">/secure/views/issuenotfound.jsp</view>
<view name="permissionviolation">/secure/views/permissionviolation.jsp</view>
<command name="moveIssueLink" alias="MoveIssueLink">
<view name="error">/secure/views/issue/viewissue.jsp</view>
</command>
</action>
</actions>
</webwork1>
Then, override the class ViewIssue with your ExtendedViewIssue (see above) and add a public method to check if your service is available and that method will be invoked from the JSP page that displays the issue:
public boolean isServiceAvailable() {
// TODO your code that checks if the service is available
return false;
}
Edit the file extended-viewissue.jsp and add a div that will contain your warning if the condition is satisfied.
<ww:if test="/isServiceAvailable() == false">
<div class="aui-message warning">
<span class="aui-icon icon-warning">The service is not available!</span>
</div>
</ww:if>
It should look like this if done properly:
Keep in mind that after each JIRA upgrade you'll have to again edit the JSP file, because the changes you introduced there might be lost during the upgrade.
Upvotes: 1