]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1574] action to scan repository
authorOlivier Lamy <olamy@apache.org>
Thu, 19 Jan 2012 00:01:18 +0000 (00:01 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 19 Jan 2012 00:01:18 +0000 (00:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1233134 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repositories.html

index 1b621493927f53e61a7250141b7d12c7f3e276ce..9835b2253f28154dbda3ed74a8e41a46c26edd88 100644 (file)
@@ -32,4 +32,7 @@ managedrepository.delete.warning.message=Are you sure you want to delete the fol
 managedrepository.deleted=Managed Repository " {0} " deleted.
 managedrepository.location.already.exists=WARNING: Repository location already exists.
 managedrepository.location.already.exists.warning.message=Are you sure you want to use this directory
-managedrepository.add.title=Add Managed Repository
\ No newline at end of file
+managedrepository.add.title=Add Managed Repository
+managedrepository.scan.now=Scan Repository Now
+managedrepository.scan.all=Process All Artifacts
+managedrepository.scanned=Managed Repository " {0} " scanned.
\ No newline at end of file
index 30c58a534800fc2739842db83f501e4d8c2342ed..fd7c0a1f451ac1a4dc367107d152423c4c86f250 100644 (file)
@@ -224,6 +224,41 @@ $(function() {
       activateManagedRepositoryFormValidation();
     }
 
+    scanNow=function(managedRepository){
+      clearUserMessages();
+      openDialogConfirm(
+          function(){
+            $("#dialog-confirm-modal #modal-login-footer").append(smallSpinnerImg());
+            var checked = $("#managed-repository-scan-now-all").get(0).checked;
+            var url = "restServices/archivaServices/repositoriesService/scanRepositoryNow?";
+            url += "repositoryId="+encodeURIComponent(managedRepository.id());
+            url += "&fullScan="+(checked==true?"true":"false");
+            $.ajax(url,
+              {
+                type: "GET",
+                  success: function(data) {
+                    self.managedRepositories.remove(managedRepository);
+                    displaySuccessMessage($.i18n.prop("managedrepository.scanned",managedRepository.name()));
+
+                  },
+                  error: function(data) {
+                    var res = $.parseJSON(data.responseText);
+                    displayRestError(res);
+                  },
+                  complete: function(){
+                    removeSmallSpinnerImg();
+                    closeDialogConfirm();
+                  }
+              }
+            );
+          },
+          $.i18n.prop("ok"),
+          $.i18n.prop("cancel"),
+          $.i18n.prop("managedrepository.scan.now"),
+          $("#managed-repository-scan-now-modal-tmpl").tmpl(managedRepository));
+
+    }
+
     removeManagedRepository=function(managedRepository){
       clearUserMessages();
       openDialogConfirm(
index 427efee05d88c6415efe5679649d3504e38d24d6..c51ba7e26c0833a795bf4a06e8ad4b89b30e8e9a 100644 (file)
@@ -66,6 +66,7 @@
         {{/each}}
         <th>${$.i18n.prop('release.included')}</th>
         <th>${$.i18n.prop('snapshots.included')}</th>
+        <th>${$.i18n.prop('managedrepository.scan.now')}</th>
         <th>${$.i18n.prop('edit')}</th>
         <th>${$.i18n.prop('delete')}</th>
       </tr>
@@ -91,6 +92,7 @@
                   <img src="images/dialog-error.png"/>
               {{/if}}
             </td>
+            <td><a href="#" data-bind="click: function(){ scanNow(row) }">${$.i18n.prop('managedrepository.scan.now')}</a></td>
             <td><a href="#" data-bind="click: function(){ editManagedRepository(row) }">${$.i18n.prop('edit')}</a></td>
             <td>
               <a href="#" data-bind="click: function(){ removeManagedRepository(row) }">
       <div>${$.i18n.prop('name')}: ${name()}</div>
     </div>
   </div>
+</script>
+<script id="managed-repository-scan-now-modal-tmpl" type='text/x-jquery-tmpl'>
+      <div>
+        ${$.i18n.prop('managedrepository.scan.all')}: <input type="checkbox" id="managed-repository-scan-now-all">
+      </div>
+
 </script>
\ No newline at end of file