Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to Initialize JIRA.AssigneePicker?

Alexej Geldt
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.
June 14, 2015

Using JIRA 5.2.11

 

Hello. I have a webwork action which has a view where a set of issues are being reassigned to some user.

Therefore i wanted to use the JIRA.AssigneePicker. I was unable to initialize it. I was unable to find any documentation how to do that and I was unable to figure out how JIRA does it by studying the source code of JIRA.

I was thinking that it would be as easy as initializing AJS SingleSelect.

This works:

new AJS.SingleSelect({element: AJS.$('select#project-category'), width: 250});

 

After all, Assignee Picker is just an extended SingleSelect. In JIRA Source Code i have identified the script that initializes the assignee pickers.

/jira-project/jira-components/jira-webapp/src/main/webapp/includes/jira/field/initAssigneePickers.js

It basically iterates over elements of js-assignee-picker class and turns them into AJS.AssignmentPicker's. So in my vm template i have a select element with class js-assignee-picker.

<select id="reassign" data-container-class="long-field" data-user-type="assignee" data-edit-value="select user" class="single-user-picker js-assignee-picker"   >
</select>

the select is being picked up and JIRA actually hides it and places an input element instead. So it seems that initAssigneePickers script is actually running, but its missing some parameters i guess.

When i click on the element turned by JIRA into Assignee Picker, it tries to load the suggestions, and ends up in Error popup:

The JIRA server was contacted but has returned an error response. We are unsure of the result of this operation

In Javascript console i can see folowing:

"ajax[63407302] error : {

successful  : false,

status      : 500,

statusText  : error,

hasData     : true,

readyState  : 4,

requestId   : 63407302,

aborted     : undefined,

}"

Im not sure, but this indicates to me that probably wrong rest call url was used?

So my Question is: Does anybody know how to initialize a new Assignee Picker correctly?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Alexej Geldt
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.
June 15, 2015

update: was trying to debug the rest service /rest/api/2/user/search to see whats going on inside, which parameters are being passed to it etc... I have identified the service class in JIRA Source: /jira-project/jira-components/jira-plugins/jira-rest/jira-rest-plugin/src/main/java/com/atlassian/jira/rest/v2/issue/UserResource.java however in IDE (eclipse) i cannot access that class to set up breakpoints. Its not on classpath. Any ideas how to make it available? Maybe some dependency is missing?

TAGS
AUG Leaders

Atlassian Community Events