]> source.dussan.org Git - archiva.git/commitdiff
fix available proxy connectors in proxy connectors screen
authorOlivier Lamy <olamy@apache.org>
Tue, 16 Oct 2012 22:44:28 +0000 (22:44 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 16 Oct 2012 22:44:28 +0000 (22:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1399030 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js

index 615134e6956d67d980428c5e37f9eff6c97e8f49..efcbda1dbe6acb4ec2edde4e32223eda50574be6 100644 (file)
@@ -175,10 +175,25 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra
     var self=this;
     this.proxyConnectorRule=proxyConnectorRule;
     this.proxyConnectorRulesViewModel=proxyConnectorRulesViewModel;
-    this.availableProxyConnectors=proxyConnectorRulesViewModel.proxyConnectors;
+    this.availableProxyConnectors=ko.observableArray([]);
     this.availableProxyConnectors.id="availableProxyConnectors";
     this.update=update;
 
+
+      $.each(this.proxyConnectorRulesViewModel.proxyConnectors(), function(idx, value) {
+        $.log(idx + ': ' + value.sourceRepoId() +":"+value.targetRepoId());
+        var available=true;
+        // is it in proxyConnectorRule.proxyConnectors
+        $.each(self.proxyConnectorRule.proxyConnectors(),function(index,proxyConnector){
+          if(value.sourceRepoId()==proxyConnector.sourceRepoId() && value.targetRepoId()==proxyConnector.targetRepoId()){
+            available=false;
+          }
+        });
+        if(available==true){
+          self.availableProxyConnectors.push(value);
+        }
+      });
+
     proxyConnectorMoved=function(arg){
       $.log("repositoryMoved:"+arg.sourceIndex+" to " + arg.targetIndex);
       self.proxyConnectorRule.modified(true);