Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from jglick/branch-property-filtering-JENKINS-…
…32670 [JENKINS-32670] Multibranch Pipelines have no applicable branch properties
- Loading branch information
Showing
4 changed files
with
87 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/main/resources/lib/branch-api/dropdownDescriptorSelector.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!-- | ||
The MIT License | ||
Copyright (c) 2010, InfraDNA, Inc. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
--> | ||
<!-- TODO 1.645+ use standard /lib/form version --> | ||
<?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"> | ||
<st:documentation> | ||
Renders a single <select> control for choosing a Describable. | ||
Depending on the currently selected value, its config.jelly will be | ||
rendered below <select, allowing the user to configure Describable. | ||
|
||
<st:attribute name="field" use="required"> | ||
form field name. Used for databinding. | ||
</st:attribute> | ||
<st:attribute name="title" use="required"> | ||
Human readable title of this control. | ||
</st:attribute> | ||
<st:attribute name="descriptors"> | ||
Collection that lists up all the valid candidate descriptors. | ||
If unspecified, inferred from the type of the field. | ||
</st:attribute> | ||
<st:attribute name="default"> | ||
If specified, this will be chosen as the default value in case the current selection is null. The default can be an specific instance or a descriptor e.g. | ||
${descriptor.defaultSettingsProvider} or ${descriptor.defaultSettingsProvider.descriptor}. In the later case, the from input fields will be empty. | ||
</st:attribute> | ||
<st:attribute name="capture"> | ||
Config fragments from descriptors are rendered lazily by default, which means | ||
variables seen in the caller aren't visible to them. This attribute allows you | ||
to nominate additional variables and their values to be captured for descriptors. | ||
</st:attribute> | ||
</st:documentation> | ||
<f:prepareDatabinding /> | ||
<j:set target="${attrs}" property="descriptors" value="${attrs.descriptors ?: descriptor.getPropertyType(instance,attrs.field).getApplicableDescriptors()}" /> | ||
|
||
<f:dropdownList name="${attrs.field}" title="${attrs.title}" help="${descriptor.getHelpFile(attrs.field)}"> | ||
<d:invokeBody /> | ||
|
||
<j:set var="current" value="${instance[attrs.field]}"/> | ||
<j:set var="current" value="${current!=null ? current : (default.descriptor!=null ? default : null)}"/> | ||
<j:set var="capture" value="${attrs.capture?:''}" /> | ||
<j:forEach var="descriptor" items="${attrs.descriptors}" varStatus="loop"> | ||
<f:dropdownListBlock value="${loop.index}" title="${descriptor.displayName}" | ||
selected="${current.descriptor==descriptor || (current==null and descriptor==attrs.default)}" staplerClass="${descriptor.clazz.name}" | ||
lazy="descriptor,it,${capture}"> | ||
<l:ajax> | ||
<j:set var="instance" value="${current.descriptor==descriptor ? current : null}" /> | ||
<st:include from="${descriptor}" page="${descriptor.configPage}" optional="true" /> | ||
</l:ajax> | ||
</f:dropdownListBlock> | ||
</j:forEach> | ||
</f:dropdownList> | ||
</j:jelly> |