From: Olivier Lamy Date: Thu, 9 Feb 2012 23:07:54 +0000 (+0000) Subject: [MRM-1576] rewrite proxies connector page X-Git-Tag: archiva-1.4-M3~1340 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=66ac3e896cf4069121e71b693dbca8a3b2db0d8e;p=archiva.git [MRM-1576] rewrite proxies connector page delete proxyConnector impl. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1242595 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 b8dc2f919..36e322689 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 @@ -112,12 +112,14 @@ $(function() { } - ManagedRepositoryConnectorView=function(source,targetRepos){ + ManagedRepositoryConnectorView=function(source,sourceName,targetRepos){ var self=this; this.modified=ko.observable(false); - - + //this.proxyConnector=ko.observable(proxyConnector); + //$.log("new ManagedRepositoryConnectorView:"+proxyConnector.id); this.source=ko.observable(source); + this.sourceName=ko.observable(sourceName); + //$.log("new ManagedRepositoryConnectorView source id:"+this.source.id); this.targetRepos=ko.observableArray(targetRepos); } @@ -235,20 +237,44 @@ $(function() { this.remoteRepositories=ko.observableArray([]); this.networkProxies=ko.observableArray([]); - editProxyConnector=function(proxyConnector){ + editProxyConnector=function(managedRepositoryConnectorView){ + $.log("editProxyConnector"); + } + removeProxyConnector=function(managedRepositoryConnectorView,targetRepoId){ + $.log("removeProxyConnector:"+managedRepositoryConnectorView.source()+","+targetRepoId); + var url="restServices/archivaServices/proxyConnectorService/removeProxyConnector?"; + url += "sourceRepoId="+encodeURIComponent(managedRepositoryConnectorView.source()); + url += "&targetRepoId="+encodeURIComponent(targetRepoId); + $.ajax(url, + { + type: "GET", + contentType: 'application/json', + success: function(data) { + clearUserMessages(); + displaySuccessMessage($.i18n.prop('proxyconnector.removed')); + //self.proxyConnectors.remove ProxyConnector=function(sourceRepoId,targetRepoId + self.displayGrid(); + }, + error: function(data) { + var res = $.parseJSON(data.responseText); + displayRestError(res); + } + } + ); } this.findUniqueManagedRepos=function(){ var sourcesRepos=[]; //sourceRepoId for(i=0;i0){ sourceRepo[0].targetRepos.push(curTarget); } else { - sourcesRepos.push(new ManagedRepositoryConnectorView(curSrcRepo,[curTarget])); + sourcesRepos.push(new ManagedRepositoryConnectorView(curSrcRepoId,getManagedRepository(curSrcRepoId).name(),[curTarget])); } } return sourcesRepos; 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 6635d4020..667d742ce 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 @@ -54,12 +54,12 @@ {{each(i, row) itemsOnCurrentPage()}} + {{var sourceId = row.source()}} - {{var val = row.source()}}
-

${val}

-

${getManagedRepository(val).name()}

+

${row.source()}

+

${row.sourceName()}

{{each(j, targetRepo) row.targetRepos()}} @@ -70,10 +70,13 @@

${getRemoteRepository(targetRepoId).url()}

+ data-bind="event: { mouseover: function(){ showSettings(sourceId,targetRepoId)},},click: function(){ editProxyConnector(row)}" + id="proxy-connectors-grid-remoterepo-settings-edit-${sourceId}-${targetRepoId}" href="#"> ${$.i18n.prop('edit')} - + + + +