reuse selector!

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1411408 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-11-19 21:02:08 +00:00
parent b74dfd1513
commit 90e2c00727
6 changed files with 35 additions and 38 deletions

View File

@ -521,9 +521,10 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
this.networkConfiguration=ko.observable(networkConfiguration); this.networkConfiguration=ko.observable(networkConfiguration);
save=function(){ save=function(){
$("#user-messages" ).html(mediumSpinnerImg()); var userMessages=$("#user-messages");
userMessages.html(mediumSpinnerImg());
var mainContent=$("#main-content"); var mainContent=$("#main-content");
if (!$("#main-content" ).find("#network-configuration-edit-form").valid()){ if (!mainContent.find("#network-configuration-edit-form").valid()){
return; return;
} }
mainContent.find("#network-configuration-btn-save" ).button('loading'); mainContent.find("#network-configuration-btn-save" ).button('loading');
@ -536,7 +537,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
displaySuccessMessage( $.i18n.prop("network-configuration.updated")); displaySuccessMessage( $.i18n.prop("network-configuration.updated"));
}, },
complete: function(){ complete: function(){
removeMediumSpinnerImg("#user-messages"); removeMediumSpinnerImg(userMessages);
mainContent.find("#network-configuration-btn-save" ).button('reset'); mainContent.find("#network-configuration-btn-save" ).button('reset');
} }
}); });
@ -605,7 +606,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
var self=this; var self=this;
save=function(){ save=function(){
var mainContent=$("#main-content" ); var mainContent=$("#main-content" );
$("#user-messages").html( mediumSpinnerImg()); var userMessages=$("#user-messages");
userMessages.html( mediumSpinnerImg());
mainContent.find("#ui-configuration-btn-save" ).button('loading'); mainContent.find("#ui-configuration-btn-save" ).button('loading');
$.ajax("restServices/archivaServices/archivaAdministrationService/setUiConfiguration", { $.ajax("restServices/archivaServices/archivaAdministrationService/setUiConfiguration", {
type: "POST", type: "POST",
@ -616,7 +618,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
displaySuccessMessage( $.i18n.prop("ui-configuration.updated")); displaySuccessMessage( $.i18n.prop("ui-configuration.updated"));
}, },
complete: function(){ complete: function(){
removeMediumSpinnerImg("#user-messages"); removeMediumSpinnerImg(userMessages);
mainContent.find("#ui-configuration-btn-save" ).button('reset'); mainContent.find("#ui-configuration-btn-save" ).button('reset');
} }
}); });
@ -856,7 +858,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
return; return;
} }
clearUserMessages(); clearUserMessages();
$("#user-messages" ).html(mediumSpinnerImg()); var userMessages=$("#user-messages");
userMessages.html(mediumSpinnerImg());
mainContent.find("#appearance-configuration-btn-save" ).button('loading'); mainContent.find("#appearance-configuration-btn-save" ).button('loading');
$.ajax("restServices/archivaServices/archivaAdministrationService/setOrganisationInformation", { $.ajax("restServices/archivaServices/archivaAdministrationService/setOrganisationInformation", {
type: "POST", type: "POST",
@ -871,7 +874,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
displayErrorMessage($.i18n.prop('appearance-configuration.updating-error')); displayErrorMessage($.i18n.prop('appearance-configuration.updating-error'));
}, },
complete: function(){ complete: function(){
removeMediumSpinnerImg("#user-messages"); removeMediumSpinnerImg(userMessages);
mainContent.find("#appearance-configuration-btn-save" ).button('reset'); mainContent.find("#appearance-configuration-btn-save" ).button('reset');
} }
}); });

View File

