});
}
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,
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) {
},
complete:function(data){
removeMediumSpinnerImg("#user-messages");
+ if(completeFnCallback){
+ completeFnCallback();
+ }
}
}
);
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",
{
},
complete:function(data){
removeMediumSpinnerImg("#user-messages");
+ //$("#proxy-connector-rule-delete-btn" ).button("reset");
}
}
);
</a>
</td>
<td>
- <a href="#" data-bind="click: function(){ removeProxyConnectorRule(row) }">
+ <a href="#" data-bind="click: function(){ removeProxyConnectorRule(row) }" data-loading-text="${$.i18n.prop('common.loading')}">
<span class="btn btn-danger">
<i class="icon-trash icon-white"/>
</span>
</td>
<td>
{{if row.modified()}}
- <a href="#" class="btn btn-warning" data-bind="click: function(){ updateProxyConnectorRule(row) }">${$.i18n.prop('save')}</a>
+ <a href="#" id="proxy-connector-rule-update-btn" class="btn btn-warning" data-loading-text="${$.i18n.prop('common.loading')}"
+ data-bind="click: function(){ updateProxyConnectorRule(row) }">${$.i18n.prop('save')}</a>
{{/if}}
</td>
</tr>
{{/if}}
{{if proxyConnectorRule.modified()}}
<div class="span3">
- <a href="#" class="btn btn-warning" data-bind="click: function(){addProxyConnectorRule(proxyConnectorRule)}">${$.i18n.prop('save')}</a>
+ {{if update}}
+ <a href="#" class="btn btn-warning" data-loading-text="${$.i18n.prop('common.loading')}"
+ id="proxy-connector-rule-update-btn" data-bind="click: function(){updateProxyConnectorRule(proxyConnectorRule)}">${$.i18n.prop('update')}</a>
+ {{else}}
+ <a href="#" class="btn btn-warning" data-loading-text="${$.i18n.prop('common.loading')}"
+ id="proxy-connector-rule-add-btn" data-bind="click: function(){addProxyConnectorRule(proxyConnectorRule)}">${$.i18n.prop('add')}</a>
+ {{/if}}
</div>
+
<br/>
{{/if}}
</div>