From 345a7d6a75745b01c76541958b5ebe34bb3789f4 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 8 Mar 2012 09:31:51 +0000 Subject: [PATCH] [MRM-1579] rewrite repositories scanning admin page enabled/disabled consummers. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1298321 13f79535-47bb-0310-9956-ffa450edef68 --- .../ArchivaAdministrationService.java | 17 +++++------ .../main/webapp/js/archiva/general-admin.js | 28 +++++++++++++++++++ .../js/archiva/templates/general-admin.html | 15 +++++++++- 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaAdministrationService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaAdministrationService.java index 01e867fbf..8012a29b5 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaAdministrationService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaAdministrationService.java @@ -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 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" ) 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 453f3de03..62a75b81e 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 @@ -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(){ 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 8b26652cd..84ee3108c 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 @@ -216,7 +216,20 @@ {{each(i,knownAdminRepositoryConsumer) knownAdminRepositoryConsumers}} - ${knownAdminRepositoryConsumer.enabled} + {{if knownAdminRepositoryConsumer.enabled()==true}} + + + + + + {{else}} + + + + + + {{/if}} + ${knownAdminRepositoryConsumer.id} ${knownAdminRepositoryConsumer.description} -- 2.39.5