Skip to content
Permalink
Browse files

Merge pull request #59 from ntwerdochlib/JENKINS-49727-optional-list-…

…size

Add optional parameter to specify the number of items the list will display
  • Loading branch information
klimas7 committed Feb 26, 2018
2 parents a917450 + 3a6ed27 commit 65266404f0772bee46b871e62d379625a4b36848
@@ -52,12 +52,14 @@
import org.jenkinsci.plugins.gitclient.GitClient;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;

public class GitParameterDefinition extends ParameterDefinition implements Comparable<GitParameterDefinition> {
private static final long serialVersionUID = 9157832967140868122L;

private static final String DEFAULT_LIST_SIZE = "5";
private static final String DEFAULT_REMOTE = "origin";
private static final String REFS_TAGS_PATTERN = ".*refs/tags/";

@@ -83,6 +85,7 @@
private SelectedValue selectedValue;
private String useRepository;
private Boolean quickFilterEnabled;
private String listSize;

@DataBoundConstructor
public GitParameterDefinition(String name, String type, String defaultValue, String description, String branch,
@@ -95,6 +98,7 @@ public GitParameterDefinition(String name, String type, String defaultValue, Str
this.sortMode = sortMode;
this.selectedValue = selectedValue;
this.quickFilterEnabled = quickFilterEnabled;
this.listSize = DEFAULT_LIST_SIZE;

setUseRepository(useRepository);
setType(type);
@@ -236,6 +240,15 @@ public void setBranchFilter(String branchFilter) {
this.branchFilter = branchFilter;
}

public String getListSize() {
return listSize == null ? DEFAULT_LIST_SIZE : listSize;
}

@DataBoundSetter
public void setListSize(String listSize) {
this.listSize = listSize;
}

public SelectedValue getSelectedValue() {
return selectedValue == null ? SelectedValue.TOP : selectedValue;
}
@@ -84,5 +84,9 @@
<f:entry title="${%parameter.quick.filter}" field="quickFilterEnabled">
<f:checkbox/>
</f:entry>

<f:entry title="${%parameter.list.size}" field="listSize">
<f:textbox default="5"/>
</f:entry>
</f:advanced>
</j:jelly>
@@ -13,3 +13,4 @@ parameter.default.value=Default Value
parameter.selected.value=Selected Value
parameter.use.repository=Use repository
parameter.quick.filter=Quick Filter
parameter.list.size=List Size
@@ -12,4 +12,5 @@ parameter.sort.mode=Rodzaj sortowania
parameter.default.value=Domy\u015Blna warto\u015B\u0107
parameter.selected.value=Zaznaczana warto\u015B\u0107
parameter.use.repository=U\u017Cyj repozytorium
parameter.quick.filter=Szybkie filtrowanie
parameter.quick.filter=Szybkie filtrowanie
parameter.list.size=Rozmiar Listy
@@ -0,0 +1,3 @@
<div>
Specify the number of items the list will display. A value of 0 will display as a DropDown list.
</div>
@@ -0,0 +1,3 @@
<div>
Indiquez le nombre d'éléments que la liste affichera. Une valeur de 0 s'affichera en tant que liste DropDown.
</div>
@@ -0,0 +1,3 @@
<div>
Określ liczbę elementów wyświetlanych na liście. Wartość 0 zostanie wyświetlona jako lista upuszczenia.
</div>
@@ -9,7 +9,7 @@
<div name="parameter" description="${it.description}" id="${divId}">
<st:adjunct includes="lib.form.select.select"/>
<input type="hidden" name="name" value="${it.name}"/>
<select name="value" class="select" size="5" style="min-width: 200px" id="select"
<select name="value" class="select" size="${it.listSize}" style="min-width: 200px" id="select"
fillUrl="${h.getCurrentDescriptorByNameUrl()}/${it.descriptor.descriptorUrl}/fillValueItems?param=${it.name}">
<option value="">${%retrieving.references}</option>
</select>

0 comments on commit 6526640

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