]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1580] system status page button to flush all caches.
authorOlivier Lamy <olamy@apache.org>
Mon, 12 Mar 2012 14:31:02 +0000 (14:31 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 12 Mar 2012 14:31:02 +0000 (14:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1299685 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java
archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html

index 056b57b1cd7b42559d0e5294c462335e811e1f1c..8e0c809b35887f095c4687d5f7068145315f1c61 100644 (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;
+
+
 }
index b951db3ae422ff9894f00ccde4c241c86ac16ef4..31e529a1b15948d094288d4b0e9d48067871772a 100644 (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;
+    }
 }
index 95a0245bce6fb8cb55ec7783d20c0491c4f81dd5..1c43eb7466907eff987c25cc68c26d0e90ba0181 100644 (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.
 
 
 
index c3480b333f7befa32de4714e1ea51b69ca195dee..e7933568f4ff61478ed2a7c0c3ccc91b07fb2d60 100644 (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");
index 39a76eda78813d983c542b126975c59ce9dcdc7b..28ea2acb31a71970f9b6ed6073e768c3095ef2d4 100644 (file)
 </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>