Skip to content
Permalink
Browse files

[JENKINS-31863] Sort Credential select list by credenial name

  • Loading branch information...
AndraeRay committed Mar 9, 2016
1 parent b3e7589 commit 68dc8c9607ec66f474824ec0489a38c205bfdd18
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/main/java/com/cloudbees/plugins/credentials/CredentialsProvider.java
@@ -25,6 +25,7 @@

import com.cloudbees.plugins.credentials.common.IdCredentials;
import com.cloudbees.plugins.credentials.domains.DomainRequirement;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
@@ -57,6 +58,7 @@
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
@@ -466,6 +468,7 @@ public CredentialsStore getStore(@CheckForNull ModelObject object) {
+ " likely due to missing optional dependency", e);
}
}
Collections.sort(result, new CredentialsNameComparator());
return result;
}

@@ -534,9 +537,11 @@ public CredentialsStore getStore(@CheckForNull ModelObject object) {
+ " likely due to missing optional dependency", e);
}
}

Collections.sort(result, new CredentialsNameComparator());
return result;
}

/**
* Returns the scopes allowed for credentials stored within the specified object or {@code null} if the
* object is not relevant for scopes and the object's container should be considered instead.
@@ -834,3 +839,11 @@ public void remove() {
}

}

class CredentialsNameComparator implements Comparator<Credentials>{

@Override
public int compare(Credentials cred1, Credentials cred2) {
return CredentialsNameProvider.name(cred1).compareTo(CredentialsNameProvider.name(cred2));
}
};

0 comments on commit 68dc8c9

Please sign in to comment.
You can’t perform that action at this time.