diff options
author | Olivier Lamy <olamy@apache.org> | 2012-03-08 20:30:05 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-03-08 20:30:05 +0000 |
commit | b9a320a2da64b48cc702bcfaf72fc2776b767b2f (patch) | |
tree | d1fe9362ef30d68fc543ca65d9ebf2fce8bc8fe2 /archiva-modules | |
parent | cef700f000e69c17cdc14d7ff2213238fbcef87e (diff) | |
download | archiva-b9a320a2da64b48cc702bcfaf72fc2776b767b2f.tar.gz archiva-b9a320a2da64b48cc702bcfaf72fc2776b767b2f.zip |
[MRM-1581] rewrite network configuration page.
add validation.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1298563 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js | 8 | ||||
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js index 339fdbaf9..c0619a601 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js @@ -520,6 +520,9 @@ $(function() { this.networkConfiguration=ko.observable(networkConfiguration); save=function(){ + if (!$("#main-content #network-proxy-edit-form").valid()){ + return; + } clearUserMessages(); $.ajax("restServices/archivaServices/archivaAdministrationService/setNetworkConfiguration", { type: "POST", @@ -544,6 +547,11 @@ $(function() { var networkConfiguration=new NetworkConfiguration(data.maxTotal,data.maxTotalPerHost,data.usePooling); var networkConfigurationViewModel=new NetworkConfigurationViewModel(networkConfiguration); ko.applyBindings(networkConfigurationViewModel,mainContent.get(0)); + var validator = $("#main-content #network-proxy-edit-form").validate({ + showErrors: function(validator, errorMap, errorList) { + customShowError(mainContent.find("#network-proxy-edit-form" ).get(0),validator,errorMap,errorMap); + } + }); } }); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js index 08ec9fd9b..eee85a132 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js @@ -285,8 +285,8 @@ displayRestError=function(data,idToAppend){ * @param errorList */ customShowError=function(selector, validator, errorMap, errorList) { - $(selector ).find("div.control-group" ).removeClass( "error" ); - $(selector).find("span.help-inline").remove(); + $.isFunction(selector)? selector.find("div.control-group" ).removeClass( "error" ):$(selector).find("div.control-group" ).removeClass( "error" ); + $.isFunction(selector)? selector.find("span.help-inline").remove():$(selector).find("span.help-inline").remove(); for ( var i = 0; errorList[i]; i++ ) { var error = errorList[i]; var field = $("#"+error.element.id); |