Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
225 additions
and 4 deletions.
- +68 −2 src/main/java/jenkins/scm/impl/form/NamedArrayList.java
- +51 −0 src/main/java/jenkins/scm/impl/trait/Discovery.java
- +1 −0 src/main/java/jenkins/scm/impl/trait/RegexSCMHeadFilterTrait.java
- +1 −0 src/main/java/jenkins/scm/impl/trait/RegexSCMSourceFilterTrait.java
- +46 −0 src/main/java/jenkins/scm/impl/trait/Selection.java
- +1 −0 src/main/java/jenkins/scm/impl/trait/WildcardSCMHeadFilterTrait.java
- +1 −0 src/main/java/jenkins/scm/impl/trait/WildcardSCMSourceFilterTrait.java
- +2 −2 src/main/resources/jenkins/scm/api/form/traits.jelly
- +4 −0 src/main/resources/jenkins/scm/api/form/traits/traits.css
- +50 −0 src/main/resources/jenkins/scm/api/form/traits/traits.js
@@ -0,0 +1,51 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2017, CloudBees, 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. | ||
*/ | ||
|
||
package jenkins.scm.impl.trait; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import jenkins.scm.api.SCMSource; | ||
import jenkins.scm.api.mixin.TagSCMHead; | ||
import jenkins.scm.api.trait.SCMNavigatorTrait; | ||
import jenkins.scm.api.trait.SCMSourceTrait; | ||
import jenkins.scm.api.trait.SCMTraitDescriptor; | ||
|
||
/** | ||
* Annotation to apply to {@link SCMTraitDescriptor} types that are control the initial scope of discovery. For example | ||
* a {@link SCMSourceTrait} that will enable the discovery of {@link TagSCMHead} instances on its {@link SCMSource} | ||
* or a {@link SCMNavigatorTrait} that will enable the discovery of projects from a "forks". | ||
* | ||
* @since 2.2.0 | ||
*/ | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Documented | ||
@Inherited | ||
public @interface Discovery { | ||
} |
@@ -0,0 +1,46 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2017, CloudBees, 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. | ||
*/ | ||
|
||
package jenkins.scm.impl.trait; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import jenkins.scm.api.trait.SCMTraitDescriptor; | ||
|
||
/** | ||
* Annotation to apply to {@link SCMTraitDescriptor} types that are pure filters. These traits will restrict the | ||
* effective discovery | ||
* | ||
* @since 2.2.0 | ||
*/ | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Documented | ||
@Inherited | ||
public @interface Selection { | ||
} |
@@ -0,0 +1,50 @@ | ||
(function () { | ||
var traitSectionRule = function (e) { | ||
e = $(e); | ||
var p = $(e.previousSibling); | ||
var n = $(e.nextSibling); | ||
var empty = (!n || n.hasClassName("trait-section") || n.hasClassName("repeatable-insertion-point")); | ||
// find any previous entries | ||
while (p && p.hasClassName("trait-section")) { | ||
p = $(p.previousSibling); | ||
} | ||
if (!empty) { | ||
// skip our entries | ||
while (n && !n.hasClassName("trait-section") && !n.hasClassName("repeatable-insertion-point")) { | ||
n = $(n.nextSibling); | ||
} | ||
} | ||
// find next section entries | ||
while (n && n.hasClassName("trait-section") && !n.hasClassName("repeatable-insertion-point")) { | ||
n = $(n.nextSibling); | ||
} | ||
if ((!p && n.hasClassName("repeatable-insertion-point")) || empty) { | ||
e.addClassName("trait-section-empty"); | ||
} else { | ||
e.removeClassName("trait-section-empty"); | ||
} | ||
}; | ||
Behaviour.specify("DIV.trait-container", 'traits', -50, function (e) { | ||
e = $(e); | ||
if (isInsideRemovable(e)) { | ||
return; | ||
} | ||
layoutUpdateCallback.add(function () { | ||
findElementsBySelector(e, ".trait-section").each(traitSectionRule); | ||
}) | ||
}); | ||
Behaviour.specify(".repeatable-delete", 'traits', 500, function (e) { | ||
var c = findAncestorClass(e, "trait-container"); | ||
if (c) { | ||
var btn = YAHOO.widget.Button.getButton(e.id); | ||
if (btn) { | ||
btn.on("click", function () { | ||
window.setTimeout(function () { | ||
findElementsBySelector(c, ".trait-section").each(traitSectionRule); | ||
}, 250); | ||
}); | ||
} | ||
} | ||
}); | ||
})(); | ||
|