From 97a31442eabc3d87658540e90a99a458c8dedb51 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 12 Mar 2012 14:30:09 +0000 Subject: [PATCH] [MRM-1580] system status page flush cache link. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1299684 13f79535-47bb-0310-9956-ffa450edef68 --- .../rest/api/services/SystemStatusService.java | 7 +++++++ .../rest/services/DefaultSystemStatusService.java | 14 ++++++++++++++ .../org/apache/archiva/i18n/default.properties | 8 ++++++++ .../src/main/webapp/images/user-trash-full.png | Bin 0 -> 786 bytes .../src/main/webapp/images/user-trash.png | Bin 0 -> 655 bytes .../src/main/webapp/js/archiva/general-admin.js | 12 ++++++++++++ .../js/archiva/templates/general-admin.html | 10 ++++++++++ 7 files changed, 51 insertions(+) create mode 100644 archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/images/user-trash-full.png create mode 100644 archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/images/user-trash.png diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java index 91773482f..056b57b1c 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java @@ -65,4 +65,11 @@ public interface SystemStatusService List getCacheEntries() throws ArchivaRestServiceException; + @Path( "clearCache/{key}" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) + @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) + Boolean clearCache( @PathParam( "key" ) String cacheKey ) + throws ArchivaRestServiceException; + } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java index 9bda1ecf5..b951db3ae 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java @@ -126,4 +126,18 @@ public class DefaultSystemStatusService return cacheEntries; } + + public Boolean clearCache( String cacheKey ) + throws ArchivaRestServiceException + { + Cache cache = caches.get( cacheKey ); + if ( cache == null ) + { + throw new ArchivaRestServiceException( "no cache for key: " + cacheKey, + Response.Status.BAD_REQUEST.getStatusCode() ); + } + + cache.clear(); + return Boolean.TRUE; + } } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index dd5a6502e..95a0245bc 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -298,6 +298,14 @@ system-status.header.scanning.inprogress.none=No scans in progress. system-status.queues.grid.header.key=Queue system-status.queues.grid.header.number=Size system-status.header.main=System Status +system-status.caches.grid.header.cacheHits=Hits +system-status.queues.grid.header.size=Size +system-status.caches.grid.header.cacheMiss=Misses +system-status.caches.grid.header.cacheHitRate=Hit Ratio +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 diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/images/user-trash-full.png b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/images/user-trash-full.png new file mode 100644 index 0000000000000000000000000000000000000000..695d215a7ef478b4a58d7acc2f65b2e7825a930e GIT binary patch literal 786 zcmV+t1MU2YP)13ukxU zhnM#p_Oq_xiEe>sEA76t}Raj3J4p`kaZX;?WoG4{iIZZ4ncKX~xT z@u9OH^WDrXbhUw)+eUNKqxj_%VUQ-~v=VGt-WvXhhidAXyEez#Pdxot7vGc1XXJKq zQO>+FC<_bo5(I(x{#`kKqEDWC{sYiqw^#nSUc57RT#jEua`J8!?s)YKFxa2$sZMo0Pdvx}U6y%&|sXXK^R z!(_9MlZYpG-DaWi72{V%QMr8P0x)=>GmW)iMX**dTF_cB+7gDAC^G0suokp27-JBT ziwYo@&&aEa;b_^DPnFdzm@K=Sq|9pHI=HNA)TdAC@?X$tYZJVC;%c* zpKfDs>&pQ6{sQwir|=)#BnX72`V3G2z}YrA%H099H1^@RNtTMAu(h>_oJ72iWMVIE&3PhSVR`i%mWtof+;|8p7Gn%v+`Au8o66#OH7MmE zz%T2QC=~nJdQrHvKGKa9A*^cLzop&jKq(gygNU%UeuZ>RH}TkhQhOezv*QJ>FHWF! zgcXA}=6-+?gNVUeOBnt^@#n9JLW5EsH*SAUST$IqvDRSiKLH7VTQ{#q+5Ja6D;BFk zi@|8Ym3M=?gwR?t<$@1=4CctAV`gw={Zd+GAk58>)=AJMB;q7gvf17rq8U#aMg QBLDyZ07*qoM6N<$g2tO=(EtDd literal 0 HcmV?d00001 diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/images/user-trash.png b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/images/user-trash.png new file mode 100644 index 0000000000000000000000000000000000000000..0e0953c73c60adbbc762d0553f95a586f3054aa6 GIT binary patch literal 655 zcmV;A0&x9_P)Cml&2>S!-Vj|(%DY|xv2rmiUs+--iLl+4{ z?G|A~=Ohg>vv9>N%M}DMW!>HPeV%zbm|I~4O9R8eF!SL%Uk3g&6hQCgwr&w;ys}lf zIX1F%*Xv2Q_jYug8SU>IsAzqBV(1P`&UnCRf8PMZ!;e^5{(|GUxUTch+I8+M7rU?V zW_t34vrC+PH%AZz1VKm`?q)<3MMP26&l(YiA-R=YS&0X*u<(|l`}Zn3VP^W}j)^_# z_6NY#uC7z$Rx^mTh**raXl*fCh+`p13_7uhfHnqW4A$CV1<;djx7Tl^S>Kr5@mDOH z8zq#g#&c^~-&kgAv%q#=W$W-maC!CHfe5XaxietSj|8I1&`<#3&|j$e*lNa`-i+0@!$Xe002ovPDHLkV1g_FA-@0s literal 0 HcmV?d00001 diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js index 5fe5d8fec..c3480b333 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js @@ -603,6 +603,18 @@ $(function() { }); } + flushCache=function(key){ + clearUserMessages(); + $("#main-content #status_caches").html(smallSpinnerImg()); + $.ajax("restServices/archivaServices/systemStatusService/clearCache/"+encodeURIComponent(key), { + type: "GET", + success: function(data){ + displaySuccessMessage( $.i18n.prop("system-status.caches.flushed",key)); + displayCacheEntries(); + } + }); + } + displaySystemStatus=function(){ screenChange(); var mainContent=$("#main-content"); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html index 9b2dcc096..39a76eda7 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html @@ -367,6 +367,7 @@ ${$.i18n.prop('system-status.caches.grid.header.cacheHits')} ${$.i18n.prop('system-status.caches.grid.header.cacheMiss')} ${$.i18n.prop('system-status.caches.grid.header.cacheHitRate')} + ${$.i18n.prop('system-status.caches.grid.header.flush')} @@ -377,6 +378,15 @@ ${cacheEntry.cacheHits} ${cacheEntry.cacheMiss} ${cacheEntry.cacheHitRate} + + + {{if cacheEntry.size > 0 }} + + {{else}} + + {{/if}} + + {{/each}} -- 2.39.5