[MRM-1580] system status page button to refresh some stats.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1299908 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-12 22:26:33 +00:00
parent 56ed8dbfef
commit 40750437f3
3 changed files with 79 additions and 23 deletions

View File

@ -0,0 +1,41 @@
package org.apache.archiva.rest.services.utils;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.archiva.rest.api.model.ConsumerScanningStatistics;
import java.util.Comparator;
/**
* @author Olivier Lamy
*/
public class ConsumerScanningStatisticsComparator
implements Comparator<ConsumerScanningStatistics>
{
public static final ConsumerScanningStatisticsComparator INSTANCE = new ConsumerScanningStatisticsComparator();
public int compare( ConsumerScanningStatistics one, ConsumerScanningStatistics two )
{
if ( one == two )
{
return 0;
}
return one.getConsumerKey().compareTo( two.getConsumerKey() );
}
}

View File

@ -594,11 +594,13 @@ $(function() {
}
displayCacheEntries=function(){
var divContent = $("#main-content #status_caches");
divContent.html(smallSpinnerImg());
$.ajax("restServices/archivaServices/systemStatusService/cacheEntries", {
type: "GET",
success: function(data){
var cacheEntries=mapCacheEntries(data);
$("#main-content #status_caches").html($("#status_caches_tmpl" ).tmpl({cacheEntries: cacheEntries}));
divContent.html($("#status_caches_tmpl" ).tmpl({cacheEntries: cacheEntries}));
}
});
}
@ -655,6 +657,33 @@ $(function() {
this.newFileCount=newFileCount;
}
displayScanningStats=function(){
var divContent = $("#main-content #status_scanning");
divContent.html(smallSpinnerImg());
$.ajax("restServices/archivaServices/systemStatusService/repositoryScannerStatistics", {
type: "GET",
success: function(data){
var stats= mapRepositoryScannerStatisticsList(data);
$.log("size:"+data.length);
divContent.html($("#status_scanning_tmpl").tmpl({repositoryScannerStatisticsList:stats}));
}
});
}
displayMemoryUsage=function(){
var divContent = $("#main-content #status_memory_info");
divContent.html(smallSpinnerImg());
$.ajax("restServices/archivaServices/systemStatusService/memoryStatus", {
type: "GET",
dataType: "text",
success: function(data){
var memUsage = data;
$.log("memUsage:"+memUsage);
divContent.html(memUsage);
}
});
}
displaySystemStatus=function(){
screenChange();
var mainContent=$("#main-content");
@ -664,15 +693,8 @@ $(function() {
+" - "+$.i18n.prop('system-status.header.version.timestampStr')+": "+window.archivaRuntimeInfo.timestampStr;
mainContent.find("#status_version_info").html(versionInfo);
$.ajax("restServices/archivaServices/systemStatusService/memoryStatus", {
type: "GET",
dataType: "text",
success: function(data){
var memUsage = data;
$.log("memUsage:"+memUsage);
mainContent.find("#status_memory_info" ).html(memUsage);
}
});
displayMemoryUsage();
$.ajax("restServices/archivaServices/systemStatusService/currentServerTime/"+encodeURIComponent(usedLang()), {
type: "GET",
dataType: "text",
@ -691,14 +713,7 @@ $(function() {
}
});
$.ajax("restServices/archivaServices/systemStatusService/repositoryScannerStatistics", {
type: "GET",
success: function(data){
var stats= mapRepositoryScannerStatisticsList(data);
$.log("size:"+data.length);
mainContent.find("#status_scanning" ).html($("#status_scanning_tmpl").tmpl({repositoryScannerStatisticsList:stats}));
}
});
displayScanningStats();
displayCacheEntries();
}

View File

@ -322,21 +322,21 @@
</div>
<div class="page-header">
<h4>${$.i18n.prop('system-status.header.scanning')}</h4>
<h4>${$.i18n.prop('system-status.header.scanning')}&nbsp;<a href="#" onclick="displayScanningStats()"><img src="images/view-refresh.png"/></a></h4>
</div>
<div id="status_scanning">
<img src="images/small-spinner.gif"/>
</div>
<div class="page-header">
<h4>${$.i18n.prop('system-status.header.caches')}</h4>
<h4>${$.i18n.prop('system-status.header.caches')}&nbsp;<a href="#" onclick="displayCacheEntries()"><img src="images/view-refresh.png"/></a></h4>
</div>
<div id="status_caches">
<img src="images/small-spinner.gif"/>
</div>
<div class="page-header">
<h4>${$.i18n.prop('system-status.header.memory')}</h4>
<h4>${$.i18n.prop('system-status.header.memory')}&nbsp;<a href="#" onclick="displayMemoryUsage()"><img src="images/view-refresh.png"/></a></h4>
</div>
<div id="status_memory_info">
<img src="images/small-spinner.gif"/>
@ -451,8 +451,8 @@
<tr>
<td>${consumerScanningStatistics.consumerKey}</td>
<td>${consumerScanningStatistics.count}</td>
<td>${consumerScanningStatistics.average}</td>
<td>${consumerScanningStatistics.time}</td>
<td>${consumerScanningStatistics.average}ms</td>
<td>${consumerScanningStatistics.time}ms</td>
</tr>
{{/each}}
</tbody>