From: Olivier Lamy Date: Sun, 21 Apr 2013 23:36:42 +0000 (+0000) Subject: [MRM-1745] path of merged index for group configurable X-Git-Tag: archiva-1.4-M4~75 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=91d0c17bfe5756f698927ffee1bcd837a045e2ae;p=archiva.git [MRM-1745] path of merged index for group configurable path configurable tru the ui git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1470365 13f79535-47bb-0310-9956-ffa450edef68 --- 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 992a68ec3..d47fc23a2 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 @@ -311,6 +311,7 @@ repository.groups.available.repositories=Available Repositories repository.groups.list=Repository Groups repository-groups.grid.tab.title=Repository Groups repository.group.delete.confirm=Are you sure to delete Repository Group {0} ? +repository.group.mergedIndexPath=Merged Index Path #roles roles.bulk.save.confirm=Are you sure to update {0} Role(s) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js index 6b124d6a4..e63d0f2d8 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js @@ -740,7 +740,6 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa }); - }); }; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js index 98cdd9323..cfa68350d 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js @@ -20,7 +20,7 @@ define("archiva.repository-groups",["jquery","i18n","jquery.tmpl","bootstrap","j ,"knockout.simpleGrid","knockout.sortable"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) { - RepositoryGroup=function(id,repositories){ + RepositoryGroup=function(id,repositories,mergedIndexPath){ var self=this; @@ -28,6 +28,10 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) { this.id=ko.observable(id); this.id.subscribe(function(newValue){self.modified(true)}); + //private String mergedIndexPath = "/.indexer"; + this.mergedIndexPath=ko.observable(mergedIndexPath?mergedIndexPath:".indexer"); + this.mergedIndexPath.subscribe(function(newValue){self.modified(true)}); + // private List repositories; this.repositories=ko.observableArray(repositories); this.repositories.subscribe(function(newValue){self.modified(true)}); @@ -192,6 +196,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) { repositoryGroupViewModel.renderSortableChoosed(self); repositoryGroupViewModel.renderSortableAvailables(self); mainContent.find("#repository-groups-view-tabs-li-edit" ).find("a").html($.i18n.prop("edit")); + repositoryGroupValidator(); } }); } @@ -206,32 +211,39 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) { } this.saveRepositoryGroup=function(repositoryGroup){ - clearUserMessages(); - var userMessages=$("#user-messages"); - userMessages.html(mediumSpinnerImg()); - $("#repository-group-save" ).button('loading'); - $.ajax("restServices/archivaServices/repositoryGroupService/updateRepositoryGroup", - { - type: "POST", - contentType: 'application/json', - data:ko.toJSON(repositoryGroup), - dataType: 'json', - success: function(data) { - $.log("update repositoryGroup id:"+repositoryGroup.id()); - var message=$.i18n.prop('repository.group.updated',repositoryGroup.id()); - displaySuccessMessage(message); - repositoryGroup.modified(false); - }, - error: function(data) { - var res = $.parseJSON(data.responseText); - displayRestError(res); - }, - complete:function(data){ - $("#repository-group-save" ).button('reset'); - removeMediumSpinnerImg(userMessages); - } + if(valid==false){ + $.log("saveRepositoryGroup, valid:"+valid); + return; + } + clearUserMessages(); + var userMessages=$("#user-messages"); + userMessages.html(mediumSpinnerImg()); + var valid = $("#main-content").find("#repository-group-edit-form" ).valid(); + + + $("#repository-group-save" ).button('loading'); + $.ajax("restServices/archivaServices/repositoryGroupService/updateRepositoryGroup", + { + type: "POST", + contentType: 'application/json', + data:ko.toJSON(repositoryGroup), + dataType: 'json', + success: function(data) { + $.log("update repositoryGroup id:"+repositoryGroup.id()); + var message=$.i18n.prop('repository.group.updated',repositoryGroup.id()); + displaySuccessMessage(message); + repositoryGroup.modified(false); + }, + error: function(data) { + var res = $.parseJSON(data.responseText); + displayRestError(res); + }, + complete:function(data){ + $("#repository-group-save" ).button('reset'); + removeMediumSpinnerImg(userMessages); } - ); + } + ); } @@ -359,6 +371,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) { } activateRepositoryGroupEditTab=function(){ + $.log("activateRepositoryGroupEditTab"); var mainContent = $("#main-content"); mainContent.find("#repository-groups-view-tabs-content div[class*='tab-pane']").removeClass("active"); @@ -366,6 +379,27 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) { mainContent.find("#repository-groups-edit").addClass("active"); mainContent.find("#repository-groups-view-tabs-li-edit").addClass("active"); + + + } + + repositoryGroupValidator=function(){ + $.log("validator"); + var theForm=$("#main-content").find("#repository-group-edit-form"); + var validator = theForm.validate({ + rules: { + id: { + required: true + }, + mergedIndexPath:{ + required:true + } + }, + showErrors: function(validator, errorMap, errorList) { + customShowError("#main-content #repository-group-edit-form",validator,errorMap,errorMap); + } + }); + return validator; } mapRepositoryGroups=function(data){ @@ -379,7 +413,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) { } mapRepositoryGroup=function(data){ - return new RepositoryGroup(data.id, mapStringArray(data.repositories)); + return new RepositoryGroup(data.id, mapStringArray(data.repositories),data.mergedIndexPath); } }); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html index 6b0bc0ac3..013b1c85f 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html @@ -1426,32 +1426,35 @@