From d72763b96a3b1670b28aeba7a622689dabd0d15e Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 10 Feb 2012 10:21:27 +0000 Subject: [PATCH] [MRM-1576] rewrite proxies connector page use new bean properties to ease json mapping for policies and properties. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1242724 13f79535-47bb-0310-9956-ffa450edef68 --- .../webapp/js/archiva/proxy-connectors.js | 72 ++++++++----------- .../archiva/templates/proxy-connectors.html | 20 +++--- 2 files changed, 43 insertions(+), 49 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js index d5f8682a3..71e2dbc14 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js @@ -18,7 +18,7 @@ */ $(function() { - ProxyConnector=function(sourceRepoId,targetRepoId,proxyId,blackListPatterns,whiteListPatterns,policies,properties, + ProxyConnector=function(sourceRepoId,targetRepoId,proxyId,blackListPatterns,whiteListPatterns,policiesEntries,propertiesEntries, disabled,order){ var self=this; @@ -57,17 +57,17 @@ $(function() { self.modified(true); }); - //private Map policies; - this.policies=ko.observableArray(policies==null?[]:policies); - this.policies.subscribe(function(newValue){ - $.log("modify policies"); + //private List policiesEntries; + this.policiesEntries=ko.observableArray(policiesEntries==null?new Array():policiesEntries); + this.policiesEntries.subscribe(function(newValue){ + $.log("policiesEntries policies"); self.modified(true); }); - //private Map properties; - this.properties=ko.observableArray(properties==null?new Array():properties); - this.properties.subscribe(function(newValue){ - $.log("properties modified"); + //private List properties; + this.propertiesEntries=ko.observableArray(propertiesEntries==null?new Array():propertiesEntries); + this.propertiesEntries.subscribe(function(newValue){ + $.log("propertiesEntries modified"); self.modified(true); }); @@ -79,7 +79,7 @@ $(function() { }); //private int order = 0; - this.order=ko.observable(order); + this.order=ko.observable(order?order:0); this.order.subscribe(function(newValue){ $.log("modify order"); self.modified(true); @@ -88,15 +88,13 @@ $(function() { this.modified=ko.observable(false); this.modified.subscribe(function(newValue){$.log("ProxyConnector modified:"+newValue)}); - this.policiesEntries=[]; - this.propertiesEntries=[]; this.deleteProperty=function(key){ $.log("delete property key:"+key()); - for(i=0;i0) ? remoteRepository[0]:new RemoteRepository(); } getProxyConnector=function(sourceRepoId,targetRepoId){ - $.log("getProxyConnector:"+sourceRepoId+":"+targetRepoId); var proxyConnector=$.grep(self.proxyConnectors(), function(proxyConnector,idx){ return proxyConnector.sourceRepoId()==sourceRepoId @@ -290,7 +284,6 @@ $(function() { } ); var res = ($.isArray(proxyConnector) && proxyConnector.length>0) ? proxyConnector[0]:new ProxyConnector(); - $.log("getProxyConnector res:"+res); return res; } @@ -300,7 +293,7 @@ $(function() { +proxyConnector.sourceRepoId()+"-"+proxyConnector.targetRepoId()); targetContent.html(""); targetContent.append($("#proxy-connectors-remote-settings-popover-tmpl") - .tmpl(proxyConnector)); + .tmpl(ko.toJS(proxyConnector))); var targetImg = $("#proxy-connectors-grid-remoterepo-settings-edit-"+proxyConnector.sourceRepoId() +"-"+proxyConnector.targetRepoId()); @@ -315,8 +308,6 @@ $(function() { targetImg.popover('show'); - $.log("showSettings:"+proxyConnector.policies().length); - } this.displayGrid=function(){ @@ -342,8 +333,7 @@ $(function() { for (i=0;i ${row.sourceRepoId()} - ${row.targetRepoId()} + ${row.targetRepoId()}-${row.order()}