Is it possible to refresh the web-panel?

I’m developing a custom Jira plugin, and I would like my web-panel to re-retrieve the context map parameters from it’s ContextProvider class (which is my custom one) once every minute. Or, I could fire some custom event and then handle it somehow, probably through JS.

In any case, I have no idea on how to achieve this and would be extremely thankful for any suggestions.

Can you maybe show how you have it implemented?
Does it re-retrieve once you refresh the page?

Yes, refreshing the page reloads the params of the velocity template, but I would like this to happen independently of anything, periodically.

I have written a PluginJob to aggregate the data which is then shown on the page. It is then used in the getContextMap() to pass the data to the template. My plugin job is triggered once every minute, and according to my logs there is no problem with that. I can share the code, if there is a need.

Just to bring more context, here is a topic with a similar problem

Hmm okay, a div refresh seems the most simple way.
Maybe try something around the lines of this example:

setInterval(function() {
	  $(contentOfYourDiv);
	}, 2000);
1 Like

@Taylan, thank you for your response! But, I am a little bit more than 0 in JS and have troubles with understanding of how do I include the JS resorce file to my plugin and getting it to work correctly.

Okay. Please try to follow this guide in order to have a Web resource that contains your JS file. After doing that, reference the web resource you just created in your .vm file. That should allow you to use JS in your template

2 Likes

If you want to do this without refreshing entire page, sounds like you need a REST end point, and JavaScript (you can follow previously mentioned guide to include JavaScript) that’ll re-render the content of your <web-panel>.

The initial rendering can happen on server using the data from ContextProvider as it works right now. After that your JavaScript should “Poll” the REST endpoint every minute and render the content you want client side.