NetworkProxy=function(id,protocol,host,port,username,password){
+ var self=this;
//private String id;
this.id = ko.observable(id);
+ this.id.subscribe(function(newValue){self.modified(true)});
//private String protocol = "http";
this.protocol=ko.observable(protocol);
+ this.protocol.subscribe(function(newValue){self.modified(true)});;
//private String host;
this.host=ko.observable(host);
+ this.host.subscribe(function(newValue){self.modified(true)});;
//private int port = 8080;
this.port=ko.observable(port);
+ this.port.subscribe(function(newValue){self.modified(true)});;
//private String username;
this.username=ko.observable(username?username:"");
+ this.username.subscribe(function(newValue){self.modified(true)});;
//private String password;
this.password=ko.observable(password?password:"");
+ this.password.subscribe(function(newValue){self.modified(true)});;
+
+ this.modified=ko.observable(false);
}
NetworkProxyViewModel=function(networkProxy, update, networkProxiesViewModel){
this.networkProxiesViewModel=networkProxiesViewModel;
var self=this;
- save=function(){
+ this.save=function(){
if (!$("#main-content #network-proxy-edit-form").valid()){
return;
}
dataType: 'json',
success: function(data) {
displaySuccessMessage($.i18n.prop('networkproxy.updated'));
+ self.networkProxy.modified(false);
activateNetworkProxiesGridTab();
},
error: function(data) {
}
NetworkProxiesViewModel=function(){
- this.networkProxies=ko.observableArray([]);
+ this.networkProxies=ko.observableArray([]);//.subscribe(function(val){$.log('subscribe')});
var self=this;
activateNetworkProxyEditTab();
}
+ updateNetworkProxy=function(networkProxy){
+ var viewModel = new NetworkProxyViewModel(networkProxy,true,self);
+ viewModel.save();
+ }
+
removeNetworkProxy=function(networkProxy){
openDialogConfirm(
function(){$.ajax("restServices/archivaServices/networkProxyService/deleteNetworkProxy/"+encodeURIComponent(networkProxy.id()),
dataType: 'json',
success: function(data) {
networkProxiesViewModel.networkProxies(mapNetworkProxies(data));
+ //networkProxiesViewModel.networkProxies.subscribe(function(){$.log("change in networkProxies")});
networkProxiesViewModel.gridViewModel = new ko.simpleGrid.viewModel({
data: networkProxiesViewModel.networkProxies,
columns: [