var self=this;
save=function(){
+ if (!$("#main-content #network-proxy-edit-form").valid()){
+ return;
+ }
+ clearUserMessages();
+ if (update){
+ $.ajax("restServices/archivaServices/networkProxyService/updateNetworkProxy",
+ {
+ type: "POST",
+ contentType: 'application/json',
+ data: "{\"networkProxy\": " + ko.toJSON(networkProxy)+"}",
+ dataType: 'json',
+ success: function(data) {
+ displaySuccessMessage($.i18n.prop('networkproxy.updated'));
+ activateNetworkProxiesGridTab();
+ },
+ error: function(data) {
+ var res = $.parseJSON(data.responseText);
+ displayRestError(res);
+ }
+ }
+ );
+ } else {
+
+ $.ajax("restServices/archivaServices/networkProxyService/addNetworkProxy",
+ {
+ type: "POST",
+ contentType: 'application/json',
+ data: "{\"networkProxy\": " + ko.toJSON(networkProxy)+"}",
+ dataType: 'json',
+ success: function(data) {
+ self.networkProxiesViewModel.networkProxies.push(self.networkProxy);
+ displaySuccessMessage($.i18n.prop('networkproxy.added'));
+ activateNetworkProxiesGridTab();
+ },
+ error: function(data) {
+ var res = $.parseJSON(data.responseText);
+ displayRestError(res);
+ }
+ }
+ );
+ }
}
displayGrid=function(){
this.gridViewModel = null;
editNetworkProxy=function(networkProxy){
+ $.log("editNetworkProxy");
$("#main-content #network-proxies-edit a").html($.i18n.prop("edit"));
+ var viewModel = new NetworkProxyViewModel(networkProxy,true,self);
+ ko.applyBindings(viewModel,$("#main-content #network-proxies-edit").get(0));
+ activateNetworkProxyFormValidation();
+ activateNetworkProxyEditTab();
}
removeNetworkProxy=function(networkProxy){
if ($(e.target).attr("href")=="#network-proxies-edit") {
var viewModel = new NetworkProxyViewModel(new NetworkProxy(),false,networkProxiesViewModel);
ko.applyBindings(viewModel,$("#main-content #network-proxies-edit").get(0));
- //activateManagedRepositoryFormValidation();
+ activateNetworkProxyFormValidation();
}
if ($(e.target).attr("href")=="#network-proxies-view") {
$("#main-content #network-proxies-edit a").html($.i18n.prop("add"));
);
}
+ activateNetworkProxyFormValidation=function(){
+ $("#main-content #network-proxy-edit-form").validate();
+ }
+
activateNetworkProxiesGridTab=function(){
$("#main-content #network-proxies-view-tabs-li-edit").removeClass("active");
$("#main-content #network-proxies-edit").removeClass("active");
- // activate roles grid tab
+
$("#main-content #network-proxies-view-tabs-li-grid").addClass("active");
$("#main-content #network-proxies-view").addClass("active");
$("#main-content #network-proxies-view-tabs-li-edit a").html($.i18n.prop("add"));
}
activateNetworkProxyEditTab=function(){
- $("#main-content #remote-repositories-view-li").removeClass("active");
- $("#main-content #remote-repositories-view").removeClass("active");
- // activate role edit tab
- $("#main-content #remote-repository-edit-li").addClass("active");
- $("#main-content #remote-repository-edit").addClass("active");
+ $("#main-content #network-proxies-view-tabs-li-grid").removeClass("active");
+ $("#main-content #network-proxies-view").removeClass("active");
+
+ $("#main-content #network-proxies-view-tabs-li-edit").addClass("active");
+ $("#main-content #network-proxies-edit").addClass("active");
+
}
mapNetworkProxy=function(data){
activateManagedRepositoriesGridTab=function(){
$("#main-content #managed-repository-edit-li").removeClass("active");
$("#main-content #managed-repository-edit").removeClass("active");
- // activate roles grid tab
+
$("#main-content #managed-repositories-view-li").addClass("active");
$("#main-content #managed-repositories-view").addClass("active");
$("#main-content #managed-repository-edit-li a").html($.i18n.prop("add"));
activateManagedRepositoryEditTab=function(){
$("#main-content #managed-repositories-view-li").removeClass("active");
$("#main-content #managed-repositories-view").removeClass("active");
- // activate role edit tab
+
$("#main-content #managed-repository-edit-li").addClass("active");
$("#main-content #managed-repository-edit").addClass("active");
}
activateRemoteRepositoriesGridTab=function(){
$("#main-content #remote-repository-edit-li").removeClass("active");
$("#main-content #remote-repository-edit").removeClass("active");
- // activate roles grid tab
+
$("#main-content #remote-repositories-view-li").addClass("active");
$("#main-content #remote-repositories-view").addClass("active");
$("#main-content #remote-repository-edit-li a").html($.i18n.prop("add"));
activateRemoteRepositoryEditTab=function(){
$("#main-content #remote-repositories-view-li").removeClass("active");
$("#main-content #remote-repositories-view").removeClass("active");
- // activate role edit tab
+
$("#main-content #remote-repository-edit-li").addClass("active");
$("#main-content #remote-repository-edit").addClass("active");
}
<div class="clearfix">
<label for="port">${$.i18n.prop('port')}</label>
<div class="input">
- <input type="text" class="xlarge required" id="port" name="port" size="6"
+ <input type="text" class="xlarge required digits" id="port" name="port" size="6"
data-bind="value: networkProxy.port"/>
</div>
</div>
<div class="clearfix">
<label for="username">${$.i18n.prop('username')}</label>
<div class="input">
- <input type="text" class="xlarge required" id="username" name="username" size="50"
+ <input type="text" class="xlarge" id="username" name="username" size="50"
data-bind="value: networkProxy.username"/>
</div>
</div>
<div class="clearfix">
<label for="password">${$.i18n.prop('password')}</label>
<div class="input">
- <input type="text" class="xlarge required" id="password" name="password" size="50"
+ <input type="text" class="xlarge" id="password" name="password" size="50"
data-bind="value: networkProxy.password"/>
</div>
</div>
* @param passwordChangeRequired
* @param ownerViewModel
*/
- User=function(username, password, confirmPassword,fullName,email,permanent,validated,timestampAccountCreation,timestampLastLogin,timestampLastPasswordChange,locked,passwordChangeRequired,ownerViewModel) {
+ User=function(username, password, confirmPassword,fullName,email,permanent,validated,timestampAccountCreation,
+ timestampLastLogin,timestampLastPasswordChange,locked,passwordChangeRequired,ownerViewModel) {
// Potentially Editable Field.
this.username = ko.observable(username);
// Editable Fields.
* @param data User response from redback rest api
*/
mapUser=function(data) {
- return new User(data.username, data.password, null,data.fullName,data.email,data.permanent,data.validated,data.timestampAccountCreation,data.timestampLastLogin,data.timestampLastPasswordChange,data.locked,data.passwordChangeRequired,self);
+ return new User(data.username, data.password, null,data.fullName,data.email,data.permanent,data.validated,
+ data.timestampAccountCreation,data.timestampLastLogin,data.timestampLastPasswordChange,
+ data.locked,data.passwordChangeRequired,self);
}