Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JENKINS-7824: Change assign to field to be a drop down list of users
from the user DB
- Loading branch information
Showing
5 changed files
with
69 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/main/java/hudson/plugins/claim/DescribableTestAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package hudson.plugins.claim; | ||
|
||
import hudson.Extension; | ||
import hudson.model.Describable; | ||
import hudson.model.Descriptor; | ||
import hudson.model.User; | ||
import hudson.tasks.junit.TestAction; | ||
import hudson.util.ListBoxModel; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.Comparator; | ||
import java.util.List; | ||
|
||
public abstract class DescribableTestAction extends TestAction implements Describable<DescribableTestAction> { | ||
|
||
//private static final Logger LOGGER = Logger.getLogger("claim-plugin"); | ||
|
||
public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl(); | ||
|
||
public Descriptor<DescribableTestAction> getDescriptor() { | ||
return DESCRIPTOR; | ||
} | ||
|
||
private static Comparator<User> comparator = new Comparator<User>() { | ||
public int compare(User c1, User c2) { | ||
return c1.getId().compareTo(c2.getId()); | ||
} | ||
}; | ||
|
||
@Extension | ||
public static final class DescriptorImpl extends Descriptor<DescribableTestAction> { | ||
@Override | ||
public String getDisplayName() { return "Assignee"; } | ||
|
||
public ListBoxModel doFillAssigneeItems() { | ||
ListBoxModel items = new ListBoxModel(); | ||
|
||
// sort in case the users are not already in sort order | ||
Collection<User> c = User.getAll(); | ||
List<User> l = new ArrayList<User>(c); | ||
|
||
Collections.sort(l, comparator); | ||
for (User u : l) { | ||
items.add(u.getDisplayName(), u.getId()); | ||
} | ||
|
||
return items; | ||
|
||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div> | ||
Allow users to claim failed builds. | ||
Allow users to claim or be assigned failed builds. | ||
</div> |