From 1bea9f16809de4bc9abd077681c4f3eae27a4a2a Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 13 Feb 2012 09:47:25 +0000 Subject: [PATCH] implements bulk save mode for remote repositories management git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1243456 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/archiva/i18n/default.properties | 3 ++ .../webapp/js/archiva/proxy-connectors.js | 1 + .../main/webapp/js/archiva/repositories.js | 39 +++++++++++++++++-- .../js/archiva/templates/repositories.html | 15 +++++++ 4 files changed, 55 insertions(+), 3 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index 9b3787ee0..f8946c99b 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -92,6 +92,9 @@ remoteDownloadNetworkProxyId=Proxy for Remote Download Index downloadRemoteIndexOnStartup=Download Remote Index on Startup remoteDownloadTimeout=Download Remote Timeout remoterepository.added=Remote Repository added. +remoterepositories.bulk.save.confirm=Are you sure to update {0} Remote Repository(ies) +remoterepositories.bulk.save.confirm.title=Remote Repositories Bulk Save +remoterepository.updated=Remote Repository {0} updated. #network proxy networkproxy.updated=Network Proxy " {0} " updated. diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js index 5e3da5fff..d1c2d312a 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js @@ -310,6 +310,7 @@ $(function() { activateProxyConnectorsEditTab(); mainContent.find("#proxy-connectors-view-tabs-li-edit a").html($.i18n.prop("edit")); } + deleteProxyConnector=function(proxyConnector){ openDialogConfirm( diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js index 4217f9a05..f7473c8ff 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js @@ -610,7 +610,7 @@ $(function() { this.availableLayouts = window.managedRepositoryTypes; - save=function(){ + this.save=function(){ var valid = $("#main-content #remote-repository-edit-form").valid(); if (valid==false) { return; @@ -624,8 +624,9 @@ $(function() { contentType: 'application/json', dataType: 'json', success: function(data) { - displaySuccessMessage($.i18n.prop('remoterepository.updated')); + displaySuccessMessage($.i18n.prop('remoterepository.updated',self.remoteRepository.id())); activateRemoteRepositoriesGridTab(); + self.remoteRepository.modified(false); }, error: function(data) { var res = $.parseJSON(data.responseText); @@ -706,6 +707,38 @@ $(function() { } + this.bulkSave=function(){ + return getModifiedRemoteRepositories().length>0; + } + + getModifiedRemoteRepositories=function(){ + var prx = $.grep(self.remoteRepositories(), + function (remoteRepository,i) { + return remoteRepository.modified(); + }); + return prx; + } + + updateModifiedRemoteRepositories=function(){ + var modifiedRemoteRepositories = getModifiedRemoteRepositories(); + + openDialogConfirm(function(){ + for(i=0;i
+
@@ -310,6 +311,7 @@ {{/each}} ${$.i18n.prop('edit')} ${$.i18n.prop('delete')} + ${$.i18n.prop('modified')} ${$.i18n.prop('remoterepository.downloadremoteindex')} @@ -327,6 +329,13 @@ + {{if row.modified()}} + + ${$.i18n.prop('save')} + + {{else}} + + {{/if}} @@ -459,4 +468,10 @@ {{if bulkSave()}} ${$.i18n.prop('save.all')} {{/if}} + + + \ No newline at end of file