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
This commit is contained in:
Olivier Lamy 2012-01-26 23:43:06 +00:00
parent 6b9d8d7d9a
commit d3626d0e81
2 changed files with 31 additions and 10 deletions

View File

@ -529,6 +529,7 @@ $(function() {
RemoteRepositoryViewModel=function(remoteRepository, update, remoteRepositoriesViewModel){ RemoteRepositoryViewModel=function(remoteRepository, update, remoteRepositoriesViewModel){
this.remoteRepository=remoteRepository; this.remoteRepository=remoteRepository;
this.remoteRepositoriesViewModel = remoteRepositoriesViewModel; this.remoteRepositoriesViewModel = remoteRepositoriesViewModel;
this.networkProxies=ko.observableArray([]);
this.update = update; this.update = update;
var self = this; var self = this;
@ -586,17 +587,24 @@ $(function() {
RemoteRepositoriesViewModel=function(){ RemoteRepositoriesViewModel=function(){
this.remoteRepositories=ko.observableArray([]); this.remoteRepositories=ko.observableArray([]);
this.gridViewModel = null; this.gridViewModel = null;
var self = this; var self = this;
editRemoteRepository=function(remoteRepository){ editRemoteRepository=function(remoteRepository){
$.log("editRemoteRepository"); $.log("editRemoteRepository");
var viewModel = new RemoteRepositoryViewModel(remoteRepository,true,self); $.ajax("restServices/archivaServices/networkProxyService/getNetworkProxies", {
ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0)); type: "GET",
activateRemoteRepositoryEditTab(); dataType: 'json',
$("#remote-repository-edit-li a").html($.i18n.prop('edit')); success: function(data) {
activateRemoteRepositoryFormValidation(); 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){ removeRemoteRepository=function(remoteRepository){
@ -784,6 +792,7 @@ $(function() {
); );
$("#main-content #managed-repositories-pills").bind('change', function (e) { $("#main-content #managed-repositories-pills").bind('change', function (e) {
if ($(e.target).attr("href")=="#managed-repository-edit") { if ($(e.target).attr("href")=="#managed-repository-edit") {
var viewModel = new ManagedRepositoryViewModel(new ManagedRepository(),false,managedRepositoriesViewModel); var viewModel = new ManagedRepositoryViewModel(new ManagedRepository(),false,managedRepositoriesViewModel);
@ -798,9 +807,16 @@ $(function() {
$("#main-content #remote-repositories-pills").bind('change', function (e) { $("#main-content #remote-repositories-pills").bind('change', function (e) {
if ($(e.target).attr("href")=="#remote-repository-edit") { if ($(e.target).attr("href")=="#remote-repository-edit") {
var viewModel = new RemoteRepositoryViewModel(new RemoteRepository(),false,remoteRepositoriesViewModel); $.ajax("restServices/archivaServices/networkProxyService/getNetworkProxies", {
ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0)); type: "GET",
activateRemoteRepositoryFormValidation(); 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") { if ($(e.target).attr("href")=="#remote-repositories-view") {
$("#main-content #remote-repository-edit-li a").html($.i18n.prop("add")); $("#main-content #remote-repository-edit-li a").html($.i18n.prop("add"));

View File

@ -415,7 +415,12 @@
</div> </div>
</div> </div>
<!-- FIXME proxy id to use --> <div class="clearfix">
<div class="input">
<select data-bind="options: networkProxies, optionsText: 'id',optionsValue:'id', value: remoteRepository.remoteDownloadNetworkProxyId, optionsCaption: 'Choose...'"></select>
</div>
</div>
<div class="clearfix"> <div class="clearfix">
<label for="downloadRemoteIndexOnStartup">${$.i18n.prop('downloadRemoteIndexOnStartup')}</label> <label for="downloadRemoteIndexOnStartup">${$.i18n.prop('downloadRemoteIndexOnStartup')}</label>