提交 3a5b72ce 编写于 作者: K Kohsuke Kawaguchi

[FIXED JENKINS-12490] auto-complete the copy new node page

上级 a2e6b592
......@@ -62,6 +62,9 @@ Upcoming changes</a>
<li class=bug>
month should not be 0.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-12356">issue 12356</a>)
<li class=bug>
"Create a new slave" page didn't auto-complete for copying.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-12490">issue 12490</a>)
<li class=bug>
Fixed a bug in the auto-overwrite of bundled plugins.
<li class=rfe>
......
......@@ -25,6 +25,7 @@ package hudson.model;
import hudson.BulkChange;
import hudson.DescriptorExtensionList;
import hudson.Extension;
import hudson.Util;
import hudson.XmlFile;
import hudson.model.Descriptor.FormException;
......@@ -59,7 +60,7 @@ import java.util.logging.Logger;
* @author Kohsuke Kawaguchi
*/
@ExportedBean
public final class ComputerSet extends AbstractModelObject {
public final class ComputerSet extends AbstractModelObject implements Describable<ComputerSet> {
/**
* This is the owner that persists {@link #monitors}.
*/
......@@ -298,7 +299,7 @@ public final class ComputerSet extends AbstractModelObject {
return FormValidation.error(e.getMessage());
}
}
/**
* Accepts submission from the configuration page.
*/
......@@ -333,6 +334,32 @@ public final class ComputerSet extends AbstractModelObject {
return new Api(this);
}
public Descriptor<ComputerSet> getDescriptor() {
return Jenkins.getInstance().getDescriptorOrDie(ComputerSet.class);
}
@Extension
public static class DescriptorImpl extends Descriptor<ComputerSet> {
@Override
public String getDisplayName() {
return "";
}
/**
* Auto-completion for the "copy from" field in the new job page.
*/
public AutoCompletionCandidates doAutoCompleteCopyNewItemFrom(@QueryParameter final String value) {
final AutoCompletionCandidates r = new AutoCompletionCandidates();
for (Node n : Jenkins.getInstance().getNodes()) {
if (n.getNodeName().startsWith(value))
r.add(n.getNodeName());
}
return r;
}
}
/**
* Just to force the execution of the static initializer.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册