Skip to content

Commit

Permalink
[FIXED JENKINS-15510]
Browse files Browse the repository at this point in the history
Added the "unknown" image and honor the running image properly for running jobs.
  • Loading branch information
kohsuke committed Mar 1, 2013
1 parent bb17874 commit 3bc147f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/main/java/org/jenkinsci/plugins/badge/BadgeActionFactory.java
Expand Up @@ -15,13 +15,16 @@
*/
@Extension
public class BadgeActionFactory extends TransientProjectActionFactory {
private final StatusImage[] images = new StatusImage[4];
private final StatusImage[] images;

public BadgeActionFactory() throws IOException {
images[0] = new StatusImage("failure.png");
images[1] = new StatusImage("unstable.png");
images[2] = new StatusImage("success.png");
images[3] = new StatusImage("running.png");
images = new StatusImage[] {
new StatusImage("failure.png"),
new StatusImage("unstable.png"),
new StatusImage("success.png"),
new StatusImage("running.png"),
new StatusImage("unknown.png")
};
}

@Override
Expand All @@ -30,7 +33,10 @@ public Collection<? extends Action> createFor(AbstractProject target) {
}

public StatusImage getImage(BallColor color) {
switch (color.noAnime()) {
if (color.isAnimated())
return images[3];

switch (color) {
case RED:
case ABORTED:
return images[0];
Expand All @@ -39,7 +45,7 @@ public StatusImage getImage(BallColor color) {
case BLUE:
return images[2];
default:
return images[3];
return images[4];
}
}

Expand Down

0 comments on commit 3bc147f

Please sign in to comment.