]> source.dussan.org Git - archiva.git/commitdiff
implements schedule of remote index download
authorOlivier Lamy <olamy@apache.org>
Tue, 24 Jan 2012 16:56:36 +0000 (16:56 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 24 Jan 2012 16:56:36 +0000 (16:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1235353 13f79535-47bb-0310-9956-ffa450edef68

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 8304baa0f6a00bd392fe0c3fb4b69cb9264ca104..0a4a58f09b8a2198cdc2f589264ec077067215e8 100644 (file)
@@ -609,7 +609,40 @@ $(function() {
     }
 
     scheduleDownloadRemoteIndex=function(remoteRepository){
-      $.log("scheduleDownloadRemoteIndex");
+      openDialogConfirm(
+        function(){
+
+          var url = "restServices/archivaServices/repositoriesService/scheduleDownloadRemoteIndex?";
+          url += "repositoryId="+encodeURIComponent(remoteRepository.id());
+
+          var now = $("#remoterepository-scan-now").get(0).checked;
+
+          var full = $("#remoterepository-scan-full").get(0).checked;
+
+          url += "&now="+(now==true?"true":"false");
+          url += "&fullDownload="+(full==true?"true":"false");
+          $.ajax(url,
+            {
+              type: "GET",
+                success: function(data) {
+                  displaySuccessMessage($.i18n.prop("remoterepository.scanned.scheduled",remoteRepository.name()));
+
+                },
+                error: function(data) {
+                  var res = $.parseJSON(data.responseText);
+                  displayRestError(res);
+                },
+                complete: function(){
+                  closeDialogConfirm();
+                }
+            }
+          );
+
+        },
+        $.i18n.prop("ok"),
+        $.i18n.prop("cancel"),
+        $.i18n.prop("remoterepository.scan.confirm",remoteRepository.name()),
+        $("#remote-repository-scan-modal-tmpl").tmpl(remoteRepository));
     }
   }
 
index f6381d8005c3595c207c5e41e2f4f3b49f32cbd6..2862544fbb3fd09ea17611ed59a8b8536a60fc9e 100644 (file)
     </div>
   </div>
 </script>
+
 <script id="managed-repository-location-warning-tmpl" type='text/x-jquery-tmpl'>
   <div>
     <a class="close" href="#">&#215;</a>
       <button data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
       <button data-bind="click: displayGrid" class="btn">${$.i18n.prop('cancel')}</button>
     </form>
+</script>
+
+<script id="remote-repository-scan-modal-tmpl" type='text/x-jquery-tmpl'>
+    <div>
+      ${$.i18n.prop('remoterepository.scan.now')}: <input type="checkbox" id="remoterepository-scan-now">
+    </div>
+    <div>
+      ${$.i18n.prop('remoterepository.scan.full')}: <input type="checkbox" id="remoterepository-scan-full">
+    </div>
 </script>
\ No newline at end of file