From 1f1599658fd034c19bde5bdbe049738c091c7ae0 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 7 Mar 2012 22:01:13 +0000 Subject: [PATCH] [MRM-1579] rewrite repositories scanning admin page start some refactoring to ease implementation (reusable beans) git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1298148 13f79535-47bb-0310-9956-ffa450edef68 --- .../api/model}/AdminRepositoryConsumer.java | 23 ++++++-- .../main/webapp/js/archiva/general-admin.js | 39 ++++++++++++++ .../webapp/js/archiva/templates/menu.html | 3 ++ .../scanning/AddAdminRepoConsumerClosure.java | 1 + .../AdminRepositoryConsumerComparator.java | 2 + .../scanning/RepositoryScanningAction.java | 53 +++++++++---------- 6 files changed, 91 insertions(+), 30 deletions(-) rename archiva-modules/archiva-web/{archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/scanning => archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model}/AdminRepositoryConsumer.java (76%) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/AdminRepositoryConsumer.java similarity index 76% rename from archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java rename to archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/AdminRepositoryConsumer.java index 5d714130b..539980a56 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/AdminRepositoryConsumer.java @@ -1,4 +1,4 @@ -package org.apache.archiva.web.action.admin.scanning; +package org.apache.archiva.rest.api.model; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -19,17 +19,34 @@ package org.apache.archiva.web.action.admin.scanning; * under the License. */ +import javax.xml.bind.annotation.XmlRootElement; + /** - * AdminRepositoryConsumer + * AdminRepositoryConsumer * * @version $Id$ */ +@XmlRootElement( name = "adminRepositoryConsumer" ) public class AdminRepositoryConsumer { private boolean enabled = false; + private String id; + private String description; - + + public AdminRepositoryConsumer() + { + // no op + } + + public AdminRepositoryConsumer( boolean enabled, String id, String description ) + { + this.enabled = enabled; + this.id = id; + this.description = description; + } + public String getDescription() { return description; 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 0b72d7ac2..1a6cfcc51 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 @@ -296,4 +296,43 @@ $(function() { } + //--------------------------- + // repository scanning part + //--------------------------- + + FileType=function(id,patterns){ + //private String id; + this.id=ko.observable(id); + + //private List patterns; + this.patterns=ko.observableArray(patterns); + + } + + mapFileType=function(data){ + return new FileType(data.id,data.patterns); + } + + mapFileTypes=function(data){ + if (data!=null){ + return $.isArray(data)? $.map(data,function(item){ + return mapFileType(item) + }):[mapFileType(data)]; + } + return []; + } + + displayRepositoryScanning=function(){ + + $.ajax("restServices/archivaServices/archivaAdministrationService/getFileTypes", { + type: "GET", + dataType: 'json', + success: function(data){ + var fileTypes=mapFileTypes(data); + } + }); + + } + + }); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html index 9d3125a1a..b87ac8b28 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/menu.html @@ -45,6 +45,9 @@
  • ${$.i18n.prop('menu.legacy-artifact-support')}
  • +
  • + ${$.i18n.prop('menu.repository-scanning')} +