]> source.dussan.org Git - archiva.git/commitdiff
link remote repository id for remote index download
authorOlivier Lamy <olamy@apache.org>
Thu, 26 Jan 2012 23:43:06 +0000 (23:43 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 26 Jan 2012 23:43:06 +0000 (23:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1236447 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 7ced787c06e88508e27fc9b6c010dc8370512edb..510b35367399a76b4a81496da31b798664de9c09 100644 (file)
@@ -529,6 +529,7 @@ $(function() {
   RemoteRepositoryViewModel=function(remoteRepository, update, remoteRepositoriesViewModel){
     this.remoteRepository=remoteRepository;
     this.remoteRepositoriesViewModel = remoteRepositoriesViewModel;
+    this.networkProxies=ko.observableArray([]);
     this.update = update;
 
     var self = this;
@@ -586,17 +587,24 @@ $(function() {
 
   RemoteRepositoriesViewModel=function(){
     this.remoteRepositories=ko.observableArray([]);
-
     this.gridViewModel = null;
     var self = this;
 
     editRemoteRepository=function(remoteRepository){
       $.log("editRemoteRepository");
-      var viewModel = new RemoteRepositoryViewModel(remoteRepository,true,self);
-      ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0));
-      activateRemoteRepositoryEditTab();
-      $("#remote-repository-edit-li a").html($.i18n.prop('edit'));
-      activateRemoteRepositoryFormValidation();
+      $.ajax("restServices/archivaServices/networkProxyService/getNetworkProxies", {
+          type: "GET",
+          dataType: 'json',
+          success: function(data) {
+            var viewModel = new RemoteRepositoryViewModel(remoteRepository,true,self);
+            viewModel.networkProxies(mapNetworkProxies(data));
+            ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0));
+            activateRemoteRepositoryEditTab();
+            $("#remote-repository-edit-li a").html($.i18n.prop('edit'));
+            activateRemoteRepositoryFormValidation();
+          }
+      })
+
     }
 
     removeRemoteRepository=function(remoteRepository){
@@ -784,6 +792,7 @@ $(function() {
     );
 
 
+
     $("#main-content #managed-repositories-pills").bind('change', function (e) {
       if ($(e.target).attr("href")=="#managed-repository-edit") {
         var viewModel = new ManagedRepositoryViewModel(new ManagedRepository(),false,managedRepositoriesViewModel);
@@ -798,9 +807,16 @@ $(function() {
 
     $("#main-content #remote-repositories-pills").bind('change', function (e) {
       if ($(e.target).attr("href")=="#remote-repository-edit") {
-        var viewModel = new RemoteRepositoryViewModel(new RemoteRepository(),false,remoteRepositoriesViewModel);
-        ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0));
-        activateRemoteRepositoryFormValidation();
+        $.ajax("restServices/archivaServices/networkProxyService/getNetworkProxies", {
+            type: "GET",
+            dataType: 'json',
+            success: function(data) {
+              var viewModel = new RemoteRepositoryViewModel(new RemoteRepository(),false,remoteRepositoriesViewModel);
+              viewModel.networkProxies(mapNetworkProxies(data));
+              ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0));
+              activateRemoteRepositoryFormValidation();
+            }
+        })
       }
       if ($(e.target).attr("href")=="#remote-repositories-view") {
         $("#main-content #remote-repository-edit-li a").html($.i18n.prop("add"));
index b4d63655ee422ca262e9d89a87ffdfbec7df8a7e..5833bcf987859a0ab957045dcec2b543b4fdb62b 100644 (file)
           </div>
         </div>
 
-        <!-- FIXME proxy id to use -->
+        <div class="clearfix">
+          <div class="input">
+            <select data-bind="options: networkProxies, optionsText: 'id',optionsValue:'id', value: remoteRepository.remoteDownloadNetworkProxyId, optionsCaption: 'Choose...'"></select>
+          </div>
+        </div>
+
 
         <div class="clearfix">
           <label for="downloadRemoteIndexOnStartup">${$.i18n.prop('downloadRemoteIndexOnStartup')}</label>