From 4f2f7f1351a5de6a593f3a1913052d882a1b64a7 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 2 Oct 2012 15:13:53 +0000 Subject: [PATCH] fixing update git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1392957 13f79535-47bb-0310-9956-ffa450edef68 --- .../js/archiva/proxy-connectors-rules.js | 25 ++++++++++++++----- .../js/templates/archiva/repositories.html | 14 ++++++++--- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js index 9df238a8f..75c5f7c3e 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js @@ -55,11 +55,12 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra }); } addProxyConnectorRule=function(proxyConnectorRule){ + $("#proxy-connector-rule-add-btn" ).button("loading"); $.log("addProxyConnectorRule"); - self.saveProxyConnectorRule(proxyConnectorRule,"restServices/archivaServices/proxyConnectorRuleService/proxyConnectorRule"); + self.saveProxyConnectorRule(proxyConnectorRule,"restServices/archivaServices/proxyConnectorRuleService/proxyConnectorRule",true); } - this.saveProxyConnectorRule=function(proxyConnectorRule,url){ + this.saveProxyConnectorRule=function(proxyConnectorRule,url,add,completeFnCallback){ $.log("saveProxyConnectorRule:"+url); $("#user-messages" ).html(mediumSpinnerImg()); $.ajax(url, @@ -70,10 +71,12 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra dataType: 'json', success: function(data) { $.log("save proxyConnectorRule pattern:"+proxyConnectorRule.pattern()); - var message=$.i18n.prop(self.update?'proxy-connector-rule.updated':'proxy-connector-rule.added',proxyConnectorRule.pattern()); + var message=$.i18n.prop(add?'proxy-connector-rule.added':'proxy-connector-rule.updated',proxyConnectorRule.pattern()); displaySuccessMessage(message); proxyConnectorRule.modified(false); - self.proxyConnectorRules.push(proxyConnectorRule); + if(add){ + self.proxyConnectorRules.push(proxyConnectorRule); + } activateProxyConnectorRulesGridTab(); }, error: function(data) { @@ -82,6 +85,9 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra }, complete:function(data){ removeMediumSpinnerImg("#user-messages"); + if(completeFnCallback){ + completeFnCallback(); + } } } ); @@ -89,13 +95,19 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra updateProxyConnectorRule=function(proxyConnectorRule){ $.log("updateProxyConnectorRule"); - self.saveProxyConnectorRule(proxyConnectorRule,"restServices/archivaServices/proxyConnectorRuleService/updateProxyConnectorRule"); + $("#main-content" ).find("#proxy-connectors-rules-edit-div").find("#proxy-connector-rule-update-btn").button("loading"); + self.saveProxyConnectorRule(proxyConnectorRule,"restServices/archivaServices/proxyConnectorRuleService/updateProxyConnectorRule", + false, + function(){ + $("#proxy-connector-rule-update-btn" ).button("reset"); + } + ); } removeProxyConnectorRule=function(proxyConnectorRule){ //FIXME modal dialog to confirm - + //$("#proxy-connector-rule-delete-btn" ).button("loading"); $("#user-messages" ).html(mediumSpinnerImg()); $.ajax("restServices/archivaServices/proxyConnectorRuleService/deleteProxyConnectorRule", { @@ -113,6 +125,7 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra }, complete:function(data){ removeMediumSpinnerImg("#user-messages"); + //$("#proxy-connector-rule-delete-btn" ).button("reset"); } } ); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/repositories.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/repositories.html index 01e489669..29fb981b6 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/repositories.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/repositories.html @@ -1303,7 +1303,7 @@ - + @@ -1311,7 +1311,8 @@ {{if row.modified()}} - ${$.i18n.prop('save')} + ${$.i18n.prop('save')} {{/if}} @@ -1357,8 +1358,15 @@ {{/if}} {{if proxyConnectorRule.modified()}}
- ${$.i18n.prop('save')} + {{if update}} + ${$.i18n.prop('update')} + {{else}} + ${$.i18n.prop('add')} + {{/if}}
+
{{/if}}