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.
Problem fixed by downgrading plugin to 5.0.14
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.