Merge pull request #2485 from stephenc/jenkins-36996

[FIXED JENKINS-36996] Hide the Java Web Start launcher when the TCP agent port is disabled
This commit is contained in:
Stephen Connolly authored and GitHub committed 2016-07-27 19:42:23 +01:00
commit e7b39efff8
1 file changed
+30 -3
@@ -23,10 +23,13 @@
*/
package hudson.slaves;
import hudson.model.Descriptor;
import hudson.model.TaskListener;
import hudson.Util;
import hudson.Extension;
import hudson.Util;
import hudson.model.Descriptor;
import hudson.model.DescriptorVisibilityFilter;
import hudson.model.TaskListener;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
@@ -94,4 +97,28 @@ public class JNLPLauncher extends ComputerLauncher {
}
};
/**
* Hides the JNLP launcher when the JNLP agent port is not enabled.
* @since FIXME
*/
@Extension
public static class DescriptorVisibilityFilterImpl extends DescriptorVisibilityFilter {
/**
* {@inheritDoc}
*/
@Override
public boolean filter(@CheckForNull Object context, @Nonnull Descriptor descriptor) {
return descriptor.clazz != JNLPLauncher.class || Jenkins.getInstance().getTcpSlaveAgentListener() != null;
}
/**
* {@inheritDoc}
*/
@Override
public boolean filterType(@Nonnull Class<?> contextClass, @Nonnull Descriptor descriptor) {
return descriptor.clazz != JNLPLauncher.class || Jenkins.getInstance().getTcpSlaveAgentListener() != null;
}
}
}