Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 Jul 2, 2014
1 parent 2f19b5c commit 7860c4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 11 additions & 0 deletions core/src/main/java/hudson/triggers/SCMTrigger.java
Expand Up @@ -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;

Expand Down Expand Up @@ -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.
*/
Expand Down
Expand Up @@ -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}"
Expand Down

0 comments on commit 7860c4e

Please sign in to comment.