@ -88,7 +88,8 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra
this.saveProxyConnectorRule=function(proxyConnectorRule,url,add,completeFnCallback){ this.saveProxyConnectorRule=function(proxyConnectorRule,url,add,completeFnCallback){
$.log("saveProxyConnectorRule:"+url); $.log("saveProxyConnectorRule:"+url);
$("#user-messages" ).html(mediumSpinnerImg()); var userMessages=$("#user-messages");
userMessages.html(mediumSpinnerImg());
$.ajax(url, $.ajax(url,
{ {
type: "POST", type: "POST",
@ -112,7 +113,7 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra
displayRestError(res); displayRestError(res);
}, },
complete:function(data){ complete:function(data){
removeMediumSpinnerImg("#user-messages"); removeMediumSpinnerImg(userMessages);
if(completeFnCallback){ if(completeFnCallback){
completeFnCallback(); completeFnCallback();
} }
@ -134,7 +135,8 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra
this.deleteProxyConnectorRule=function(proxyConnectorRule){ this.deleteProxyConnectorRule=function(proxyConnectorRule){
$("#main-content" ).find("proxy-connectors-rules-view-tabsTable").find(".btn").button("loading"); $("#main-content" ).find("proxy-connectors-rules-view-tabsTable").find(".btn").button("loading");
$("#user-messages" ).html(mediumSpinnerImg()); var userMessages=$("#user-messages");
userMessages.html(mediumSpinnerImg());
$.ajax("restServices/archivaServices/proxyConnectorRuleService/deleteProxyConnectorRule", $.ajax("restServices/archivaServices/proxyConnectorRuleService/deleteProxyConnectorRule",
{ {
type:"POST", type:"POST",
@ -151,7 +153,7 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra
displayRestError(res); displayRestError(res);
}, },
complete:function(data){ complete:function(data){
removeMediumSpinnerImg("#user-messages"); removeMediumSpinnerImg(userMessages);
$("#main-content" ).find("proxy-connectors-rules-view-tabsTable").find(".btn").button("reset"); $("#main-content" ).find("proxy-connectors-rules-view-tabsTable").find(".btn").button("reset");
} }
} }
@ -278,7 +280,8 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra
screenChange(); screenChange();
var mainContent = $("#main-content"); var mainContent = $("#main-content");
mainContent.html($("#proxyConnectorsRulesMain").tmpl()); mainContent.html($("#proxyConnectorsRulesMain").tmpl());
$("#user-messages").html(mediumSpinnerImg()); var userMessages=$("#user-messages");
userMessages.html(mediumSpinnerImg());
loadAllProxyConnectors(function(data){ loadAllProxyConnectors(function(data){
var proxyConnectors = mapProxyConnectors(data); var proxyConnectors = mapProxyConnectors(data);
@ -292,7 +295,7 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra
activateProxyConnectorRulesGridTab(); activateProxyConnectorRulesGridTab();
}, },
complete: function(data){ complete: function(data){
removeMediumSpinnerImg("#user-messages"); removeMediumSpinnerImg(userMessages);
} }
}); });

View File

@ -204,7 +204,8 @@ define("archiva.proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jq
this.save=function(){ this.save=function(){
//FIXME data controls !!! //FIXME data controls !!!
clearUserMessages(); clearUserMessages();
$("#user-messages" ).html(mediumSpinnerImg()); var userMessages=$("#user-messages");
userMessages.html(mediumSpinnerImg());
$("#proxy-connector-btn-save" ).button("loading"); $("#proxy-connector-btn-save" ).button("loading");
// update is delete then add // update is delete then add
if (this.update){ if (this.update){
@ -224,7 +225,7 @@ define("archiva.proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jq
displayRestError(res); displayRestError(res);
}, },
complete: function(){ complete: function(){
removeMediumSpinnerImg("#user-messages"); removeMediumSpinnerImg(userMessages);
$("#proxy-connector-btn-save" ).button("reset"); $("#proxy-connector-btn-save" ).button("reset");
} }
} }
@ -248,7 +249,7 @@ define("archiva.proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jq
displayRestError(res); displayRestError(res);
}, },
complete: function(){ complete: function(){
removeMediumSpinnerImg("#user-messages"); removeMediumSpinnerImg(userMessages);
$("#proxy-connector-btn-save" ).button("reset"); $("#proxy-connector-btn-save" ).button("reset");
} }
} }

View File

@ -244,7 +244,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
}, },
complete: function(){ complete: function(){
$("#managed-repository-save-button" ).button('reset'); $("#managed-repository-save-button" ).button('reset');
removeMediumSpinnerImg("#user-messages"); removeMediumSpinnerImg(userMessages);
} }
}); });
} }
@ -561,7 +561,8 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
} }
mergeRepo=function(managedRepository){ mergeRepo=function(managedRepository){
$("#user-messages" ).html(mediumSpinnerImg()); var userMessages=$("#user-messages");
userMessages.html(mediumSpinnerImg());
// is there any artifacts to merge ? // is there any artifacts to merge ?
var artifactsNumberUrl = "restServices/archivaServices/browseService/artifacts/"+encodeURIComponent(managedRepository.id()); var artifactsNumberUrl = "restServices/archivaServices/browseService/artifacts/"+encodeURIComponent(managedRepository.id());
$.ajax(artifactsNumberUrl,{ $.ajax(artifactsNumberUrl,{
@ -595,8 +596,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
}, },
complete: function(){ complete: function(){
$.log("complete removeMediumSpinnerImg"); removeMediumSpinnerImg(userMessages);
removeMediumSpinnerImg("#user-messages");
} }
} }
); );
@ -647,7 +647,8 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
doMerge=function(sourceRepository,targetRepository,skipConflicts){ doMerge=function(sourceRepository,targetRepository,skipConflicts){
$.log("doMerge:"+sourceRepository+" to " + targetRepository + ", skipConflicts: " + skipConflicts); $.log("doMerge:"+sourceRepository+" to " + targetRepository + ", skipConflicts: " + skipConflicts);
window.modalMergeRepoDialog.modal('hide'); window.modalMergeRepoDialog.modal('hide');
$("#user-messages" ).html(mediumSpinnerImg()); var userMessages=$("#user-messages");
userMessages.html(mediumSpinnerImg());
var url = "restServices/archivaServices/mergeRepositoriesService/mergeRepositories/"+encodeURIComponent(sourceRepository); var url = "restServices/archivaServices/mergeRepositoriesService/mergeRepositories/"+encodeURIComponent(sourceRepository);
url+="/"+encodeURIComponent(targetRepository); url+="/"+encodeURIComponent(targetRepository);
url+="/"+skipConflicts; url+="/"+skipConflicts;
@ -658,7 +659,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
displaySuccessMessage($.i18n.prop("managedrepository.merge.success", sourceRepository,targetRepository)); displaySuccessMessage($.i18n.prop("managedrepository.merge.success", sourceRepository,targetRepository));
}, },
complete: function(){ complete: function(){
removeMediumSpinnerImg("#user-messages"); removeMediumSpinnerImg(userMessages);
} }
}); });
} }
@ -1181,7 +1182,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
ko.applyBindings(managedRepositoriesViewModel,mainContent.find("#managed-repositories-view").get(0)); ko.applyBindings(managedRepositoriesViewModel,mainContent.find("#managed-repositories-view").get(0));
activatePopoverDoc(); activatePopoverDoc();
mainContent.find("#managed-repositories-pills #managed-repositories-view-a").tab('show'); mainContent.find("#managed-repositories-pills #managed-repositories-view-a").tab('show');
removeMediumSpinnerImg("#main-content #managed-repositories-content"); removeMediumSpinnerImg(mainContent.find("#managed-repositories-content"));
activateManagedRepositoriesGridTab(); activateManagedRepositoriesGridTab();
if(successFnManagedRepositories){ if(successFnManagedRepositories){
successFnManagedRepositories(managedRepositoriesViewModel); successFnManagedRepositories(managedRepositoriesViewModel);
@ -1220,7 +1221,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
var mainContent = $("#main-content"); var mainContent = $("#main-content");
ko.applyBindings(remoteRepositoriesViewModel,mainContent.find("#remote-repositories-view").get(0)); ko.applyBindings(remoteRepositoriesViewModel,mainContent.find("#remote-repositories-view").get(0));
mainContent.find("#remote-repositories-pills #remote-repositories-view-a").tab('show') mainContent.find("#remote-repositories-pills #remote-repositories-view-a").tab('show')
removeMediumSpinnerImg("#main-content #remote-repositories-content"); removeMediumSpinnerImg(mainContent.find("#remote-repositories-content"));
activatePopoverDoc(); activatePopoverDoc();
if(successFnRemoteRepositories){ if(successFnRemoteRepositories){
successFnRemoteRepositories(managedRepositoriesViewModel); successFnRemoteRepositories(managedRepositoriesViewModel);

View File

@ -207,7 +207,8 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
this.saveRepositoryGroup=function(repositoryGroup){ this.saveRepositoryGroup=function(repositoryGroup){
clearUserMessages(); clearUserMessages();
$("#user-messages").html(mediumSpinnerImg()); var userMessages=$("#user-messages");
userMessages.html(mediumSpinnerImg());
$("#repository-group-save" ).button('loading'); $("#repository-group-save" ).button('loading');
$.ajax("restServices/archivaServices/repositoryGroupService/updateRepositoryGroup", $.ajax("restServices/archivaServices/repositoryGroupService/updateRepositoryGroup",
{ {
@ -227,7 +228,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
}, },
complete:function(data){ complete:function(data){
$("#repository-group-save" ).button('reset'); $("#repository-group-save" ).button('reset');
removeMediumSpinnerImg("#user-messages"); removeMediumSpinnerImg(userMessages);
} }
} }
); );

View File

@ -86,15 +86,12 @@
{{/each}} {{/each}}
<th>Releases</th> <th>Releases</th>
<th>Snapshots</th> <th>Snapshots</th>
<!--th title="${$.i18n.prop('managedrepository.scan.index')}">${$.i18n.prop('managedrepository.scan.grid.header')}</th-->
<th>${$.i18n.prop('managedrepository.actions')}</th> <th>${$.i18n.prop('managedrepository.actions')}</th>
<th>${$.i18n.prop('edit')}</th> <th>${$.i18n.prop('edit')}</th>
<th>${$.i18n.prop('delete')}</th> <th>${$.i18n.prop('delete')}</th>
<th>${$.i18n.prop('modified')}</th> <th>${$.i18n.prop('modified')}</th>
<!--th>${$.i18n.prop('description')}</th-->
<th>${$.i18n.prop('managed.repository.rss.header')}</th> <th>${$.i18n.prop('managed.repository.rss.header')}</th>
<th title="${$.i18n.prop('managedrepository.stats')}">${$.i18n.prop('managedrepository.stats.grid.header')}</th> <th title="${$.i18n.prop('managedrepository.stats')}">${$.i18n.prop('managedrepository.stats.grid.header')}</th>
<!--th title="${$.i18n.prop('managedrepository.scan.directories')}">${$.i18n.prop('managedrepository.scan.directories.grid.header')}</th-->
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -187,15 +184,6 @@
<td> <td>
<a href="${row.feedsUrl}"><img src="images/atom.gif" alt="" title="${$.i18n.prop('managedrepository.feeds')} ${row.name()}"/></a> <a href="${row.feedsUrl}"><img src="images/atom.gif" alt="" title="${$.i18n.prop('managedrepository.feeds')} ${row.name()}"/></a>
</td> </td>
<!--td>
{{if row.description()}}
<a class="btn btn-warning btn-mini popover-doc" id="managedrepo-description-help"
data-content="${row.description()}" data-title="${$.i18n.prop('description')}"
data-placement="left">
<i class="icon-question-sign icon-white"></i>
</a>
{{/if}}
</td-->
<td id="managedrepository-stats-${row.id()}"> <td id="managedrepository-stats-${row.id()}">
<img src="images/utilities-system-monitor-22-22.png" data-original-title="${$.i18n.prop('managedrepository.stats')}" <img src="images/utilities-system-monitor-22-22.png" data-original-title="${$.i18n.prop('managedrepository.stats')}"
data-bind="event: { mouseover: function(){ showStats(row) }, mouseout: function(){ hideStats(row) },}" data-bind="event: { mouseover: function(){ showStats(row) }, mouseout: function(){ hideStats(row) },}"