mirror of https://github.com/apache/archiva.git
[MRM-1580] system status page display version infos.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1299632 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b91790c532
commit
135fe5f01f
|
@ -27,6 +27,9 @@ import org.springframework.stereotype.Service;
|
|||
import javax.inject.Inject;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.ws.rs.core.Context;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
|
@ -49,13 +52,17 @@ public class DefaultRuntimeInfoService
|
|||
this.archivaRuntimeInfo = archivaRuntimeInfo;
|
||||
}
|
||||
|
||||
public ApplicationRuntimeInfo getApplicationRuntimeInfo()
|
||||
public ApplicationRuntimeInfo getApplicationRuntimeInfo( String locale )
|
||||
{
|
||||
ApplicationRuntimeInfo applicationRuntimeInfo = new ApplicationRuntimeInfo();
|
||||
applicationRuntimeInfo.setBuildNumber( this.archivaRuntimeInfo.getBuildNumber() );
|
||||
applicationRuntimeInfo.setTimestamp( this.archivaRuntimeInfo.getTimestamp() );
|
||||
applicationRuntimeInfo.setVersion( this.archivaRuntimeInfo.getVersion() );
|
||||
applicationRuntimeInfo.setBaseUrl( getBaseUrl( httpServletRequest ) );
|
||||
|
||||
SimpleDateFormat sfd = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssz", new Locale( locale ) );
|
||||
applicationRuntimeInfo.setTimestampStr( sfd.format( new Date( archivaRuntimeInfo.getTimestamp() ) ) );
|
||||
|
||||
return applicationRuntimeInfo;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
|
|||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
@ -34,11 +35,11 @@ import javax.ws.rs.core.MediaType;
|
|||
@Path( "/runtimeInfoService/" )
|
||||
public interface RuntimeInfoService
|
||||
{
|
||||
@Path( "archivaRuntimeInfo" )
|
||||
@Path( "archivaRuntimeInfo/{locale}" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
||||
@RedbackAuthorization( noRestriction = true )
|
||||
ApplicationRuntimeInfo getApplicationRuntimeInfo();
|
||||
ApplicationRuntimeInfo getApplicationRuntimeInfo( @PathParam( "locale" ) String locale );
|
||||
|
||||
|
||||
@Path( "logMissingI18n" )
|
||||
|
|
|
@ -44,6 +44,7 @@ public class ApplicationRuntimeInfo
|
|||
|
||||
private String baseUrl;
|
||||
|
||||
private String timestampStr;
|
||||
|
||||
public ApplicationRuntimeInfo()
|
||||
{
|
||||
|
@ -136,6 +137,16 @@ public class ApplicationRuntimeInfo
|
|||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public String getTimestampStr()
|
||||
{
|
||||
return timestampStr;
|
||||
}
|
||||
|
||||
public void setTimestampStr( String timestampStr )
|
||||
{
|
||||
this.timestampStr = timestampStr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
@ -149,6 +160,7 @@ public class ApplicationRuntimeInfo
|
|||
sb.append( ", copyrightRange='" ).append( copyrightRange ).append( '\'' );
|
||||
sb.append( ", logMissingI18n=" ).append( logMissingI18n );
|
||||
sb.append( ", baseUrl='" ).append( baseUrl ).append( '\'' );
|
||||
sb.append( ", timestampStr='" ).append( timestampStr ).append( '\'' );
|
||||
sb.append( '}' );
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
@ -44,61 +44,11 @@
|
|||
|
||||
|
||||
<script type="text/javascript">
|
||||
appendArchivaVersion=function(){
|
||||
return "_archivaVersion="+window.archivaRuntimeInfo.version;
|
||||
}
|
||||
buildLoadJsUrl=function(srcScript){
|
||||
return srcScript+"?"+appendArchivaVersion();
|
||||
}
|
||||
$.ajax(
|
||||
{
|
||||
url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo",
|
||||
dataType: 'json',
|
||||
success:function(data){
|
||||
window.archivaDevMode=data.applicationRuntimeInfo.devMode;
|
||||
window.archivaJavascriptLog=data.applicationRuntimeInfo.javascriptLog;
|
||||
window.archivaRuntimeInfo=data.applicationRuntimeInfo;
|
||||
require.config({
|
||||
baseUrl: "js/"
|
||||
});
|
||||
// CacheBust is for dev purpose use false in prod env !
|
||||
var options = {
|
||||
AlwaysPreserveOrder:true,
|
||||
BasePath:"js/",
|
||||
explicit_preloading:false,
|
||||
CacheBust:window.archivaDevMode
|
||||
};
|
||||
$LAB.setGlobalDefaults(options);
|
||||
$LAB
|
||||
.script(buildLoadJsUrl("jquery.tmpl.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/utils.js")).wait()
|
||||
.script("jquery.i18n.properties-1.0.9.js").wait()
|
||||
.script(buildLoadJsUrl("archiva/i18nload.js")).wait()
|
||||
.script("jquery.cookie.1.0.0.js").wait()
|
||||
.script(buildLoadJsUrl("knockout-debug.js")).wait()
|
||||
.script("jquery-ui-1.8.16.custom.min.js").wait()
|
||||
.script(buildLoadJsUrl("jquery.validate.js")).wait()
|
||||
.script("jquery.json-2.3.min.js").wait()
|
||||
.script(buildLoadJsUrl("archiva/main-tmpl.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/repositories.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/network-proxies.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/proxy-connectors.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/operation.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/redback-tmpl.js")).wait()
|
||||
.script(buildLoadJsUrl("bootstrap.js"))
|
||||
.script(buildLoadJsUrl("knockout.simpleGrid.js"))
|
||||
//.script("knockout.mapping-latest.debug.js")
|
||||
.script(buildLoadJsUrl("redback/user.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/users.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/redback.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/register.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/permission.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/resource.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/roles.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/main.js"));
|
||||
}
|
||||
})
|
||||
$(function() {
|
||||
loadJs();
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
<script type="text/javascript" src="js/lab.js"></script>
|
||||
<script type="text/javascript" src="js/require.1.0.1.js"></script>
|
||||
<script type="text/javascript" src="js/jquery.i18n.properties-1.0.9.js"></script>
|
||||
<script type="text/javascript" src="js/archiva/startup.js"></script>
|
||||
<title>Apache Archiva</title>
|
||||
|
||||
</head>
|
||||
|
@ -45,70 +47,12 @@
|
|||
|
||||
|
||||
<script type="text/javascript">
|
||||
appendArchivaVersion=function(){
|
||||
return "_archivaVersion="+window.archivaRuntimeInfo.version;
|
||||
}
|
||||
buildLoadJsUrl=function(srcScript){
|
||||
return srcScript+"?"+appendArchivaVersion();
|
||||
}
|
||||
|
||||
$.ajaxSetup({
|
||||
dataType: 'json'
|
||||
});
|
||||
$(function() {
|
||||
loadJs();
|
||||
});
|
||||
|
||||
|
||||
$.ajax(
|
||||
{
|
||||
url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo",
|
||||
dataType: 'json',
|
||||
success:function(data){
|
||||
window.archivaDevMode=data.devMode;
|
||||
window.archivaJavascriptLog=data.javascriptLog;
|
||||
window.archivaRuntimeInfo=data;
|
||||
require.config({
|
||||
baseUrl: "js/"
|
||||
});
|
||||
// CacheBust is for dev purpose use false in prod env !
|
||||
var options = {
|
||||
AlwaysPreserveOrder:true,
|
||||
BasePath:"js/",
|
||||
explicit_preloading:false,
|
||||
CacheBust:window.archivaDevMode
|
||||
};
|
||||
$LAB.setGlobalDefaults(options);
|
||||
$LAB
|
||||
.script(buildLoadJsUrl("jquery.tmpl.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/utils.js")).wait()
|
||||
.script("jquery.i18n.properties-1.0.9.js").wait()
|
||||
.script(buildLoadJsUrl("archiva/i18nload.js")).wait()
|
||||
.script("jquery.cookie.1.0.0.js").wait()
|
||||
.script(buildLoadJsUrl("knockout-debug.js")).wait()
|
||||
.script("jquery-ui-1.8.16.custom.min.js").wait()
|
||||
.script(buildLoadJsUrl("jquery.validate.js")).wait()
|
||||
.script("jquery.json-2.3.min.js").wait()
|
||||
.script(buildLoadJsUrl("archiva/main-tmpl.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/general-admin.js"))
|
||||
.script(buildLoadJsUrl("archiva/repositories.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/network-proxies.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/proxy-connectors.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/operation.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/repository-groups.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/search.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/redback-tmpl.js")).wait()
|
||||
.script("chosen.jquery.js" )
|
||||
.script("bootstrap.2.0.1.js" )
|
||||
.script(buildLoadJsUrl("knockout.simpleGrid.js"))
|
||||
.script(buildLoadJsUrl("knockout-sortable.js"))
|
||||
//.script("knockout.mapping-latest.debug.js")
|
||||
.script(buildLoadJsUrl("redback/user.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/users.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/redback.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/register.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/permission.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/resource.js")).wait()
|
||||
.script(buildLoadJsUrl("redback/roles.js")).wait()
|
||||
.script(buildLoadJsUrl("archiva/main.js"));
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -584,6 +584,10 @@ $(function() {
|
|||
mainContent.find("#status_current_time").html(curTime);
|
||||
}
|
||||
});
|
||||
|
||||
var versionInfo="Build number: "+window.archivaRuntimeInfo.buildNumber+" - Build Timestamp: "+window.archivaRuntimeInfo.timestampStr;
|
||||
mainContent.find("#status_version_info").html(versionInfo);
|
||||
|
||||
}
|
||||
|
||||
});
|
|
@ -20,14 +20,7 @@
|
|||
$(function() {
|
||||
// load i18n resources from rest call
|
||||
|
||||
usedLang=function(){
|
||||
var browserLang = $.i18n.browserLang();
|
||||
var requestLang = $.urlParam('request_lang');
|
||||
if (requestLang) {
|
||||
browserLang=requestLang;
|
||||
}
|
||||
return browserLang;
|
||||
}
|
||||
|
||||
|
||||
var browserLang = usedLang();
|
||||
$.log("use browserLang:"+browserLang);
|
||||
|
|
|
@ -31,18 +31,6 @@ $.log = (function(message) {
|
|||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* return value of a param in the url
|
||||
* @param name
|
||||
*/
|
||||
$.urlParam = function(name){
|
||||
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
|
||||
if (results) {
|
||||
return results[1] || 0;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* display a success message
|
||||
* @param text the success text
|
||||
|
|
|
@ -198,25 +198,24 @@ public abstract class AbstractActionSupport
|
|||
|
||||
public String getArchivaVersion()
|
||||
{
|
||||
return archivaRuntimeInfo.getVersion(); //(String) archivaRuntimeProperties.get( "archiva.version" );
|
||||
return archivaRuntimeInfo.getVersion();
|
||||
}
|
||||
|
||||
public String getArchivaBuildNumber()
|
||||
{
|
||||
return archivaRuntimeInfo.getBuildNumber();// (String) archivaRuntimeProperties.get( "archiva.buildNumber" );
|
||||
return archivaRuntimeInfo.getBuildNumber();
|
||||
}
|
||||
|
||||
public String getArchivaBuildTimestamp()
|
||||
{
|
||||
return Long.toString(
|
||||
archivaRuntimeInfo.getTimestamp() ); //(String) archivaRuntimeProperties.get( "archiva.timestamp" );
|
||||
archivaRuntimeInfo.getTimestamp() );
|
||||
}
|
||||
|
||||
public String getArchivaBuildTimestampDateStr()
|
||||
{
|
||||
SimpleDateFormat sfd = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssz", getLocale() );
|
||||
return sfd.format( new Date( archivaRuntimeInfo.getTimestamp() ) );
|
||||
//new Date( NumberUtils.createLong( (String) archivaRuntimeProperties.get( "archiva.timestamp" ) ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue