Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Display external website in dialog

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.

1 answer

1 accepted

0 votes
Answer accepted

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.

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:

2019-05-01 12_27_50-Script Fragments - https___projects-test.qad.com_plugins_servlet_scriptrunner_ad.png

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()
}

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

Peter,

Thanks for you help. I now can add my part with php.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

4,463 views 5 15
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you