[MRM-1574] add select box for defining repository type.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1232878 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-01-18 13:43:23 +00:00
parent b480558763
commit 31b57ea2d1
2 changed files with 45 additions and 4 deletions

View File

@ -18,6 +18,19 @@
*/ */
$(function() { $(function() {
// FIXME this must be dynamic if we do a plugin mechanism with dynamic repositories types
// FIXME i18n
ManagedRepositoryType=function(type,label){
this.type=type;
this.label=label;
}
window.managedRepositoryTypes = [
new ManagedRepositoryType("default","Maven 2.x Repository"),
new ManagedRepositoryType("legacy", "Maven 1.x Repository")
];
ManagedRepository=function(id,name,layout,indexDirectory,location,snapshots,releases,blockRedeployments,cronExpression, ManagedRepository=function(id,name,layout,indexDirectory,location,snapshots,releases,blockRedeployments,cronExpression,
scanned,daysOlder,retentionCount,deleteReleasedSnapshots,stageRepoNeeded){ scanned,daysOlder,retentionCount,deleteReleasedSnapshots,stageRepoNeeded){
@ -66,6 +79,16 @@ $(function() {
//private boolean blockRedeployments = false; //private boolean blockRedeployments = false;
this.blockRedeployments=ko.observable(blockRedeployments); this.blockRedeployments=ko.observable(blockRedeployments);
var self=this;
this.getTypeLabel=function(){
for(i=0;i<window.managedRepositoryTypes.length;i++){
if (window.managedRepositoryTypes[i].type==self.layout()){
return window.managedRepositoryTypes[i].label;
}
}
return "no label";
}
} }
@ -73,8 +96,20 @@ $(function() {
this.managedRepository=managedRepository; this.managedRepository=managedRepository;
this.managedRepositoriesViewModel = managedRepositoriesViewModel; this.managedRepositoriesViewModel = managedRepositoriesViewModel;
this.update = update; this.update = update;
var self = this; var self = this;
this.availableLayouts = window.managedRepositoryTypes;
/*getAvailableLayouts=function(){
var layouts = new Array(window.managedRepositoryTypes.length);
for(var i=0;i<window.managedRepositoryTypes.length;i++){
layouts[i]=window.managedRepositoryTypes[i].label;
}
$.log("layouts.length:"+layouts.length)
return layouts;
}*/
save=function(){ save=function(){
var valid = $("#main-content #managed-repository-edit-form").valid(); var valid = $("#main-content #managed-repository-edit-form").valid();
if (valid==false) { if (valid==false) {
@ -258,10 +293,10 @@ $(function() {
rowText: "name" rowText: "name"
}, },
{ {
headerText: $.i18n.prop('type'), headerText: $.i18n.prop('type'),
rowText: "layout", rowText: "getTypeLabel",
// FIXME i18n // FIXME i18n
title: "Repository type (default is Maven 2)" title: "Repository type (default is Maven 2)"
} }
], ],
pageSize: 5 pageSize: 5

View File

@ -137,6 +137,12 @@
<input type="text" class="xlarge" id="indexDirectory" name="indexDirectory" size="50" data-bind="value: managedRepository.indexDirectory"/> <input type="text" class="xlarge" id="indexDirectory" name="indexDirectory" size="50" data-bind="value: managedRepository.indexDirectory"/>
</div> </div>
</div> </div>
<div class="clearfix">
<label for="layout">${$.i18n.prop('type')}</label>
<div class="input">
<select id="layout" data-bind="options: availableLayouts,optionsText: 'label',optionsValue:'type',value: managedRepository.layout"/>
</div>
</div>
<div class="clearfix"> <div class="clearfix">
<label for="cronExpression">${$.i18n.prop('cronExpression')}</label> <label for="cronExpression">${$.i18n.prop('cronExpression')}</label>
<div class="input"> <div class="input">