Skip to content

Instantly share code, notes, and snippets.

@VladRassokhin
Created October 1, 2015 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VladRassokhin/80ede84f319bd739c05f to your computer and use it in GitHub Desktop.
Save VladRassokhin/80ede84f319bd739c05f to your computer and use it in GitHub Desktop.
TeamCity Build Feature with default values and radio buttons
<%@ include file="/include-internal.jsp" %>
<%@ taglib prefix="props" tagdir="/WEB-INF/tags/props" %>
<l:settingsGroup title="Sample Build Feature Parameters">
<tr>
<th>Radio chooser with default value</th>
<td>
<props:radioButtonProperty name="sample_radio" value="No"/>No<br/>
<props:radioButtonProperty name="sample_radio" value="New"/>New (default)<br/>
<props:radioButtonProperty name="sample_radio" value="All"/>All
</td>
</tr>
</l:settingsGroup>
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.sample.feature;
import java.util.HashMap;
import java.util.Map;
import jetbrains.buildServer.serverSide.BuildFeature;
import jetbrains.buildServer.web.openapi.PluginDescriptor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class SampleBuildFeature extends BuildFeature {
private final String myEditUrl;
public SampleBuildFeature(@NotNull final PluginDescriptor descriptor) {
myEditUrl = descriptor.getPluginResourcesPath("editSampleBuildFeature.jsp");
}
@NotNull
@Override
public String getType() {
return "SampleBuildFeature";
}
@NotNull
@Override
public String getDisplayName() {
return "Sample Build Feature";
}
@Nullable
@Override
public String getEditParametersUrl() {
return myEditUrl;
}
@Nullable
@Override
public Map<String, String> getDefaultParameters() {
final HashMap<String, String> map = new HashMap<String, String>();
map.put("sample_radio", "New"); // Note same name should be used in jsp and here
return map;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment