From 2879d8775eef2f0b645d328a8c881d808de1b605 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 16 Oct 2012 22:44:28 +0000 Subject: [PATCH] fix available proxy connectors in proxy connectors screen git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1399030 13f79535-47bb-0310-9956-ffa450edef68 --- .../webapp/js/archiva/proxy-connectors-rules.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js index 615134e69..efcbda1db 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js @@ -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); -- 2.39.5