Permalink
Browse files

[FIXED JENKINS-22934] Show poll thread count option when necessary.

* Show the option when the configured value is not the default
* Show the option even when projects are in other ItemGroups
* Only consider AbstractProjects

(cherry picked from commit e4902e7)
  • Loading branch information...
daniel-beck authored and olivergondza committed May 8, 2014
1 parent 2f19b5c commit 7860c4e62003617c6fbb16d71c9eccfde9f10db7
@@ -46,6 +46,8 @@
import hudson.util.SequentialExecutionQueue;
import org.apache.commons.io.FileUtils;
import org.apache.commons.jelly.XMLOutput;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.DataBoundConstructor;

@@ -261,6 +263,15 @@ public void setPollingThreadCount(int n) {
resizeThreadPool();
}

@Restricted(NoExternalUse.class)
public boolean isPollingThreadCountOptionVisible() {
// unless you have a fair number of projects, this option is likely pointless.
// so let's hide this option for new users to avoid confusing them
// unless it was already changed
return Jenkins.getInstance().getAllItems(AbstractProject.class).size() > 10
|| getPollingThreadCount() != 0;
}

/**
* Update the {@link ExecutorService} instance.
*/
@@ -24,11 +24,7 @@ THE SOFTWARE.

<?jelly escape-by-default='true'?>
<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:if test="${app.items.size()>10}">
<!--
unless you have a fair number of projects, this option is likely pointless.
so let's hide this option for new users to avoid confusing them.
-->
<j:if test="${descriptor.pollingThreadCountOptionVisible}">
<f:section title="${%SCM Polling}">
<f:entry title="${%Max # of concurrent polling}" field="pollingThreadCount">
<f:number value="${descriptor.pollingThreadCount==0 ? '' : descriptor.pollingThreadCount}"

0 comments on commit 7860c4e

Please sign in to comment.