Jira simple plug-in (connection tester) development

Hello fellow JIRA developers.

I’m pretty new to development with atlassian jira plugin SDK, so I’d like to ask you for a few guidelines.
Basically what I’m trying to do is to make a new link inside admin config panel that would check the connection of JIRA/JIRA API by itself (e.g by pinging the host address or API address) and report back on a pop-up window if the connection is ok or not.

I figured out to add a web-item with section system.admin/configuration, but I can’t figure out what/how to do next thing, that is pinging the JIRA connection link. I’ve made a servlet class and implemented the code to check first if the logged in user is admin or not and do some redirects/messages, if he is admin I’d like to procceed with checking the connection.

I’m just wondering what classes/functions I could use for this ? Do I need to make new classes that are going to be called ?

Any kind of help is appreciated since I’m pretty new with this (started out a few weeks ago, with almost no background with java development) and the tutorials are really lacking. I’ve bought and read the JIRA Development Cookbook third edition and I’d recommend it to anyone that’s starting with JIRA plugin development, since it’s much better than online written tutorials.

Also if anyone is willing to send me some of their code (doesn’t have to be connected with my issue), I’d really appreciate it, since it’s best to learn from seniors (or their code) who know what they are doing, than just following tutorials.

Thanks in advance for any help you provide

I’m not sure I understand what you’re trying to achieve. A link is just a way for the user to trigger some behaviour: the rendering of a page, for example. The link could cause some HTML to be rendered and some JavaScript to be downloaded as a web resource, which periodically pings the server. Of course, you still need the user to click the link.

Yes, that’s what I’d like to do. Maybe redirect to a link in the background and report back the result (e.g. that the server instance is not available) on the pop-up window (dialog).

You might want to look at defining a web resource in your atlassian-plugin.xml file, and setting the context to jira.admin. In that web resource, you’ll want to refer to a JavaScript resource. There are some good examples on the web resource page that I linked to in my earlier reply. The JavaScript will run in the browser, and send GET requests to a servlet.

1 Like

Ok, thanks for your time, I’ll try that out