Skip to content

Commit

Permalink
Merge pull request #627 from jenkinsci/connection-strategy
Browse files Browse the repository at this point in the history
Fix connection strategy UI prompt
  • Loading branch information
res0nance authored Jun 4, 2021
2 parents eb06315 + 1cc308f commit c2825f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
14 changes: 5 additions & 9 deletions src/main/java/hudson/plugins/ec2/ConnectionStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ public enum ConnectionStrategy {
PRIVATE_DNS("Private DNS"),
PRIVATE_IP("Private IP");

private final String name;
private final String displayText;

ConnectionStrategy(String name) {
this.name = name;
ConnectionStrategy(String displayText) {
this.displayText = displayText;
}

public boolean equalsName(String other) {
return this.name.equals(other);
}

public String toString() {
return this.name;
public String getDisplayText() {
return this.displayText;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/ec2/SlaveTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -2062,9 +2062,9 @@ public ListBoxModel doFillConnectionStrategyItems(@QueryParameter String connect
return Stream.of(ConnectionStrategy.values())
.map(v -> {
if (v.name().equals(connectionStrategy)) {
return new ListBoxModel.Option(v.toString(), v.name(), true);
return new ListBoxModel.Option(v.getDisplayText(), v.name(), true);
} else {
return new ListBoxModel.Option(v.toString(), v.name(), false);
return new ListBoxModel.Option(v.getDisplayText(), v.name(), false);
}
})
.collect(Collectors.toCollection(ListBoxModel::new));
Expand Down

0 comments on commit c2825f3

Please sign in to comment.