[MRM-1580] system status page button to flush all caches.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1299685 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-12 14:31:02 +00:00
parent 97a31442ea
commit 1cc0787731
5 changed files with 35 additions and 0 deletions

View File

@ -72,4 +72,12 @@ public interface SystemStatusService
Boolean clearCache( @PathParam( "key" ) String cacheKey )
throws ArchivaRestServiceException;
@Path( "clearAllCaches" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean clearAllCaches()
throws ArchivaRestServiceException;
}

View File

@ -140,4 +140,14 @@ public class DefaultSystemStatusService
cache.clear();
return Boolean.TRUE;
}
public Boolean clearAllCaches()
throws ArchivaRestServiceException
{
for ( Cache cache : caches.values() )
{
cache.clear();
}
return Boolean.TRUE;
}
}

View File

@ -306,6 +306,8 @@ system-status.caches.grid.header.flush=Flush
system-status.caches.grid.header.key=Cache
system-status.caches.flushed=Cache {0} flushed.
system-status.caches.grid.header.size=Size
system-status.caches.flushAll=Flush All Caches
system-status.caches.all.flushed=All Caches flushed.

View File

@ -615,6 +615,18 @@ $(function() {
});
}
flushAllCaches=function(){
clearUserMessages();
$("#main-content #status_caches").html(smallSpinnerImg());
$.ajax("restServices/archivaServices/systemStatusService/clearAllCaches", {
type: "GET",
success: function(data){
displaySuccessMessage( $.i18n.prop("system-status.caches.all.flushed"));
displayCacheEntries();
}
});
}
displaySystemStatus=function(){
screenChange();
var mainContent=$("#main-content");

View File

@ -359,6 +359,9 @@
</script>
<script id="status_caches_tmpl" type="text/html">
<a href="#" class="btn btn-warning" onclick="flushAllCaches()">
${$.i18n.prop('system-status.caches.flushAll')}
</a>
<table class="table table-condensed">
<thead>
<tr>