Is it possible to display an external website with a Scriptrunner Custom web item. I have a jira site that is used for publication documents and one of the sub-task requires printer information such as printer name, address email etc. I am pulling the printer information into site with nfeed, but I need to allow users to add, edit and delete printer. I have setup a Custom web item before which will redirect the browser to another url but really need to be able to allow user to see the information in a dialog or a modal.
If the target site doesn't have same-origin restrictions, you might be able to include it in an iframe inside a custom dialog.
Thanks Peter,
I have create a rest endpoint that will display and iframe. My next question is how to connect the Custom web item to a rest endpoint.
In the Custom web item I have the "Do what" set to "Run code and display a dialog" but the https://scriptrunner.adaptavist.com/5.4.12/jira/fragments/WebItem.html is not clear on how to connect a Custom web item to an rest endpoint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Assuming your rest endpoint returns the HTML for a dialog (<section role="dialog" ...etc), you just make the rest endpoint the target of the webItem in the "link" field.
Like this:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Peter,
I had to walk away from this item for a bit because of other obligation.
I have followed your suggestion on the web-item and add the link as you recommended
/rest/scriptrunner/latest/custom/getProjectConfigDialog?pkey=${project.key}
The dialog box is still not opening at all. I have my rest end point inline script set to:
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 ->
// get a reference to the current page...
// def page = getPage(queryParams)
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">
<iframe src="https;//www.my-website.com" width="800" height="600"></iframe>
</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>
</footer>
</section>
"""
Response.ok().type(MediaType.TEXT_HTML).entity(dialog.toString()).build()
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe that's too obvious to mention ... but I the target in your case should be
/rest/scriptrunner/latest/custom/showDialog
Also, I'm not sure if that part matters, but usually, I don't have parens for rest endpoints:
showDialog { MultivaluedMap queryParams ->
What happens when you go directly to your rest endpoint? From the script rest endpoint screen, there should be a link you can click. It should open a page with just your dialog's html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online 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.