Skip to content
Permalink
Browse files
[FIXED JENKINS-20143] Pass full list of all possible jobs to ViewJobF…
…ilter when recurse option is set
  • Loading branch information
ndeloof committed Oct 22, 2013
1 parent f9f1483 commit 711558913410b82d4b2a95d1ff5bb2037f212f0c
Showing with 18 additions and 0 deletions.
  1. +4 −0 changelog.html
  2. +14 −0 core/src/main/java/hudson/model/ListView.java
@@ -56,6 +56,10 @@
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=>
<li class=bug>
Pass full list of all possible jobs to ViewJobFilter when recurse option is set
(a href="https://issues.jenkins-ci.org/browse/JENKINS-20123">issue 20123</a>)

This comment has been minimized.

Copy link
@jglick

jglick Oct 22, 2013

Member

Corrected in 82b6e8e.

</li>
</ul>
</div><!--=TRUNK-END=-->

@@ -175,6 +175,7 @@ public boolean hasJobFilterExtensions() {
// check the filters
Iterable<ViewJobFilter> jobFilters = getJobFilters();
List<TopLevelItem> allItems = new ArrayList<TopLevelItem>(parentItems);
if (recurse) allItems = expand(allItems, new ArrayList<TopLevelItem>());
for (ViewJobFilter jobFilter: jobFilters) {
items = jobFilter.filter(items, allItems, this);
}
@@ -183,6 +184,19 @@ public boolean hasJobFilterExtensions() {

return items;
}

private List<TopLevelItem> expand(Collection<TopLevelItem> items, List<TopLevelItem> allItems) {
for (Item item : items) {
if (item instanceof ItemGroup) {
ItemGroup<TopLevelItem> ig = (ItemGroup<TopLevelItem>) item;
expand(ig.getItems(), allItems);
}
if (item instanceof TopLevelItem) {
allItems.add((TopLevelItem) item);
}
}
return allItems;
}

@Override
public boolean contains(TopLevelItem item) {

1 comment on commit 7115589

@jglick

This comment has been minimized.

Copy link
Member

@jglick jglick commented on 7115589 Oct 22, 2013

OK…I will probably wind up rewriting this anyway for JENKINS-20052 (which still has an unresolved performance component), and there is no test here to demonstrate the correct behavior so I will still need to write one.

Please sign in to comment.