From 104ea7654db56e7fb906d691fc53aa3ad16fbb0a Mon Sep 17 00:00:00 2001 From: kohsuke Date: Mon, 13 Jul 2009 18:51:29 +0000 Subject: [PATCH] The default view is now configurable. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@19667 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/model/AllView.java | 5 +++++ core/src/main/java/hudson/model/Hudson.java | 2 ++ core/src/main/java/hudson/model/View.java | 11 +++++++++++ .../resources/hudson/model/Hudson/configure.jelly | 13 +++++++++++++ .../resources/hudson/model/View/sidepanel.jelly | 5 ++++- war/resources/help/project-config/defaultView.html | 5 +++++ 6 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 war/resources/help/project-config/defaultView.html diff --git a/core/src/main/java/hudson/model/AllView.java b/core/src/main/java/hudson/model/AllView.java index f4f2bb2bca..a65f87c41c 100644 --- a/core/src/main/java/hudson/model/AllView.java +++ b/core/src/main/java/hudson/model/AllView.java @@ -51,6 +51,11 @@ public class AllView extends View { return Hudson.getInstance().getDescription(); } + @Override + public boolean isEditable() { + return false; + } + @Override public boolean contains(TopLevelItem item) { return true; diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index 2baac871a2..da771f6980 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -2181,6 +2181,8 @@ public final class Hudson extends Node implements ItemGroup, Stapl } else { setCrumbIssuer(null); } + + primaryView = json.has("primaryView") ? json.getString("primaryView") : getViews().iterator().next().getViewName(); noUsageStatistics = json.has("usageStatisticsCollected") ? null : true; diff --git a/core/src/main/java/hudson/model/View.java b/core/src/main/java/hudson/model/View.java index 96a4a48af4..0576e9345f 100644 --- a/core/src/main/java/hudson/model/View.java +++ b/core/src/main/java/hudson/model/View.java @@ -172,6 +172,17 @@ public abstract class View extends AbstractModelObject implements AccessControll return getViewName(); } + /** + * By default, return true to render the "Edit view" link on the page. + * This method is really just for the default "All" view to hide the edit link + * so that the default Hudson top page remains the same as before 1.316. + * + * @since 1.316 + */ + public boolean isEditable() { + return true; + } + /** * Gets the {@link Widget}s registered on this object. * diff --git a/core/src/main/resources/hudson/model/Hudson/configure.jelly b/core/src/main/resources/hudson/model/Hudson/configure.jelly index 01a73f677d..7a5e544e6d 100644 --- a/core/src/main/resources/hudson/model/Hudson/configure.jelly +++ b/core/src/main/resources/hudson/model/Hudson/configure.jelly @@ -56,6 +56,19 @@ THE SOFTWARE. + + + + + + + + + + + - diff --git a/war/resources/help/project-config/defaultView.html b/war/resources/help/project-config/defaultView.html new file mode 100644 index 0000000000..9a7b3e8aef --- /dev/null +++ b/war/resources/help/project-config/defaultView.html @@ -0,0 +1,5 @@ +
+ If you have multiple views defined, you can choose the one to be used as the Hudson top page. + This is useful for larger Hudson deployments where the 'All' view is too long to be a practical view. + (Choosing another view as the default allows you to delete the 'All' view, if so desired.) +
\ No newline at end of file