Skip to content

Commit ba73b44

Browse files
tulinkryVladimir Kotal
authored andcommitted
add opengrok version to the main page (#2576)
1 parent 68a610b commit ba73b44

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

opengrok-indexer/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ Portions Copyright (c) 2017-2018, Chris Fraire <[email protected]>.
202202
<version>2.2.4</version>
203203
<configuration>
204204
<includeOnlyProperties>
205-
<includeOnlyProperty>^git.commit.id$</includeOnlyProperty>
205+
<includeOnlyProperty>^git.commit.id</includeOnlyProperty>
206206
</includeOnlyProperties>
207207
</configuration>
208208
<executions>
@@ -257,6 +257,10 @@ Portions Copyright (c) 2017-2018, Chris Fraire <[email protected]>.
257257
${project.build.outputDirectory}/org/opengrok/indexer/info.properties
258258
</filesToInclude>
259259
<replacements>
260+
<replacement>
261+
<token>git.commit.id.abbrev</token>
262+
<value>changeset_short</value>
263+
</replacement>
260264
<replacement>
261265
<token>git.commit.id</token>
262266
<value>changeset</value>

opengrok-indexer/src/main/java/org/opengrok/indexer/Info.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public final class Info {
3737

3838
private static final String VERSION;
3939
private static final String REVISION;
40+
private static final String REVISION_SHORT;
4041

4142
static {
4243
try (InputStream in = Info.class.getResourceAsStream("info.properties")) {
@@ -45,13 +46,15 @@ public final class Info {
4546
}
4647
VERSION = properties.getProperty("version", "unknown");
4748
REVISION = properties.getProperty("changeset", "unknown");
49+
REVISION_SHORT = properties.getProperty("changeset_short", "unknown");
4850
} catch (IOException ioe) {
4951
throw new RuntimeException(ioe);
5052
}
5153
}
5254

5355
/**
5456
* get major version
57+
*
5558
* @return major version
5659
*/
5760
public static String getVersion() {
@@ -60,6 +63,7 @@ public static String getVersion() {
6063

6164
/**
6265
* get full version (product vMajor revMinor)
66+
*
6367
* @return full version
6468
*/
6569
public static String getFullVersion() {
@@ -68,12 +72,24 @@ public static String getFullVersion() {
6872

6973
/**
7074
* get minor version
75+
*
7176
* @return minor version
7277
*/
7378
public static String getRevision() {
7479
return REVISION;
7580
}
7681

82+
83+
/**
84+
* get short minor version
85+
*
86+
* @return short minor version
87+
*/
88+
public static String getShortRevision() {
89+
return REVISION_SHORT;
90+
}
91+
92+
7793
private Info() {
7894
}
7995
}

opengrok-indexer/src/main/java/org/opengrok/indexer/web/Util.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
import javax.servlet.http.HttpServletRequest;
6666
import org.json.simple.JSONArray;
6767
import org.json.simple.JSONObject;
68-
import org.opengrok.indexer.Info;
6968
import org.opengrok.indexer.configuration.Group;
7069
import org.opengrok.indexer.configuration.Project;
7170
import org.opengrok.indexer.configuration.RuntimeEnvironment;
@@ -372,19 +371,6 @@ private static boolean needsHtmlize(CharSequence q, boolean pre) {
372371
return false;
373372
}
374373

375-
private static final String versionP = htmlize(Info.getRevision());
376-
377-
/**
378-
* used by BUI - CSS needs this parameter for proper cache refresh (per
379-
* changeset) in client browser TODO jel: but useless, since the page cached
380-
* anyway.
381-
*
382-
* @return html escaped version (hg changeset)
383-
*/
384-
public static String versionParameter() {
385-
return versionP;
386-
}
387-
388374
/**
389375
* Convenience method for {@code breadcrumbPath(urlPrefix, path, PATH_SEPARATOR)}.
390376
*

opengrok-web/src/main/webapp/foot.jspf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
2020

2121
Portions Copyright 2011 Jens Elkner.
2222
--%><%@page import="
23-
java.util.EnumSet,
2423
java.util.Date,
24+
java.util.EnumSet,
2525

26+
org.opengrok.indexer.Info,
2627
org.opengrok.indexer.web.PageConfig,
2728
org.opengrok.indexer.web.Prefix"
28-
%><%!
29+
%>
30+
<%!
2931
/* ---------------------- foot.jspf members start --------------------- */
3032
private static EnumSet<Prefix> needAddDiv = EnumSet.of(
3133
Prefix.HIST_L, Prefix.XREF_P, Prefix.DIFF_P, Prefix.MORE_P,
@@ -41,7 +43,7 @@ org.opengrok.indexer.web.Prefix"
4143
%>
4244
<div id="footer">
4345
<p><a href="http://opengrok.github.com/OpenGrok/"
44-
title="Served by OpenGrok"><span id="fti"></span></a></p>
46+
title="Served by OpenGrok (<%= Info.getVersion() %> - <%= Info.getShortRevision() %>)"><span id="fti"></span></a></p>
4547
<% if(dateForLastIndexRun != null) { %>
4648
<p>Last Index update <%= dateForLastIndexRun %></p>
4749
<%}%>

0 commit comments

Comments
 (0)