I have a web panel displayed on jira issue details view page.
The content of this web panel should be refreshed after a click on a submit button (that also exist on same webpanel section).
The content is generated using a velocity template that get data from a ContextMap provider.
Currently, I use a location.load() after a click on submit button, but we need only refresh the webpanel component not reload the issue view page to get the new data.
web panel declaration:
<!-- Panel to display data from external app -->
<web-panel name="Test"
i18n-name-key="data-panel.name" key="data-panel"
location="atl.jira.view.issue.left.context" weight="200">
<description key="data-panel.description">The Issue View Data Panel</description>
<context-provider class="com.plugin.provider.ContextProvider"/>
<resource name="view" type="velocity"
location="/templates/webpanel-module/data-panel.vm" />
<supports-ajax-load>true</supports-ajax-load>
</web-panel>
data-panel.vm file:
<div id="content-attach" style="display:none;">
<form class="aui" action="">
<div class="input-group">
<input type="text"
class="controls-input" id="inputUrl"/>
<input class="aui-button aui-button-primary attach-button" id="submit-form" type="submit" value="Attach Data"/>
</div>
</form>
</div>
<div id="content-results">
....
</div>
issue-view-controller.js :
AJS.$(function(){
AJS.$("#submit-form").click(function(e){
e.preventDefault();
...
AJS.$.ajax({
url: AJS.params.baseURL+'/rest/testforjira/1.0/config/object/issue/link',
type: 'PUT',
contentType: 'application/json',
data: JSON.stringify(dataInput),
processData: false,
success: function() {
AJS.$("#content-attach").hide();
// refresh web-panel data
location.reload();
AJS.$("#content-results").show();
showSuccessFlag('Object is linked to Jira issue.');
},
error: function() {
AJS.$("#content-attach").show();
AJS.$("#content-results").hide();
showErrorFlag('Failed to link Object to jira issue.');
}
});
});
});
I know this is an old question, but in case someone needs it.
You can replace location.reload() by:
JIRA.trigger(JIRA.Events.REFRESH_ISSUE_PAGE, [JIRA.Issue.getIssueId()]);
@Nhac Tat Nguyen Can you help me with finding docs for various JIRA methods available?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@ak5123 As far as I know, there are no documents about those methods, but you can use the browser dev tool to inspect the available methods and try them.
Just print the JIRA or JIRA.Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.