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
This commit is contained in:
Olivier Lamy 2013-12-17 07:28:16 +00:00
parent f7cdee7b23
commit dcd4afcdb8
5 changed files with 33 additions and 12 deletions

View File

@ -857,7 +857,7 @@
<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>

View 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();
}

View 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)

View 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);
}
});

View File

@ -1449,6 +1449,13 @@
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()}}