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 #9 from rodikal/master
JENKINS-14660 add support for Nested View plugin
- Loading branch information
Showing
2 changed files
with
53 additions
and
25 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
69 changes: 44 additions & 25 deletions
69
src/main/java/de/pellepelster/jenkins/walldisplay/WallDisplayTransientViewActionFactory.java
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 |
---|---|---|
@@ -1,25 +1,44 @@ | ||
package de.pellepelster.jenkins.walldisplay; | ||
|
||
import hudson.model.Action; | ||
import hudson.model.TransientViewActionFactory; | ||
import hudson.model.View; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Adds the walldisplay link action to all views | ||
* | ||
* @author Christian Pelster | ||
*/ | ||
public class WallDisplayTransientViewActionFactory extends TransientViewActionFactory { | ||
|
||
@Override | ||
public List<Action> createFor(View view) { | ||
|
||
List<Action> result = new ArrayList<Action>(); | ||
result.add(new WallDisplayViewAction(view.getViewName())); | ||
return result; | ||
|
||
} | ||
|
||
} | ||
package de.pellepelster.jenkins.walldisplay; | ||
|
||
import hudson.model.Action; | ||
import hudson.model.TransientViewActionFactory; | ||
import hudson.model.ViewGroup; | ||
import hudson.model.Hudson; | ||
import hudson.model.View; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
|
||
/** | ||
* Adds the walldisplay link action to all views | ||
* | ||
* @author Christian Pelster | ||
*/ | ||
public class WallDisplayTransientViewActionFactory extends TransientViewActionFactory { | ||
|
||
@Override | ||
public List<Action> createFor(final View view) { | ||
|
||
List<Action> result = new ArrayList<Action>(); | ||
String viewName = view.getViewName(); | ||
|
||
if (Hudson.getInstance().getPlugin("nested-view") != null) { | ||
ArrayList<String> viewNames = new ArrayList<String>(); | ||
viewNames.add(viewName); | ||
ViewGroup owner = view.getOwner(); | ||
while (owner instanceof hudson.plugins.nested_view.NestedView) { | ||
viewNames.add(((hudson.plugins.nested_view.NestedView) owner).getViewName()); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
Collections.reverse(viewNames); | ||
viewName = StringUtils.join(viewNames, "/view/"); | ||
} | ||
|
||
result.add(new WallDisplayViewAction(viewName)); | ||
return result; | ||
|
||
} | ||
|
||
} |
It seems that this line cause a OOM if a nested view contains another nested view (see https://issues.jenkins-ci.org/browse/JENKINS-15482)