I am using the following code in ScriptRunner to show a dialog to the user if the issue does not have any components. Here is a screenshot of what is shown to the user if the issue does not have any components.
I would like a new page to be shown instead of a dialog kind of like the screenshot below:
Here is my code below, how can I modify my code to make a new page displayed instead of a dialog?
package SuperFeature
import groovy.transform.BaseScript
import com.atlassian.jira.issue.Issue;
import javax.ws.rs.core.Response
import org.apache.log4j.Logger
import groovy.transform.BaseScript
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import javax.ws.rs.core.MultivaluedMap
import com.atlassian.jira.component.ComponentAccessor
import javax.ws.rs.core.Response
import com.opensymphony.workflow.WorkflowException
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.transform.BaseScript
import javax.servlet.http.HttpServletRequest
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
@BaseScript CustomEndpointDelegate delegate
mounaGenerate(httpMethod: "GET", groups: ["jira-users"]) {
MultivaluedMap queryParams, String body ->
def log1 = Logger.getLogger("atlassian-jira.log")
def issueId = queryParams.getFirst("issueId") as Long
Issue myissue = ComponentAccessor.getIssueManager().getIssueObject(issueId)
def issueKey = myissue.getKey()
def componentNames = myissue.getComponents() * .name
log1.warn("MOUNA componentNames " + componentNames)
if (componentNames.empty) {
log1.warn("MOUNA EMPTY")
def dialog =
""
"<section role="
dialog " id="
sr - dialog " class="
aui - layer aui - dialog2 aui - dialog2 - medium " aria-hidden="
true " data-aui-remove-on-hide="
true "> <
header class = "aui-dialog2-header" >
<
h2 class = "aui-dialog2-header-main" > Some dialog < /h2> <
a class = "aui-dialog2-header-close" >
<
span class = "aui-icon aui-icon-small aui-iconfont-close-dialog" > Close < /span> <
/a> <
/header> <
div class = "aui-dialog2-content" >
<
p > This is a dialog... < /p> <
/div> <
footer class = "aui-dialog2-footer" >
<
div class = "aui-dialog2-footer-actions" >
<
button id = "dialog-close-button"
class = "aui-button aui-button-link" > Close < /button> <
/div> <
div class = "aui-dialog2-footer-hint" > Some hint here
if you like < /div> <
/footer> <
/section>
""
"
Response.ok().type(MediaType.TEXT_HTML).entity(dialog.toString()).build()
} else {
log1.warn("MOUNA componentNames NOT EMPTY")
}
}