Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-40921][FIXED JENKINS-33020] Only display triggers that…
… make sense for a folder computation
  • Loading branch information
stephenc committed Mar 1, 2017
1 parent 359ae1f commit 9c378be
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
Expand Up @@ -49,6 +49,7 @@
import hudson.model.queue.CauseOfBlockage;
import hudson.model.queue.SubTask;
import hudson.security.ACL;
import hudson.triggers.TimerTrigger;
import hudson.triggers.Trigger;
import hudson.triggers.TriggerDescriptor;
import hudson.util.DescribableList;
Expand Down Expand Up @@ -110,7 +111,6 @@ public abstract class ComputedFolder<I extends TopLevelItem> extends AbstractFol
* Our {@link Trigger}s.
*/
private DescribableList<Trigger<?>,TriggerDescriptor> triggers;
// TODO p:config-triggers also expects there to be a BuildAuthorizationToken authToken option. Do we want one?

/**
* Our {@link FolderComputation}.
Expand Down Expand Up @@ -342,6 +342,17 @@ public Map<TriggerDescriptor,Trigger<?>> getTriggers() {
return triggers.toMap();
}

public List<TriggerDescriptor> getTriggerDescriptors() {
List<TriggerDescriptor> result = new ArrayList<TriggerDescriptor>();
for (TriggerDescriptor d: Trigger.for_(this)) {
if (d instanceof TimerTrigger.DescriptorImpl) {
continue;
}
result.add(d);
}
return result;
}

public void addTrigger(Trigger trigger) {
Trigger old = triggers.get(trigger.getDescriptor());
if (old != null) {
Expand Down
Expand Up @@ -26,7 +26,9 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form" xmlns:p="/lib/hudson/project">
<st:include page="configure-entries" optional="true"/>
<p:config-trigger/>
<f:descriptorList title="${%triggers(it.computation.displayName)}"
descriptors="${it.triggerDescriptors}"
instances="${it.triggers}"/>
<f:section title="${%Orphaned Item Strategy}">
<j:set var="orphanedItemStrategyDescriptors" value="${instance.orphanedItemStrategyDescriptors}"/>
<f:block>
Expand Down
@@ -0,0 +1,24 @@
#
# 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.
#
triggers={0} Triggers
@@ -1,4 +1,4 @@
ComputedFolder.already_computing=Already computing
FolderComputation.DisplayName=Folder Computation
ThrottleComputationQueueTaskDispatcher.MaxConcurrentIndexing=At maximum indexing capacity
PeriodicFolderTrigger.DisplayName=Periodically if not otherwise run
PeriodicFolderTrigger.DisplayName=Periodically if not otherwise run

0 comments on commit 9c378be

Please sign in to comment.