Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner fragment to display dialog stopped working on Admin pages

Tom Hudgins
Contributor
May 3, 2022

I have a Scriptrunner Fragment/Rest API combo that I have been using to put a button on the Admin->System page. When the button is clicked, it displays the dialog generated by the Scriptrunner REST endpoint. This has all been working fine for quite awhile. 

After a recent Jira upgrade (I guess), when I click the button, the dialog doesn't open modally, it opens as a full page. There are no CSS libraries, or jquery, or anything loaded in this new page so nothing works.

If I move this button to an issue page - putting it in the jira.issue.tools location, it works (opens modally) fine.

It seems like the fragment isn't working on Admin pages. Is anyone else seeing this? Has something changed that I missed notification of?

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
May 4, 2022

Hi @Tom Hudgins

Can you confirm if you are using a similar configuration to this example?

If you could share the Fragment and REST Endpoint code that you are using, it would be helpful.

Also, could you please share the version of Jira and ScriptRunner that you are currently using?

 

Thank you and Kind regards,

Ram

Tom Hudgins
Contributor
May 4, 2022

Hi Ram, 

Yes, very similar to that example. Here's the REST EP.

 

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
import groovy.xml.MarkupBuilder
import javax.servlet.http.HttpServletRequest

@BaseScript CustomEndpointDelegate delegate

testJiraQueryDialog(httpMethod: "GET", groups: ["jira-users"]) { MultivaluedMap queryParams, body, HttpServletRequest request ->

    def writer = new StringWriter()
    def xml = new MarkupBuilder(writer)

    String dialogTitle = "Query Jira/Confluence Database"

    xml.section(role:"dialog", id:"qu-dialog", class:"aui-layer aui-dialog2 aui-dialog2-xlarge", "aria-hidden":"true", "data-aui-remove-on-hide":"true" ) {
        header(class:"aui-dialog2-header") {
            h2(class:"aui-dialog2-header-main",dialogTitle)
        }
    }
    Response.ok().type(MediaType.TEXT_HTML).entity(writer.toString()).build()
}

 

 The fragment is a web item at system.admin.top.navigation.bar/system_admin_menu

and configured to "Run code and display a dialog" with the EP listed above.

I'm on SR 6.49 and Jira Data Center 8.20.8

 

 

 

Tom Hudgins
Contributor
May 4, 2022

Just got a response back from Adaptavist. This is a bug in Scriptrunner - https://productsupport.adaptavist.com/browse/SRJIRA-5868 

Henry Brown October 5, 2022

Hi @Tom Hudgins , did you ever figure this out? I am having the same issue. I had the dialog open modally fine before but a recent upgrade has broken it? Thanks for any advice you may have.

Ram Kumar Aravindakshan _Adaptavist_
Community Champion
October 5, 2022

HI @Henry Brown,

A fix for this bug is already available in ScriptRunner version 6.52.0, as shown in the ticket: SRJIRA-5868.

I suggest that you upgrade your ScriptRunner plugin to the latest release, i.e. 7.1.0.

Thank you and Kind regards,

Ram

Tom Hudgins
Contributor
October 6, 2022

Yep @Henry Brown it's working for me now after updating Scriptrunner.

Henry Brown October 6, 2022

Hi @Ram Kumar Aravindakshan _Adaptavist_ , we are running ScriptRunner past 6.52.0 in our Confluence instance.

The issue I am having is that when I create a Custom Web Item to call a REST endpoint and display a dialog using the form with the "Run code and display a dialog" option selected, the web item works fine.

However, I would like to customize the component beyond what the form allows, so I copy the preview XML into a raw xml module. That is where the functionality fails. When the generated XML from the form is copied into an XML module, clicking the web item takes me to a full page display rather than a pop-up modal.

Henry Brown October 6, 2022

If it helps, this is for the confluence version of ScriptRunner and the web item is in the page.metadata.banner section.

Suggest an answer

Log in or Sign up to answer