]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1579] rewrite repositories scanning admin page
authorOlivier Lamy <olamy@apache.org>
Thu, 8 Mar 2012 09:31:51 +0000 (09:31 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 8 Mar 2012 09:31:51 +0000 (09:31 +0000)
enabled/disabled consummers.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1298321 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaAdministrationService.java
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 01e867fbf66acce47008170aead9ab7f99613c02..8012a29b5cf56a05b1fe20ceec4fe4e981f83c5a 100644 (file)
@@ -31,6 +31,7 @@ import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
@@ -101,11 +102,11 @@ public interface ArchivaAdministrationService
     Boolean removeFileType( @QueryParam( "fileTypeId" ) String fileTypeId )
         throws ArchivaRestServiceException;
 
-    @Path( "enabledKnownContentConsumer" )
+    @Path( "enabledKnownContentConsumer/{knownContentConsumer}" )
     @GET
     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
-    Boolean enabledKnownContentConsumer( @QueryParam( "knownContentConsumer" ) String knownContentConsumer )
+    Boolean enabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer )
         throws ArchivaRestServiceException;
 
     @Path( "enabledKnownContentConsumers" )
@@ -116,18 +117,18 @@ public interface ArchivaAdministrationService
         throws ArchivaRestServiceException;
 
 
-    @Path( "disabledKnownContentConsumer" )
+    @Path( "disabledKnownContentConsumer/{knownContentConsumer}" )
     @GET
     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
-    Boolean disabledKnownContentConsumer( @QueryParam( "knownContentConsumer" ) String knownContentConsumer )
+    Boolean disabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer )
         throws ArchivaRestServiceException;
 
-    @Path( "enabledInvalidContentConsumer" )
+    @Path( "enabledInvalidContentConsumer/{invalidContentConsumer}" )
     @GET
     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
-    Boolean enabledInvalidContentConsumer( @QueryParam( "invalidContentConsumer" ) String invalidContentConsumer )
+    Boolean enabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer )
         throws ArchivaRestServiceException;
 
     @Path( "enabledInvalidContentConsumers" )
@@ -137,11 +138,11 @@ public interface ArchivaAdministrationService
     void enabledInvalidContentConsumers( List<String> invalidContentConsumers )
         throws ArchivaRestServiceException;
 
-    @Path( "disabledInvalidContentConsumer" )
+    @Path( "disabledInvalidContentConsumer/{invalidContentConsumer}" )
     @GET
     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
-    Boolean disabledInvalidContentConsumer( @QueryParam( "invalidContentConsumer" ) String invalidContentConsumer )
+    Boolean disabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer )
         throws ArchivaRestServiceException;
 
     @Path( "getFileTypes" )
index 453f3de03bf907d435714354feebb32d992e0adf..62a75b81e9daaf192cceed7b0efd40bb9e5a9a0e 100644 (file)
@@ -397,6 +397,34 @@ $(function() {
           }
       });
     }
+
+    disableKnowContentConsumer=function(adminRepositoryConsumer){
+      clearUserMessages();
+      var url="restServices/archivaServices/archivaAdministrationService/disabledKnownContentConsumer/"
+      url+=encodeURIComponent(adminRepositoryConsumer.id());
+      $.ajax(url, {
+          type: "GET",
+          dataType: 'json',
+          success: function(data){
+            adminRepositoryConsumer.enabled(false);
+            displaySuccessMessage( $.i18n.prop("repository-scanning.consumers.know.disabled",adminRepositoryConsumer.id()));
+          }
+      });
+    }
+
+    enableKnowContentConsumer=function(adminRepositoryConsumer){
+      clearUserMessages();
+      var url="restServices/archivaServices/archivaAdministrationService/enabledKnownContentConsumer/"
+      url+=encodeURIComponent(adminRepositoryConsumer.id());
+      $.ajax(url, {
+          type: "GET",
+          dataType: 'json',
+          success: function(data){
+            adminRepositoryConsumer.enabled(true);
+            displaySuccessMessage( $.i18n.prop("repository-scanning.consumers.know.enabled",adminRepositoryConsumer.id()));
+          }
+      });
+    }
   }
 
   displayRepositoryScanning=function(){
index 8b26652cd451f18270822f25d59f490a35aecbe1..84ee3108c754ab75c84f5fa1f34cffca63e46565 100644 (file)
     <tbody>
       {{each(i,knownAdminRepositoryConsumer) knownAdminRepositoryConsumers}}
       <tr>
-        <td>${knownAdminRepositoryConsumer.enabled}</td>
+            {{if knownAdminRepositoryConsumer.enabled()==true}}
+              <td>
+                <a href="#" data-bind="click: function(){ disableKnowContentConsumer(knownAdminRepositoryConsumer) }">
+                  <img src="images/weather-clear-22-22.png"/>
+                </a>
+              </td>
+            {{else}}
+            <td>
+              <a href="#" data-bind="click: function(){ enableKnowContentConsumer(knownAdminRepositoryConsumer) }">
+                <img src="images/dialog-error-22-22.png"/>
+              </a>
+            </td>
+            {{/if}}
+
         <td>${knownAdminRepositoryConsumer.id}</td>
         <td>${knownAdminRepositoryConsumer.description}</td>
       </tr>