I have followed the "Dialog (Advanced)" example described at https://scriptrunner.adaptavist.com/4.3.4/jira/fragments/WebItem.html and wired the dialog box to the javascript code listed at the same page.
If I display a single issue (e.g. <jira_server>/jira/browse/OTMCOPY2-19), then everything works as expected and I am able to close the dialog box by means of the Close button.
On the contrary, if I display the list of open issues (e.g. <jira_server>/jira/projects/OTMCOPY2/issues/OTMCOPY2-19?filter=allopenissues), then when I click on the Close button nothing happens and the dialog stays open.
Here is the rest end point code for your reference :
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="my-own-dialog" class="aui-layer aui-dialog2 aui-dialog2-medium" aria-hidden="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>This is a dialog...</p>
</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>
<div class="aui-dialog2-footer-hint">Some hint here if you like</div>
</footer>
</section>
"""
Response.ok().type(MediaType.TEXT_HTML).entity(dialog.toString()).build()
}
As suggested by Jonny, I have added several console.log() to the javascript function of the example. Here it is:
console.log("Register function");
(function ($) {
console.log("Called function with Atlassian's jQuery object: ");
console.log($);
$(function ( ) {
console.log("Setup show event handler");
AJS.dialog2.on("show", function (e) {
console.log("Show event fired");
var targetId = e.target.id;
if (targetId == "my-own-dialog") {
console.log("Target ID matched");
var someDialog = AJS.dialog2(e.target);
$(e.target).find("#dialog-close-button").click(function (e) {
console.log("close button clicked; shut this stuff down");
e.preventDefault();
someDialog.hide();
someDialog.remove();
});
// etc
}
});
});
})(AJS.$);The context used is atl.general
Here is an excerpt of the console output after the page is loaded
Register function batch.js?agile_global_admin_condition=true&is-server-instance=true&is-system-admin=true&jag=true&ja…:15632
Called function with Atlassian's jQuery object: batch.js?agile_global_admin_condition=true&is-server-instance=true&is-system-admin=true&jag=true&ja…:15634
function (a,b){return new j.fn.init(a,b,gb)} batch.js?agile_global_admin_condition=true&is-server-instance=true&is-system-admin=true&jag=true&ja…:15635
DEPRECATED - Inline dialog constructor has been deprecated and will be removed in a future release. Use inline dialog 2 instead.
at http://<jira_server_address>/jira/s/0f52c7b2f7bbe44352ed7b71e853e568-CDN/en_UKxud8…&tempo_is_tempo_timesheets_license_valid=true&user-logged-in=true:2728:421 batch.js?atlassian.aui.raphael.disabled=true&locale=en-UK:213
XHR finished loading: "http://<jira_server_address>/jira/rest/webResources/1.0/resources". batch.js?atlassian.aui.raphael.disabled=true&locale=en-UK:175
Downloading resources:
js!/jira/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_UKxud80d/71012/b6b48b2829824b869586ac216d119363/017bee1cfb84708a7ba1e4bae9f57901/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-atl.general/batch.js!order batch.js?atlassian.aui.raphael.disabled=true&locale=en-UK:213
Deprecation warning: moment.langData is deprecated. Use moment.localeData instead.
Arguments: jira
Error
at Function.<anonymous> (http://<jira_server_address>/jira/s/0f52c7b2f7bbe44352ed7b71e853e568-CDN/en_UKxud8…tempo_is_tempo_timesheets_license_valid=true&user-logged-in=true:2949:3313)
at http://<jira_server_address>/jira/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_UKxud8…ocalisation-moment/jira.webresources:calendar-localisation-moment.js:3:134
at http://<jira_server_address>/jira/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_UKxud8…ocalisation-moment/jira.webresources:calendar-localisation-moment.js:3:431 batch.js?agile_global_admin_condition=true&is-server-instance=true&is-system-admin=true&jag=true&ja…:2949
DEPRECATED - Dropdown constructor has been deprecated and will be removed in a future release. Use Dropdown2 instead.
at Object.exports.bindConfigDashboardDds (http://<jira_server_address>/jira/s/4d5ae9bcb5c2695e2b15e1d59489d026-CDN/en_UKxud8…/_super/batch.js?atlassian.aui.raphael.disabled=true&locale=en-UK:2986:545) batch.js?atlassian.aui.raphael.disabled=true&locale=en-UK:213
DEPRECATED - Inline dialog constructor has been deprecated and will be removed in a future release. Use inline dialog 2 instead.
at _initShareDialog (http://<jira_server_address>/jira/s/0f52c7b2f7bbe44352ed7b71e853e568-CDN/en_UKxud8…tempo_is_tempo_timesheets_license_valid=true&user-logged-in=true:2520:7075) batch.js?atlassian.aui.raphael.disabled=true&locale=en-UK:213
Setup show event handler batch.js?agile_global_admin_condition=true&is-server-instance=true&is-system-admin=true&jag=true&ja…:15637
DEPRECATEDWhen I press the button for showing the dialog window the following output is printed to the console
XHR finished loading: "http://<jira_server_address>/jira/rest/scriptrunner/latest/custom/showDialog?_=1474546065767". batch.js?atlassian.aui.raphael.disabled=true&locale=en-UK:175
Whereas the message "Show event fired" is supposed to be printed as well, but it does not.
Hi Benicio, unfortunately not - that name is given to the "Add-on user" and comes from the name of the add-on. Sadly Atlassian don't appear to allow editing the name of "Add-on users".
Thanks for replying, Any idea if this will change in the future?
My users disregard it as SPAM of some sort because of this.
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.