diff options
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<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" ) 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 @@ <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> |