Skip to content
Permalink
Browse files

fixed JENKINS-14420:

removed buggy jelly inputs and default site selection
  • Loading branch information
edmund-wagner committed Sep 3, 2012
1 parent 1c2b3aa commit ada65c364dce4a15c0b7751c8976fec570829617
@@ -11,6 +11,7 @@
import hudson.tasks.BuildWrapperDescriptor;
import hudson.util.CopyOnWriteList;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;

import java.io.File;
import java.io.IOException;
@@ -42,13 +43,6 @@ public SSHBuildWrapper() {

@DataBoundConstructor
public SSHBuildWrapper(String siteName, String preScript, String postScript) {
if (siteName == null) {
// defaults to the first one
SSHSite[] sites = DESCRIPTOR.getSites();
if (sites.length > 0){
siteName = sites[0].getSitename();
}
}
this.siteName = siteName;
this.preScript = preScript;
this.postScript = postScript;
@@ -118,9 +112,6 @@ public void setPostScript(String postScript) {

public SSHSite getSite() {
SSHSite[] sites = DESCRIPTOR.getSites();
if (siteName == null && sites.length > 0){
return sites[0]; // default
}

for (SSHSite site : sites) {
if (site.getSitename().equals(siteName))
@@ -153,6 +144,14 @@ protected DescriptorImpl(Class<? extends BuildWrapper> clazz) {
public String getDisplayName() {
return Messages.SSH_DisplayName();
}

public ListBoxModel doFillSiteNameItems() {
ListBoxModel m = new ListBoxModel();
for (SSHSite site : SSHBuildWrapper.DESCRIPTOR.getSites()) {
m.add(site.getSitename());
}
return m;
}

public String getShortName() {
return "[SSH] ";
@@ -165,9 +164,7 @@ public String getHelpFile() {

@Override
public BuildWrapper newInstance(StaplerRequest req, JSONObject formData) {
SSHBuildWrapper pub = new SSHBuildWrapper();
req.bindParameters(pub, "ssh.");
return pub;
return req.bindJSON(clazz, formData);
}

public SSHSite[] getSites() {
@@ -1,12 +1,8 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">

<j:set var="helpURL" value="/plugin/ssh" />
<f:entry title="${%SSH site}">
<select class="setting-input" name="ssh.siteName" help="${helpURL}/help-hostselect.html">
<j:forEach var="s" items="${descriptor.sites}">
<f:option selected="${s.name==instance.siteName}">${s.sitename}</f:option>
</j:forEach>
</select>
<f:entry title="${%SSH site}" field="siteName" name="ssh.siteName">
<f:select />
</f:entry>

<f:entry title="${%Pre build script}" help="${helpURL}/help-prescript.html">

0 comments on commit ada65c3

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