]> source.dussan.org Git - archiva.git/commitdiff
configure cron expression to merge remote indexes tru the UI
authorOlivier Lamy <olamy@apache.org>
Tue, 17 Dec 2013 07:28:16 +0000 (07:28 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 17 Dec 2013 07:28:16 +0000 (07:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551471 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java
archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repository-groups.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html

index df3f41f89f63ea730bf97980aab721515effdcac..fc5169ff29849e0a4c2c3676d3bc25ad6f586323 100644 (file)
           <description>The time to live of the merged index of the repository group.</description>
         </field>
         <field>
-          <name>mergedIndexCronExpression</name>
+          <name>cronExpression</name>
           <version>1.0.0+</version>
           <type>String</type>
           <description>
index 535d309d4a0893f6e43295d900e8734001a19959..2064cc026fe82b44b9ebd10eb6df2fd0ecbf355d 100644 (file)
@@ -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();
     }
index df9dade1a6dba47d5657baf9a307bc100a67c013..be56ca1f8c8d3213ea201f911679e84807cca802 100644 (file)
@@ -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)
index f323c26ff4e92f3eeac3b5eea11a180880bfae2c..474466313872642a042f975caa768f40e9710b66 100644 (file)
@@ -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);
   }
 
 });
index 0544adf680ec6c4958f95a086249323c16ce9ac1..9a6564b419b559daa8bd3d673e3ce2351284edfc 100644 (file)
                        data-bind="value: repositoryGroup.mergedIndexTtl"/>
             </div>
           </div>
+          <div class="control-group">
+            <label class="control-label" for="cronExpression">${$.i18n.prop('repository.group.cronExpression')}</label>
+            <div class="controls">
+              <input type="text" class="input-large" id="cronExpression" name="cronExpression"
+                     data-bind="value: repositoryGroup.cronExpression"/>
+            </div>
+          </div>
           <div>
             <a href="${window.archivaRuntimeInfo.baseUrl}/repository/${repositoryGroup.id()}" target="_blank">
             {{if repositoryGroup.id()}}