Hi all,
my question is related to an issue concerning the current baheviours plugin. Maybe someone of you guys can help me out...
That's the problem:
If you set up a Behaviours action for "Project A" only, and you hit the "Create Issue" button and a "Project A" issue was on screen at the time, the behaviors will continue to fire even if you switch to "Project B" on the top of the create form. And the opposite is true. If you hit the "Create Issue" button while you are on a "Project B" issue, and then switch to "Project A" (where the Behaviour should now be triggered) nothing happens. If you are not at an issue page, it will work
It's not only the project the behaviour seems to be bound to the issue type that's been opened in the background. Looking at the source code the problem could be somewhere here:
AJS.$(document).ready(function() { // todo other forms possibly var selectors = ["form[id='issue-workflow-transition']", "#issue-create", "form[id='issue-edit']", "form[id='subtask-create-details']"]; var behaviourRequired = false; AJS.$.each(selectors, function(i, v) { var el = AJS.$(v); el.unbind('submit', submitForm).bind('submit', {docRoot: AJS.$("body")}, submitForm); if (el.length) { behaviourRequired = true; } }); var issueId = AJS.$("#key-val").attr('rel'); console.log ("issueId: " + issueId); var actionId = AJS.$("input[name='action']").val(); if (typeof actionId == "undefined") { actionId = 0; } console.log ("actionId: " + actionId); // if we have a pid and issue type use that var issueTypeId = AJS.$("input[name=issuetype]").val(); console.log ("issueType: " + issueTypeId); var pid = AJS.$("input[name=pid]").val(); console.log ("pid: " + pid); // get list of validators console.log(typeof(issueId)); console.log(issueId); if (behaviourRequired && typeof(issueId) != "undefined") { AJS.$.get(AJS.params.baseURL + "/rest/com.onresolve.jira.plugin.Behaviours/1.0/behaviours/validators.json", {issueId: issueId, actionId: actionId}, function (data) { addFieldListeners(AJS.$("body"), data, true); } ); } else if (typeof(pid) != "undefined" && typeof(issueTypeId) != "undefined") { AJS.$.get(AJS.params.baseURL + "/rest/com.onresolve.jira.plugin.Behaviours/1.0/behaviours/validatorsByPid.json", {pid: pid, issueTypeId: issueTypeId, actionId: actionId}, function (data) { addFieldListeners(AJS.$("body"), data, true); } ); } AJS.$(document).bind('dialogContentReady', function(event, dialog) { actionId = AJS.$(".aui-popup").find("input[name='action']").val(); // console.log(dialog.$popup); // console.log(dialog.$popup.attr('id')); pid = dialog.$popup.find("#project").val(); issueTypeId = dialog.$popup.find("#issuetype").val(); // console.log("pid: " + pid); // console.log("issueId: " + issueId); // not always true // edit issue popup var formIds = "#issue-workflow-transition,#assign-issue,input[type='hidden'][name='id'],div.issue-setup-fields"; if (dialog.$popup.find(formIds).length) { // todo: duplicated above if (typeof(issueId) != "undefined") { AJS.$.get(AJS.params.baseURL + "/rest/com.onresolve.jira.plugin.Behaviours/1.0/behaviours/validators.json", {issueId: issueId, actionId: actionId}, function (data) { addFieldListeners(dialog.$popup, data, true); } ); } else if (typeof(pid) != "undefined" && typeof(issueTypeId) != "undefined") { AJS.$.get(AJS.params.baseURL + "/rest/com.onresolve.jira.plugin.Behaviours/1.0/behaviours/validatorsByPid.json", {pid: pid, issueTypeId: issueTypeId, actionId: actionId}, function (data) { addFieldListeners(dialog.$popup, data, true); } ); }
I guess you would have to check if you're editing an issue (which should get the behaviour assigned to that particular issue type) or want to create a new issue in which the current issue id should be ignored.
Hope that you know what I mean...
I think we ve identified the bug. The unwanted behaviour mix has been the result of some merging of existing and new "behaviours". We`re currently testing the fix but if you want we could provide the fix here?...
Cheers Christian
Hello,
We have the version 0.5.0 of the plugin and this problem happen. What is the solution for the problem please?
The problem happens when we wnt to create an issue in the issue page.
Our customer have the JIRA 5.0.7 and don't have migrate.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Another confusing thing is the output of the firebug console when I navigate to a view issue screen. Is this normal?
Won't let me upload attachments. Here's the text only version:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This should be fixed in the latest release.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
I know. I also commented on the issue but I hoped to get your attention in this forum...My problem is that I'm pressed for time... My current customer wants to go live with a system but not until this issue is fixed. That's why I've been asking all those questions about you maintaining the plugin etc. The second thought was to search for the bug and locally fixing it for now. I know that you don't have that much time. That's why I asked if you could point me to the right spot since I was just browsing the source randomly...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would guess something is not getting cleared the second time the script is activated. There are one or two global variables (eg "behaviours" iirc) , I would try to clear them just inside the dialogContentReady block.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also I think "AJS.$(document).bind(
'dialogContentReady'
," should be changed to the NEW_CONTENT_ADDED event...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your comment, I'll check if it works!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie,
I am currently running into the same problem. I tried to clear all global variables as you said, but this did not do anything. Also I changed
AJS.$(document).bind('dialogContentReady', function(event, dialog) {
to
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (event,dialog) {
but this made the $popup object in the following dialog.$popup undefined.
I also simply tried to comment out the two if-clauses in
line 838:
if (behaviourRequired && typeof(issueId) != "undefined") { ...
and line 880
if (typeof(issueId) != "undefined") {...
but so far, I have no luck fixing the bug. Could you please tell me what I am doing wrong??
Thanks in advance!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When I turn on firebug it becomes clear that the issue_id of the issue opened in the background gets pulled by the script and the validators.json is being addressed. Creating an issue from the dashboard the validatorsByPid.json is being addressed.... I've attached some screenshots:
Any ideas? By the way, is the clientvaljq.js the right spot to look for the bug?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I tried around a bit more and looked at the BehaviourManagerImpl.groovy.
I changed the
if (form["id"]) { issue = ComponentManager.getInstance().getIssueManager().getIssueObject(Long.parseLong(form["id"])) pid = issue.getProjectObject().getId() issueTypeId = issue.getIssueType().get("id").toLong() actionId = form["action"] ? Integer.parseInt(form["action"]) : 0 }
to
if (form.isCreateIssue != "true"&& form["id"]) { // only if editing form displayed issue = ComponentManager.getInstance().getIssueManager().getIssueObject(Long.parseLong(form["id"])) pid = issue.getProjectObject().getId() issueTypeId = issue.getIssueType().get("id").toLong() actionId = form["action"] ? Integer.parseInt(form["action"]) : 0 }
which works for an easy test case but doesn't work for our scenario with lots of configured behaviours on different fields.
Jamie, maybe this is something you could follow up on? Thanks in advance!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Jamie,
do you think you got a minute to look at the updates from Sarah? We are to go live tomorrow and I have to tell the users about the bug (unless I fix it until tomorrow...won't happen I guess).
Just a quick look since you are the one who knows the code best!
Thank you very much!!
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Christian, I'm really sorry, there is nothing I can do today or tomorrow. Maybe next week time allowing. But what about jira 5.1 and above... what are your plans for that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie,
no problem. Thanks for the response anyway. My customers doesn't plan to upgrade anytime soon and if inline editing is the killer for your plugin they probably won't use that feature at all. My problem is that I don't see any real alternative to validate fields in realtime...Any help (whenever you got time) is really being appreciated!
Thanks
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie,
with joy I noticed in early November, that you've decided to keep behaviours plugin alive. Since I don’t have any contact on you I’m addressing a question right here…
After fixing this bug () locally we now have two more suggestions that would be handled by a student, who is about to write a university paper about JIRA and your plugin
Firstly, we would like to have the possibility of inline-editing of the behaviors in the admin area, Secondly, an import / export function of the mappings and behaviors would be highly desirable.
The student could make these changes for us, but he would like to discuss them with you, so that these could be included in the update process.
Since we‘re still using an older version of Jira (5.0.7) he would port and test his changes on the latest version of your plugin, if you agree.
What do you think about this? If you want to get in contact with our student he’d be very happy to hear from you. His address is: J.Riedinger@decadis.de.
Merry Christmas and thanks for the plugin,
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christian,
In general happy enough to speak to anyone but it would be pretty brief, my spare time is going into groovy jql functions at the moment.
The mappings and behaviours are just properties so shd be easy to get out. Importing would involve mapping custom field ID to name, which is not so easy. Same problem with a general export/import in jira.
Why don't you pass on my email, it is "firstname at lastname @ gmail.com". PS: subsitute my first and last names... that seems to trip people up.
cheers, jamie
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.