diff --git a/src/main/java/hudson/plugins/depgraph_view/DependencyGraphProperty.java b/src/main/java/hudson/plugins/depgraph_view/DependencyGraphProperty.java index 099dbbf..2ce4177 100644 --- a/src/main/java/hudson/plugins/depgraph_view/DependencyGraphProperty.java +++ b/src/main/java/hudson/plugins/depgraph_view/DependencyGraphProperty.java @@ -59,13 +59,15 @@ public static class DescriptorImpl extends Descriptor { private boolean graphvizEnabled = true; private boolean editFunctionInJSViewEnabled = false; - + private String projectNameStripRegex = ".*"; - + private int projectNameStripRegexGroup = 1; - + private int projectNameSuperscriptRegexGroup = -1; + private String graphRankDirection = "TB"; + public DescriptorImpl() { load(); } @@ -84,7 +86,7 @@ public boolean configure( StaplerRequest req, JSONObject o ) { setProjectNameStripRegex(o.optString("projectNameStripRegex", ".*")); setProjectNameStripRegexGroup(o.optInt("projectNameStripRegexGroup", 1)); setProjectNameSuperscriptRegexGroup(o.optInt("projectNameSuperscriptRegexGroup", 1)); - + setGraphRankDirection(o.optString("graphRankDirection", "TB")); save(); return true; @@ -119,6 +121,10 @@ public synchronized int getProjectNameSuperscriptRegexGroup() { return projectNameSuperscriptRegexGroup; } + public synchronized String getGraphRankDirection() { + return graphRankDirection; + } + /** * @return configured dot executable or a default */ @@ -144,7 +150,12 @@ public synchronized void setProjectNameStripRegex(String projectNameStripRegex) this.projectNameStripRegex = projectNameStripRegex; save(); } - + + public synchronized void setGraphRankDirection(String graphRankDirection) { + this.graphRankDirection = graphRankDirection; + save(); + } + public synchronized void setDotExe(String dotPath) { this.dotExe = dotPath; save(); @@ -154,7 +165,7 @@ public synchronized void setGraphvizEnabled(boolean graphvizEnabled) { this.graphvizEnabled = graphvizEnabled; save(); } - + public void setEditFunctionInJSViewEnabled(boolean editFunctionInJSViewEnabled) { this.editFunctionInJSViewEnabled = editFunctionInJSViewEnabled; save(); @@ -163,7 +174,7 @@ public void setEditFunctionInJSViewEnabled(boolean editFunctionInJSViewEnabled) public FormValidation doCheckDotExe(@QueryParameter final String value) { return FormValidation.validateExecutable(value); } - + public FormValidation doCheckProjectNameStripRegex(@QueryParameter final String value) throws IOException, ServletException { String pattern = Util.fixEmptyAndTrim(value); @@ -177,7 +188,7 @@ public FormValidation doCheckProjectNameStripRegex(@QueryParameter final String } return FormValidation.ok(); } - + public FormValidation doCheckProjectNameStripRegexGroup(@QueryParameter final String value) { return FormValidation.validatePositiveInteger(value); } diff --git a/src/main/java/hudson/plugins/depgraph_view/model/display/DotStringGenerator.java b/src/main/java/hudson/plugins/depgraph_view/model/display/DotStringGenerator.java index a8258ee..b98a80f 100644 --- a/src/main/java/hudson/plugins/depgraph_view/model/display/DotStringGenerator.java +++ b/src/main/java/hudson/plugins/depgraph_view/model/display/DotStringGenerator.java @@ -43,6 +43,8 @@ * Generates a dot string representation of the graph */ public class DotStringGenerator extends AbstractDotStringGenerator { + + private String rankDirection; private static final Function ESCAPE = new Function() { @Override public String apply(String from) { @@ -93,6 +95,7 @@ public DotStringGenerator(Jenkins jenkins, DependencyGraph graph, ListMultimap

+ + + diff --git a/src/main/resources/hudson/plugins/depgraph_view/DependencyGraphProperty/global.properties b/src/main/resources/hudson/plugins/depgraph_view/DependencyGraphProperty/global.properties index 7841157..e8ffbac 100644 --- a/src/main/resources/hudson/plugins/depgraph_view/DependencyGraphProperty/global.properties +++ b/src/main/resources/hudson/plugins/depgraph_view/DependencyGraphProperty/global.properties @@ -22,3 +22,4 @@ editFunctionInJSViewEnabled=Enable edit functiononality in jsplumb view projectNameStripRegex=Strip the project names +graphRankDirection=Graphviz rank direction \ No newline at end of file diff --git a/src/main/resources/hudson/plugins/depgraph_view/DependencyGraphProperty/help-graphRankDirection.html b/src/main/resources/hudson/plugins/depgraph_view/DependencyGraphProperty/help-graphRankDirection.html new file mode 100644 index 0000000..419b5cc --- /dev/null +++ b/src/main/resources/hudson/plugins/depgraph_view/DependencyGraphProperty/help-graphRankDirection.html @@ -0,0 +1,26 @@ + + +

+ The direction used by graphviz to layout graph nodes.
+ Can be set to TB (top to bottom) or LR (left to right), default is TB. +
\ No newline at end of file diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly index 080353d..888c381 100644 --- a/src/main/resources/index.jelly +++ b/src/main/resources/index.jelly @@ -30,5 +30,5 @@
This plugin shows a dependency graph of the projects. - It uses dot (from graphviz) for drawing. + It uses dot (from graphviz) or jsPlumb for drawing.