What I need
What I want to achieve is when clicking on a button in the action pane of the release list of a project to gather some text of custom fields from tickets within this specific release and show it in a popup.
Problem
I tried multiple approaches from different tutorials but my problem is to show this html as an popup and not opening it within the same tab.
What I did so far
So I created a custom web item in the section atl.jira.version.admin.operations.
I picket the "Run code and display a dialog" option with the link like "/rest/scriptrunner/latest/custom/showDialog"
Next on I created a rest endpoint:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.transform.BaseScript
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
@BaseScript CustomEndpointDelegate delegate
showDialog() { MultivaluedMap queryParams ->
def dialog ="""
<section id="static-dialog" class="aui-layer aui-dialog2 aui-dialog2-medium" role="dialog" aria-hidden="true">
<!-- Dialog header -->
<header class="aui-dialog2-header">
<!-- The dialog's title -->
<h2 class="aui-dialog2-header-main">The modal dialog title</h2>
</header>
<!-- Main dialog content -->
<div class="aui-dialog2-content">
<p>Content for the modal dialog.</p>
</div>
<!-- Dialog footer -->
<footer class="aui-dialog2-footer">
<!-- Actions to render on the right of the footer -->
<div class="aui-dialog2-footer-actions">
<button class="aui-button aui-button-link">Close</button>
</div>
</footer>
</section>
"""
Response.ok().type(MediaType.TEXT_HTML).entity(dialog.toString()).build()
}
But it always opens within the same tab. What did I miss here?
Bonus Question
Another question would be how can I access the id of the release to pass it to my rest endpoint?
Something like this?
/rest/scriptrunner/latest/custom/showDialog?versionid={version.key}