--- /dev/null
+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() );
+ }
+}
}
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}));
}
});
}
this.newFileCount=newFileCount;
}
- displaySystemStatus=function(){
- screenChange();
- var mainContent=$("#main-content");
- mainContent.html($("#system-status-main").tmpl());
-
- var versionInfo=$.i18n.prop('system-status.header.version.buildNumber')+": "+window.archivaRuntimeInfo.buildNumber
- +" - "+$.i18n.prop('system-status.header.version.timestampStr')+": "+window.archivaRuntimeInfo.timestampStr;
- mainContent.find("#status_version_info").html(versionInfo);
+ 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);
- mainContent.find("#status_memory_info" ).html(memUsage);
+ divContent.html(memUsage);
}
});
+ }
+
+ displaySystemStatus=function(){
+ screenChange();
+ var mainContent=$("#main-content");
+ mainContent.html($("#system-status-main").tmpl());
+
+ var versionInfo=$.i18n.prop('system-status.header.version.buildNumber')+": "+window.archivaRuntimeInfo.buildNumber
+ +" - "+$.i18n.prop('system-status.header.version.timestampStr')+": "+window.archivaRuntimeInfo.timestampStr;
+ mainContent.find("#status_version_info").html(versionInfo);
+
+ displayMemoryUsage();
+
$.ajax("restServices/archivaServices/systemStatusService/currentServerTime/"+encodeURIComponent(usedLang()), {
type: "GET",
dataType: "text",
}
});
- $.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();
}
</div>
<div class="page-header">
- <h4>${$.i18n.prop('system-status.header.scanning')}</h4>
+ <h4>${$.i18n.prop('system-status.header.scanning')} <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')} <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')} <a href="#" onclick="displayMemoryUsage()"><img src="images/view-refresh.png"/></a></h4>
</div>
<div id="status_memory_info">
<img src="images/small-spinner.gif"/>
<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>