Hi,
I need to refresh the browser page by writing code in java class of my plugin. Please suggest if it is possible.
Thanks,
Bharadwaj Jannu
Hello @Bharadwaj Jannu
It is server/client related. Server serves the client, not vice versa. It is up to the client to decide when he requests content. It is not up to the server to deliver new content to the client when the client didnt asked for it. Hence it is the client (browser) which has to decide when a page needs to be refreshed. So theoreticaly youre limited to code that runs on client side, i.e. javascript / ajax etc...
In jira you can however trigger a redirect in some cases. In a WebWork action you can use
return returnComplete(appProperties.getBaseUrl() + "/secure/Page.jspa");
this will trigger redirect to another page or reload the current one.
Probably not - the java is not really directly connected to the front end.
I suspect that the most simple way to do this is actually have some javascript/AJAX that will do it. But that doesn't go into the java, it's handled by the .jsp and .vm stuff (And soy templates in later versions, possibly)
Could you tell us what your plugin does roughly? (like "provide custom field type", "report", etc) and why and where you need the refresh to happen?
Hi Nic,
My plugin is issue-navigator-plugin which overrides the existing one.
I am doing inline editing on fields.
I'm giving values for custom fields and updating based on some condition.
The fields getting updated but they are shown only after manual refresh of page.
So the fields should get automatically loaded when I end inline editing.
After editing if you are redirecting to a .vm file you can add a javascript which will reload the page .for reloading using javascript see this
Ah, ok, well, that's definitely not the java side of it, it's the front end, which I believe to be mostly AJAX for the interactive stuff.
I'm out of my depth though (I'm not a developer - got simple java, but I haven't done enough with AJAX to enable me to learn anything useful). Personally, I'd take a look at how Atlassian do it on their view screens.
However, I remember a discussion from a while ago. In-line edit arrived, and Atlassian got a swathe of "this is great, but why haven't you done it on the issue navigator". The answer was "we're going that way, but it's hideously complicated, so it's not going to arrive soon". If they're hesitant about it, then I suspect that there's good reason to be scared of trying to write it.
hi Alexej Geldt,
where can we find returnComplete(...) method in jira and how it can be used in webwork actions?
@Bharadwaj Jannu
It comes from JiraWebActionSupport which you extend in your web action controller.
public class MyAction extends JiraWebActionSupport { private final ApplicationProperties appProperties; public MyAction(final ApplicationProperties appProperties) { this.appProperties = appProperties; } @Override public String execute() throws Exception { return returnComplete(appProperties.getBaseUrl() + "/secure/MySite.jspa"); } }
you can also use it in commands of a webwork action.
example:
public String doSomeCommand() { ... return returnComplete(url); }
hi Alexeh Geldt,
I tried the above code with my required modifications, the execute() method is not getting invoked after inline editing is done.
hi Bharadwaj,
have u get any solution for it
i also have same problem need to refresh page mannulay for showing updated changes of AO table
The following code I used in web-resource module to refresh web page when a panel is modified.
AJS.$(function() { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context, reason) { var $context = AJS.$(context); // do on inline edit if (reason == JIRA.CONTENT_ADDED_REASON.panelRefreshed){ // force refresh location.reload(); } }); });
hi Bharadwaj;
i put above code in web-resouce module of plugin but its not working
actually i have project tab panel in that i dispaly content of AO table in table form from that project tab panel vm file i called servlet in that i modify AO table and againg redirect to project tab panel class.class is get executed but that modied data is not able to show on project tab panel(browser)
after refreshing page that data get dispaly
i called servlet through ajax from tab panel
require(["jira/issue", "jira/util/events", "jira/util/events/types"] , function(issue, jiraUtilEvents, EventTypes) { jiraUtilEvents.trigger(EventTypes.REFRESH_ISSUE_PAGE, [issue.getIssueId()]) });
This should be a better approach.
It looks like you're new here. Sign in or register to get started.