Forums

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

Web-item with a dialog

Saida
Contributor
May 15, 2018

Good day! 

I need to add a button to the issue, available to anyone who can see the issue.

On click it should show a dialog with a text field (for ex., Label). Inserted value should be added to the Labels of the issue. 

Now I made the following - custom web-item added, endpoint created, it shows the dialog.

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 org.apache.log4j.Logger;
def log = Logger.getLogger("com.onresolve.jira.groovy");

@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">
<p>Testing a dialog button...</p>

<form class="aui">
<div class="field-group">
<label for="text-input">Labels to add<span class="aui-icon icon-required">required</span></label>
<input class="text" type="text" id="text-input" name="text-input" title="Label to add">
<div class="description">Test description</div>
</div>
</form>

</div>

<footer class="aui-dialog2-footer">
<div class="aui-dialog2-footer-actions">
<button class="aui-button aui-button-primary">Save</button>
<button id="dialog-close-button" class="aui-button aui-button-link">Close</button>
</div>
<div class="aui-dialog2-footer-hint">Test hint</div>
</footer>
</section>
"""

Response.ok().type(MediaType.TEXT_HTML).entity(dialog.toString()).build()
}

Now how can I get the value from  text-input  to update the issue? I'm not very familiar with html / js.

Thank you in advance. 

2 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Suhas P
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 6, 2018

Problem fixed by downgrading plugin to 5.0.14

0 votes
Jenna Davis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 5, 2018

Hello, 

You might try downloading the .jar file of your version directly from the marketplace and instead of through the marketplace listing. 

Please let me know if you have any success with this. If not, can you tell me what versions of ScriptRunner and JIRA you're using?

Jenna

Suhas P
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 6, 2018

Hi Jenna,

I managed to fix the issue by downgrading the plugin version to 5.0.14. This is very strange issue though the earlier version of plugin was also supported version.

Jenna Davis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 8, 2018

Hi Suhas, 

I'm glad using version 5.0.14 fixed this for you! However, this does sound like an odd issue to me. If you want to have us look into the issue for you more I would recommend filing a support request at Adaptavist's support portal. We could look into what's going on more and hopefully get everything working there. 

Kind regards, 

Jenna

TAGS
AUG Leaders

Atlassian Community Events