aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordmills2013-02-27 14:23:23 -0500
committerdmills2013-02-27 14:23:23 -0500
commitfba07b48c4571598db9a64f9996bd83683c80177 (patch)
treed81312c036a2311517d4a718f5ca69734cf31434
parent4ba3f62e51d09ae2c211fc72276260fda79b4cd6 (diff)
downloadorg.eclipse.hudson.core-privacy_decoration.zip
org.eclipse.hudson.core-privacy_decoration.tar.gz
org.eclipse.hudson.core-privacy_decoration.tar.xz
Implemented Instance Tag functionality for enhancement: 401754privacy_decoration
-rw-r--r--hudson-core/src/main/java/hudson/model/Hudson.java25
-rw-r--r--hudson-core/src/main/resources/hudson/model/Hudson/configure.jelly3
-rw-r--r--hudson-core/src/main/resources/lib/layout/layout.jelly13
-rw-r--r--hudson-core/src/main/resources/lib/layout/layout.properties1
-rw-r--r--hudson-war/src/main/webapp/help/system-config/instanceTag.html18
5 files changed, 56 insertions, 4 deletions
diff --git a/hudson-core/src/main/java/hudson/model/Hudson.java b/hudson-core/src/main/java/hudson/model/Hudson.java
index 2e6db68..e4b2b48 100644
--- a/hudson-core/src/main/java/hudson/model/Hudson.java
+++ b/hudson-core/src/main/java/hudson/model/Hudson.java
@@ -262,7 +262,13 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
* CopyRight, Confidentiality information and so forth
* Introduced Hudson 3.0.1
*/
- private String privacyMessage;
+ private String privacyMessage;
+
+ /**
+ * Optional identifier for the instance to be printed on each page
+ * Introduced Hudson 3.0.1
+ */
+ private String instanceTag;
private static transient final String HUDSON_WORKSPACES_PROPERTY_KEY = "HUDSON_WORKSPACES";
/**
@@ -1090,6 +1096,21 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
this.privacyMessage = message;
save();
}
+
+ /**
+ * Get the Instance identifier
+ */
+ public String getInstanceTag() {
+ return instanceTag;
+ }
+
+ /**
+ * Sets the Instance Identifier.
+ */
+ public void setInstanceTag(String name) throws IOException {
+ this.instanceTag = name;
+ save();
+ }
public FederatedLoginService getFederatedLoginService(String name) {
for (FederatedLoginService fls : FederatedLoginService.all()) {
@@ -2508,6 +2529,8 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
quietPeriod = json.getInt("quiet_period");
scmCheckoutRetryCount = json.getInt("retry_count");
+
+ instanceTag = json.optString("instance_tag","");
systemMessage = Util.nullify(req.getParameter("system_message"));
diff --git a/hudson-core/src/main/resources/hudson/model/Hudson/configure.jelly b/hudson-core/src/main/resources/hudson/model/Hudson/configure.jelly
index 96fb8be..c40b679 100644
--- a/hudson-core/src/main/resources/hudson/model/Hudson/configure.jelly
+++ b/hudson-core/src/main/resources/hudson/model/Hudson/configure.jelly
@@ -37,6 +37,9 @@
<f:entry title="${%Home directory}" help="/help/system-config/homeDirectory.html">
${it.rootDir}
</f:entry>
+ <f:entry title="${%Instance Tag}" help="/help/system-config/instanceTag.html">
+ <f:textbox name="instance_tag" value="${it.instanceTag}" />
+ </f:entry>
<f:entry title="${%System Message}" help="/help/system-config/systemMessage.html">
<f:textarea name="system_message" value="${it.systemMessage}" />
</f:entry>
diff --git a/hudson-core/src/main/resources/lib/layout/layout.jelly b/hudson-core/src/main/resources/lib/layout/layout.jelly
index 687a585..c02a0f3 100644
--- a/hudson-core/src/main/resources/lib/layout/layout.jelly
+++ b/hudson-core/src/main/resources/lib/layout/layout.jelly
@@ -66,8 +66,13 @@
<html>
<head>
${h.checkPermission(it,permission)}
+
+ <j:set var="titleSuffix" value=" [Hudson]"/>
+ <j:if test="${!empty(app.instanceTag)}">
+ <j:set var="titleSuffix" value=" [Hudson - ${app.instanceTag}]"/>
+ </j:if>
- <title>${h.appendIfNotNull(title, ' [Hudson]', 'Hudson')}</title>
+ <title>${h.appendIfNotNull(title, titleSuffix, 'Hudson')}</title>
<link rel="shortcut icon" href="${resURL}/favicon.ico" type="image/vnd.microsoft.icon" />
@@ -179,7 +184,7 @@
<table cellpadding="2" cellspacing="3" width="100%" border="0">
<tr>
<td class="instanceTagHeader">
- <!-- For future use -->
+ ${app.instanceTag}
</td>
<td style="vertical-align: middle; text-align: right; padding-right: 1em;">
<!-- search box -->
@@ -305,7 +310,9 @@
</tr>
<tr>
<td d="footer-left-panel" class="footer">
- <!-- For future use -->
+ <j:if test="${!empty(app.instanceTag)}">
+ ${%instance}: <em>${app.instanceTag}</em>
+ </j:if>
</td>
<td id="footer-center-panel" class="footer">
<j:out value="${app.privacyMessage}"/>
diff --git a/hudson-core/src/main/resources/lib/layout/layout.properties b/hudson-core/src/main/resources/lib/layout/layout.properties
index 6a26091..52c3c0b 100644
--- a/hudson-core/src/main/resources/lib/layout/layout.properties
+++ b/hudson-core/src/main/resources/lib/layout/layout.properties
@@ -17,3 +17,4 @@
searchBox.url=http://wiki.hudson-ci.org/display/HUDSON/Search+Box
logout=log out
poweredBy=Powered by Hudson Open Source Continuous Integration Server from the Eclipse Foundation
+instance=Instance
diff --git a/hudson-war/src/main/webapp/help/system-config/instanceTag.html b/hudson-war/src/main/webapp/help/system-config/instanceTag.html
new file mode 100644
index 0000000..0162631
--- /dev/null
+++ b/hudson-war/src/main/webapp/help/system-config/instanceTag.html
@@ -0,0 +1,18 @@
+<!-- **************************************************************************
+#
+# Copyright (C) 2013 Oracle Corporation
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Duncan Mills
+#
+#************************************************************************** -->
+
+<div>
+ If provided, this instance identifier will be printed in the header and footer of the Hudson Web UI.
+ This is useful to aid in the quick identification of a system when you are running multiple instances of Hudson.
+</div>