import javax.ws.rs.GET;
import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
String getMemoryStatus()
throws ArchivaRestServiceException;
+ @Path( "currentServerTime/{locale}" )
+ @GET
+ @Produces( MediaType.TEXT_PLAIN )
+ @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
+ String getCurrentServerTime( @PathParam( "locale" ) String locale )
+ throws ArchivaRestServiceException;
+
}
import org.apache.archiva.rest.api.services.SystemStatusService;
import org.springframework.stereotype.Service;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
/**
* @author Olivier Lamy
* @since 1.4-M3
*/
-@Service("systemStatusService#rest")
+@Service( "systemStatusService#rest" )
public class DefaultSystemStatusService
implements SystemStatusService
{
{
return l / ( 1024 * 1024 ) + "M";
}
+
+ public String getCurrentServerTime( String locale )
+ throws ArchivaRestServiceException
+ {
+ SimpleDateFormat sdf = new SimpleDateFormat( "EEE, d MMM yyyy HH:mm:ss Z", new Locale( locale ) );
+ return sdf.format( new Date() );
+ }
}
screenChange();
var mainContent=$("#main-content");
mainContent.html($("#system-status-main").tmpl());
- mainContent.find("#status_memory_info" ).html(smallSpinnerImg());
$.ajax("restServices/archivaServices/systemStatusService/memoryStatus", {
type: "GET",
dataType: "text",
success: function(data){
var memUsage = data;
$.log("memUsage:"+memUsage);
- mainContent.find("#status_memory_info" ).html($("#memory-info-tmpl" ).tmpl({memoryUsage: memUsage}));
+ mainContent.find("#status_memory_info" ).html(memUsage);
+ }
+ });
+ $.ajax("restServices/archivaServices/systemStatusService/currentServerTime/"+encodeURIComponent(usedLang()), {
+ type: "GET",
+ dataType: "text",
+ success: function(data){
+ var curTime=data;
+ $.log("currentServerTime:"+curTime);
+ mainContent.find("#status_current_time").html(curTime);
}
});
}
$(function() {
// load i18n resources from rest call
- var browserLang = $.i18n.browserLang();
- var requestLang = $.urlParam('request_lang');
- if (requestLang) {
- browserLang=requestLang;
+ usedLang=function(){
+ var browserLang = $.i18n.browserLang();
+ var requestLang = $.urlParam('request_lang');
+ if (requestLang) {
+ browserLang=requestLang;
+ }
+ return browserLang;
}
+
+ var browserLang = usedLang();
$.log("use browserLang:"+browserLang);
// -- archiva
// load default
<h4>${$.i18n.prop('system-status.header.queues')}</h4>
</div>
<div id="status_queues">
- Queues
+ <img src="images/small-spinner.gif"/>
</div>
<div class="page-header">
<h4>${$.i18n.prop('system-status.header.scanning')}</h4>
</div>
<div id="status_scanning">
- repos scanning
+ <img src="images/small-spinner.gif"/>
</div>
<div class="page-header">
<h4>${$.i18n.prop('system-status.header.caches')}</h4>
</div>
<div id="status_caches">
- caches
+ <img src="images/small-spinner.gif"/>
</div>
<div class="page-header">
<h4>${$.i18n.prop('system-status.header.memory')}</h4>
</div>
<div id="status_memory_info">
- memory
+ <img src="images/small-spinner.gif"/>
</div>
<div class="page-header">
<h4>${$.i18n.prop('system-status.header.current.time')}</h4>
</div>
- <div div="status_current_time">
- current time
+ <div id="status_current_time">
+ <img src="images/small-spinner.gif"/>
</div>
<div class="page-header">
<h4>${$.i18n.prop('system-status.header.version.info')}</h4>
</div>
<div id="status_version_info">
- version info
+ <img src="images/small-spinner.gif"/>
</div>
</script>
-<div id="memory-info-tmpl">
- ${memoryUsage}
-</div>
+