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.