提交 779e1134 编写于 作者: A Andrew Bayer

Added autocompletion to build after other textbox, and textboxes can now use...

Added autocompletion to build after other textbox, and textboxes can now use autocompletion without needing a true field via the autoCompleteField attribute.
上级 d6622b32
......@@ -89,6 +89,8 @@ Upcoming changes</a>
Introduced a behind-the-scene mechanism to simplify server/client communication through JavaScript proxies.
<li class=rfe>
Added an option to aggregated test results to include failed builds as well as passing and unstable builds.
<li class=rfe>
Added autocompletion to "Build after other projects" textbox, with support for "autoCompleteField" on textboxes without a true field.
</ul>
</div><!--=TRUNK-END=-->
......
/*
* The MIT License
*
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Brian Westrich, Erik Ramfelt, Ertan Deniz, Jean-Baptiste Quenot,
* Luca Domenico Milanesio, R. Tyler Ballance, Stephen Connolly, Tom Huybrechts,
* id:cactusman, Yahoo! Inc.
* id:cactusman, Yahoo! Inc., Andrew Bayer
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -1836,7 +1836,20 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
return FormValidation.ok();
}
public AutoCompletionCandidates doAutoCompleteAssignedLabelString(@QueryParameter String value) {
public AutoCompletionCandidates doAutoCompleteUpstreamProjects(@QueryParameter String value) {
AutoCompletionCandidates candidates = new AutoCompletionCandidates();
List<Job> jobs = Hudson.getInstance().getItems(Job.class);
for (Job job: jobs) {
if (job.getFullName().startsWith(value)) {
if (job.hasPermission(Item.READ)) {
candidates.add(job.getFullName());
}
}
}
return candidates;
}
public AutoCompletionCandidates doAutoCompleteAssignedLabelString(@QueryParameter String value) {
AutoCompletionCandidates c = new AutoCompletionCandidates();
Set<Label> labels = Hudson.getInstance().getLabels();
List<String> queries = new AutoCompleteSeeder(value).getSeeds();
......
<!--
The MIT License
Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Yahoo! Inc.
Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, Yahoo! Inc., Andrew Bayer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......@@ -30,6 +30,10 @@ THE SOFTWARE.
<st:attribute name="field">
Used for databinding. TBD.
</st:attribute>
<st:attribute name="autoCompleteField">
Used for determining the autocomplete URL.
If @field is specified, that will be used for this.
</st:attribute>
<st:attribute name="name">
This becomes @name of the &lt;input> tag.
If @field is specified, this value is inferred from it.
......@@ -67,7 +71,7 @@ THE SOFTWARE.
</st:attribute>
</st:documentation>
<f:prepareDatabinding />
${descriptor.calcAutoCompleteSettings(field,attrs)} <!-- this figures out the 'autoCompleteUrl' attribute -->
${descriptor.calcAutoCompleteSettings(autoCompleteField!=null?autoCompleteField:field,attrs)} <!-- this figures out the 'autoCompleteUrl' attribute -->
<!-- mostly pass-through all the attributes -->
<m:input xmlns:m="jelly:hudson.util.jelly.MorphTagLibrary"
......
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe, Andrew Bayer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......@@ -37,7 +37,8 @@ THE SOFTWARE.
<f:entry title="${%Projects names}"
description="${%Multiple projects can be specified like 'abc, def'}">
<f:textbox name="upstreamProjects" value="${h.getProjectListString(up)}"
checkUrl="'descriptorByName/BuildTrigger/check?value='+encodeURIComponent(this.value)"/>
checkUrl="'descriptorByName/BuildTrigger/check?value='+encodeURIComponent(this.value)"
autoCompleteField="upstreamProjects"/>
</f:entry>
</f:optionalBlock>
</j:jelly>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册