From d3626d0e8174100607e31ac376e96419f1e6d604 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 26 Jan 2012 23:43:06 +0000 Subject: [PATCH] link remote repository id for remote index download git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1236447 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/webapp/js/archiva/repositories.js | 34 ++++++++++++++----- .../js/archiva/templates/repositories.html | 7 +++- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js index 7ced787c0..510b35367 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js @@ -529,6 +529,7 @@ $(function() { RemoteRepositoryViewModel=function(remoteRepository, update, remoteRepositoriesViewModel){ this.remoteRepository=remoteRepository; this.remoteRepositoriesViewModel = remoteRepositoriesViewModel; + this.networkProxies=ko.observableArray([]); this.update = update; var self = this; @@ -586,17 +587,24 @@ $(function() { RemoteRepositoriesViewModel=function(){ this.remoteRepositories=ko.observableArray([]); - this.gridViewModel = null; var self = this; editRemoteRepository=function(remoteRepository){ $.log("editRemoteRepository"); - var viewModel = new RemoteRepositoryViewModel(remoteRepository,true,self); - ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0)); - activateRemoteRepositoryEditTab(); - $("#remote-repository-edit-li a").html($.i18n.prop('edit')); - activateRemoteRepositoryFormValidation(); + $.ajax("restServices/archivaServices/networkProxyService/getNetworkProxies", { + type: "GET", + dataType: 'json', + success: function(data) { + var viewModel = new RemoteRepositoryViewModel(remoteRepository,true,self); + viewModel.networkProxies(mapNetworkProxies(data)); + ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0)); + activateRemoteRepositoryEditTab(); + $("#remote-repository-edit-li a").html($.i18n.prop('edit')); + activateRemoteRepositoryFormValidation(); + } + }) + } removeRemoteRepository=function(remoteRepository){ @@ -784,6 +792,7 @@ $(function() { ); + $("#main-content #managed-repositories-pills").bind('change', function (e) { if ($(e.target).attr("href")=="#managed-repository-edit") { var viewModel = new ManagedRepositoryViewModel(new ManagedRepository(),false,managedRepositoriesViewModel); @@ -798,9 +807,16 @@ $(function() { $("#main-content #remote-repositories-pills").bind('change', function (e) { if ($(e.target).attr("href")=="#remote-repository-edit") { - var viewModel = new RemoteRepositoryViewModel(new RemoteRepository(),false,remoteRepositoriesViewModel); - ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0)); - activateRemoteRepositoryFormValidation(); + $.ajax("restServices/archivaServices/networkProxyService/getNetworkProxies", { + type: "GET", + dataType: 'json', + success: function(data) { + var viewModel = new RemoteRepositoryViewModel(new RemoteRepository(),false,remoteRepositoriesViewModel); + viewModel.networkProxies(mapNetworkProxies(data)); + ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0)); + activateRemoteRepositoryFormValidation(); + } + }) } if ($(e.target).attr("href")=="#remote-repositories-view") { $("#main-content #remote-repository-edit-li a").html($.i18n.prop("add")); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repositories.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repositories.html index b4d63655e..5833bcf98 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repositories.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/repositories.html @@ -415,7 +415,12 @@ - +
+
+ +
+
+