ScriptRunner loading issue

KL Kumar
Contributor
April 6, 2020

Hi,

I am working on a plugin and when I try to install it in our Dev environment, ScriptRunner doesn't show its functionalities. For example, a blank screen appears when clicked on "Script Console".

This is the Javascript file I have in my plugin.

if (typeof cgi !== 'object') {
window.cgi = {};
}
if (typeof cgi.workflowfieldsdelegator !== 'object') {
cgi.workflowfieldsdelegator = {};
}

cgi.workflowfieldsdelegator.projectadmin = function() {
this.project_key = null;
this.currrent_field_id = null;
this.url_transitions_edit = '';
this.issuetypes_data = [];

};
cgi.workflowfieldsdelegator.theProjetAdmin = new cgi.workflowfieldsdelegator.projectadmin();
jQuery(document).ready(function() {
cgi.workflowfieldsdelegator.theProjetAdmin.init();
});

@Matthew Clark  I have seen this similar issue, but couldn't figure out the issue at my end. Could you please throw some light on this please!

Thansk! Kumar

 

1 answer

0 votes
Matthew Clark
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 Leaders.
April 6, 2020

Hi Kumar

What errors do you see in the browsers developer tools console tab when you try to load a Scriptrunner admin page?

Do the pages load correctly if you do not load in your JavaScript resource?

Regards

Matthew

KL Kumar
Contributor
April 6, 2020

Thanks for the quick reply @Matthew Clark !

I see the following error in browser console.

Data with key com.onresolve.jira.groovy.groovyrunner:adminSettingsWebResources.admin-settings-data-provider has already been claimed

Yes, ScriptRunner pages load correctly if I remove my JavaScript source.

 

Thanks,

Kumar

Matthew Clark
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 Leaders.
April 6, 2020

Do you see that console error without your JavaScript resource?

It looks like your JavaScript code is interfering with scriptrunner trying to load its admin pages?

Does this impact any other admin pages for other apps?

Does your JavaScript code perform the function you want it to or does it throw errors?

How are you loading the JavaScript resource?

KL Kumar
Contributor
April 7, 2020

@Matthew Clark , Here are the answers to your points.

1. Gets the same error in console for ScriptRunner without my JavaScript resource.

Data with key com.onresolve.jira.groovy.groovyrunner:adminSettingsWebResources.admin-settings-data-provider has already been claimed

2. Correct. I added an alert message in my JavaScript and loaded Script Console. The alert message pops up.

3. Its been observed sometimes the workflow diagrams are not visible upon installing my plugin.

4. With my JavaScript code, my functionalities are working well. It doesn't throw any errors.

5. My JavaScript code is a separate file. I am loading this in my Velocity template ($webResourceManager.requireResource()) by declaring it in atlassian-plugin.xml web-resource

KL Kumar
Contributor
April 8, 2020

Hello @Matthew Clark 

Am i doing any mistake? Do you suggest any alternatives which I can try ?

Matthew Clark
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 Leaders.
April 14, 2020

Hi Kumar

I have written a custom plugin recently that creates a new menu within the Addons admin area and imported custom Javascript to control a form on the custom admin page without impact on the Scriptrunner interface so it is not a result of using any JavaScript.

It must be related to how you wrote it, how you are adding it and what the JavaScript actually does.

When I made my admin page I followed some of the suggestions here.

A lot of that Atlassian tutorial is out of date now but the JavaScript example still helped me work it out.

I cannot really help with your problem without having access to the code you are using so that I can see the JavaScript code and the atlassian-plugin.xml file.

If you can create a simplified version of the Velocity Template and the JavaScript file which you can share then I can try it here to debug further.

 

Regards

Matthew

Suggest an answer

Log in or Sign up to answer