From: Olivier Lamy Date: Mon, 30 Jan 2012 14:58:13 +0000 (+0000) Subject: add js wrapper for repository connector bean model X-Git-Tag: archiva-1.4-M3~1432 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=be5c8ba99418dae8f9caa0828eabd9a8f1e529af;p=archiva.git add js wrapper for repository connector bean model git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1237696 13f79535-47bb-0310-9956-ffa450edef68 --- 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 6a2660e08..7cbcb8a78 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 @@ -51,25 +51,30 @@ $(function() { this.name=ko.observable(name); } + ManagedRepositoryConnectorView=function(source,targetRepos){ + this.source=ko.observable(source); + this.targetRepos=ko.observableArray(targetRepos); + } + ProxyConnectorsViewModel=function(){ this.proxyConnectors=ko.observableArray([]); var self=this; + this.uniqueManagedRepos=ko.observableArray([]); editProxyConnector=function(proxyConnector){ } - this.displayGrid=function(){ + this.findUniqueManagedRepos=function(){ var sourcesRepos=[]; //sourceRepoId for(i=0;i0){ sourceRepo[0].targetRepos.push(curTarget); } else { - $.log("sourceRepo==null:"+curSrcRepo); - sourcesRepos.push({source:curSrcRepo,targetRepos:[curTarget]}); - if (sourceRepo!=null){ - $.log("sourceRepoId:"+curSrcRepo); - sourcesRepos.push({source:curSrcRepo,targetRepos:[curTarget]}); - } else { - sourceRepo.targetRepos.push(curTarget); + sourcesRepos.push(new ManagedRepositoryConnectorView(curSrcRepo,[curTarget])); } } + return sourcesRepos; + } + + this.displayGrid=function(){ + self.uniqueManagedRepos(this.findUniqueManagedRepos()); + $.log("uniqueManagedRepos:"+self.uniqueManagedRepos().length); + this.gridViewModel = new ko.simpleGrid.viewModel({ + data: self.uniqueManagedRepos, + pageSize: 5, + gridUpdateCallBack: function(){ + $("#main-content #proxyConnectorsTable [title]").twipsy(); + } + }); + ko.applyBindings(this,$("#main-content #proxyConnectorsTable").get(0)); + removeSmallSpinnerImg("#main-content"); + $("#main-content #proxy-connectors-view-tabs").tabs(); } } @@ -144,8 +159,8 @@ $(function() { mapPolicyInformations=function(data){ return $.map(data.policyInformation, function(item) { - return mapPolicyInformation(item); - }); + return mapPolicyInformation(item); + }); } }); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/proxy-connectors.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/proxy-connectors.html index 7a2445a99..c015a26b3 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/proxy-connectors.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/proxy-connectors.html @@ -20,21 +20,43 @@ -