From dcd4afcdb83196959206d4e2d95f114976bea848 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 17 Dec 2013 07:28:16 +0000 Subject: [PATCH] configure cron expression to merge remote indexes tru the UI git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551471 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/mdo/configuration.mdo | 2 +- .../admin/model/beans/RepositoryGroup.java | 14 ++++++------- .../apache/archiva/i18n/default.properties | 1 + .../repository/maven2/repository-groups.js | 21 +++++++++++++++---- .../js/templates/archiva/repositories.html | 7 +++++++ 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo index df3f41f89..fc5169ff2 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo @@ -857,7 +857,7 @@ The time to live of the merged index of the repository group. - mergedIndexCronExpression + cronExpression 1.0.0+ String diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java index 535d309d4..2064cc026 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java @@ -55,7 +55,7 @@ public class RepositoryGroup * default model value is empty so none * @since 2.0.0 */ - private String mergedIndexCronExpression; + private String cronExpression; public RepositoryGroup() { @@ -166,19 +166,19 @@ public class RepositoryGroup return this; } - public String getMergedIndexCronExpression() + public String getCronExpression() { - return mergedIndexCronExpression; + return cronExpression; } - public void setMergedIndexCronExpression( String mergedIndexCronExpression ) + public void setCronExpression( String cronExpression ) { - this.mergedIndexCronExpression = mergedIndexCronExpression; + this.cronExpression = cronExpression; } public RepositoryGroup mergedIndexCronExpression( String mergedIndexCronExpression ) { - this.mergedIndexCronExpression = mergedIndexCronExpression; + this.cronExpression = mergedIndexCronExpression; return this; } @@ -215,7 +215,7 @@ public class RepositoryGroup sb.append( ", repositories=" ).append( repositories ); sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' ); sb.append( ", mergedIndexTtl=" ).append( mergedIndexTtl ); - sb.append( ", mergedIndexCronExpression='" ).append( mergedIndexCronExpression ).append( '\'' ); + sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' ); sb.append( '}' ); return sb.toString(); } 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 df9dade1a..be56ca1f8 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 @@ -314,6 +314,7 @@ 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 repository.group.mergedIndexTtl=Merged Index Time to Live (in Minutes) +repository.group.cronExpression=Cron expression to merge remote indexes #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/admin/repository/maven2/repository-groups.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repository-groups.js index f323c26ff..474466313 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repository-groups.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repository-groups.js @@ -20,7 +20,7 @@ define("archiva/admin/repository/maven2/repository-groups",["jquery","jquery.ui" ,"knockout.simpleGrid","knockout.sortable","archiva/admin/repository/maven2/repositories"], function(jquery,jqueryUi,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { - RepositoryGroup=function(id,repositories,mergedIndexPath,mergedIndexTtl){ + RepositoryGroup=function(id,repositories,mergedIndexPath,mergedIndexTtl,cronExpression){ var self=this; @@ -44,6 +44,9 @@ function(jquery,jqueryUi,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { this.managedRepositories=ko.observableArray([]); this.managedRepositories.subscribe(function(newValue){self.modified(true)}); + this.cronExpression = ko.observable(cronExpression); + this.cronExpression.subscribe(function(newValue){self.modified(true)}); + this.modified=ko.observable(false); } @@ -223,7 +226,9 @@ function(jquery,jqueryUi,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { var userMessages=$("#user-messages"); userMessages.html(mediumSpinnerImg()); var valid = $("#main-content").find("#repository-group-edit-form" ).valid(); - + if (valid==false) { + return; + } $("#repository-group-save" ).button('loading'); $.ajax("restServices/archivaServices/repositoryGroupService/updateRepositoryGroup", @@ -395,15 +400,22 @@ function(jquery,jqueryUi,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { rules: { id: { required: true - }, + }, mergedIndexPath:{ required:true + }, + cronExpression: { + remote: { + url: "restServices/archivaServices/commonServices/validateCronExpression", + type: "get" } + } }, showErrors: function(validator, errorMap, errorList) { customShowError("#main-content #repository-group-edit-form",validator,errorMap,errorMap); } }); + validator.settings.messages["cronExpression"]=$.i18n.prop("cronExpression.notvalid"); return validator; } @@ -418,7 +430,8 @@ function(jquery,jqueryUi,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { } mapRepositoryGroup=function(data){ - return new RepositoryGroup(data.id, mapStringArray(data.repositories),data.mergedIndexPath,data.mergedIndexTtl); + return new RepositoryGroup(data.id, mapStringArray(data.repositories),data.mergedIndexPath + ,data.mergedIndexTtl,data.cronExpression); } }); 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 0544adf68..9a6564b41 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 @@ -1449,6 +1449,13 @@ data-bind="value: repositoryGroup.mergedIndexTtl"/> +
+ +
+ +
+
{{if repositoryGroup.id()}} -- 2.39.5