}
.draggable-item {
- cursor: move;
+ cursor: move;
+ margin-bottom: 12px;
+ min-height: 2px;
+ padding: 12px;
+ border: 2px dotted #ddd;
+ margin-left: 2em
}
.network-proxy-remote-item{
var modifiedNetworkProxies = getModifiedNetworkProxies();
openDialogConfirm(function(){
- for(i=0;i<modifiedNetworkProxies.length;i++){
+ for(var i=0;i<modifiedNetworkProxies.length;i++){
var viewModel = new NetworkProxyViewModel(modifiedNetworkProxies[i],true,self,false);
viewModel.save();
}
//this.modified.subscribe(function(newValue){$.log("ProxyConnector modified:"+newValue)});
this.updatePolicyEntry=function(key,value){
- for(i=0;i<policiesEntries.length;i++){
+ for(var i=0;i<policiesEntries.length;i++){
if (policiesEntries[i].key==key){
policiesEntries[i].value=value;
self.modified(true);
getPolicyOptions=function(id){
var policyInformations=self.proxyConnectorsViewModel.policyInformations();
- for(i=0;i<policyInformations.length;i++){
+ for(var i=0;i<policyInformations.length;i++){
if (policyInformations[i].id()==id){
return policyInformations[i].options();
}
}
this.deleteProperty=function(key){
- for(i=0;i<self.proxyConnector.propertiesEntries().length;i++){
+ for(var i=0;i<self.proxyConnector.propertiesEntries().length;i++){
var entry=self.proxyConnector.propertiesEntries()[i];
if (entry.key()==key()){
self.proxyConnector.propertiesEntries.remove(entry);
var modifiedProxyConnectors = getModifiedProxyConnectors();
openDialogConfirm(function(){
- for(i=0;i<modifiedProxyConnectors.length;i++){
+ for(var i=0;i<modifiedProxyConnectors.length;i++){
var viewModel = new ProxyConnectorViewModel(modifiedProxyConnectors[i],true,self,false);
viewModel.save();
}
}
this.findPolicyInformationName=function(id){
- for(i=0;i<self.policyInformations().length;i++){
+ for(var i=0;i<self.policyInformations().length;i++){
if (id==self.policyInformations()[i].id()){
return self.policyInformations()[i].name();
}
this.findRemoteRepository=function(id){
$.log("findRemoteRepository:"+id());
- for(i=0;i<self.proxyConnectorsViewModel.remoteRepositories().length;i++){
+ for(var i=0;i<self.proxyConnectorsViewModel.remoteRepositories().length;i++){
if (self.proxyConnectorsViewModel.remoteRepositories()[i].id()==id()){
return self.proxyConnectorsViewModel.remoteRepositories()[i];
}
this.getTypeLabel=function(){
- for(i=0;i<window.managedRepositoryTypes.length;i++){
+ for(var i=0;i<window.managedRepositoryTypes.length;i++){
if (window.managedRepositoryTypes[i].type==self.layout()){
return window.managedRepositoryTypes[i].label;
}
this.downloadRemoteIndexOnStartup.subscribe(function(newValue){self.modified(true)});
this.getTypeLabel=function(){
- for(i=0;i<window.managedRepositoryTypes.length;i++){
+ for(var i=0;i<window.managedRepositoryTypes.length;i++){
if (window.managedRepositoryTypes[i].type==self.layout()){
return window.managedRepositoryTypes[i].label;
}
var modifiedRemoteRepositories = getModifiedRemoteRepositories();
openDialogConfirm(function(){
- for(i=0;i<modifiedRemoteRepositories.length;i++){
+ for(var i=0;i<modifiedRemoteRepositories.length;i++){
updateRemoteRepository(modifiedRemoteRepositories[i]);
}
closeDialogConfirm();
this.repositories=ko.observableArray(repositories);
this.repositories.subscribe(function(newValue){self.modified(true)});
+ // to store managedRepositories description not sended to server
+ this.managedRepositories=ko.observableArray([]);
+ this.managedRepositories.subscribe(function(newValue){self.modified(true)});
+
this.modified=ko.observable(false);
}
RepositoryGroupViewModel=function(repositoryGroup,update,repositoryGroupsViewModel){
+ var self = this;
this.repositoryGroup=repositoryGroup;
this.update=update;
- this.repositoryGroupsViewModel=null;
+ this.repositoryGroupsViewModel=repositoryGroupsViewModel;
+
+ repositoryMoved=function(arg){
+ $.log("repositoryMoved:"+arg.sourceIndex+" to " + arg.targetIndex);
+ var repositories=[];
+ for(var i=0;i<self.repositoryGroup.managedRepositories().length;i++){
+ repositories.push(self.repositoryGroup.managedRepositories()[i]);
+ }
+ self.repositoryGroup.repositories(repositories);
+ self.repositoryGroup.modified(true);
+ }
+
}
RepositoryGroupsViewModel=function(){
}
this.editRepositoryGroup=function(repositoryGroup){
- $.log("editRepositoryGroup:"+repositoryGroup.id());
+ $.log("editRepositoryGroup:"+repositoryGroup.id()+",repositories:"+repositoryGroup.repositories().length+",managed:"+repositoryGroup.managedRepositories().length);
var repositoryGroupViewModel=new RepositoryGroupViewModel(repositoryGroup,true,self);
activateRepositoryGroupEditTab();
ko.applyBindings(repositoryGroupViewModel,$("#main-content #repository-groups-edit" ).get(0));
}
- repositoryMoved=function(){
- $.log("repositoryMoved");
- }
+
getManagedRepository=function(id){
$.log("getManagedRepository:"+id);
return findManagedRepository(self.managedRepositories());
}
+
}
displayRepositoryGroups=function(){
dataType: 'json',
success: function(data) {
var mappedRepositoryGroups=mapRepositoryGroups(data);
+ for(var i=0;i<mappedRepositoryGroups.length;i++){
+ mappedRepositoryGroups[i]
+ .managedRepositories(self.mapManagedRepositoriesToRepositoryGroup(mappedRepositoryGroups[i]));
+ mappedRepositoryGroups[i].modified(false);
+ }
mainContent.html($("#repositoryGroupsMain").tmpl());
self.repositoryGroupsViewModel.repositoryGroups(mappedRepositoryGroups);
- //ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-table" ).get(0));
ko.applyBindings(repositoryGroupsViewModel,mainContent.find("#repository-groups-view" ).get(0));
}
});
+ this.mapManagedRepositoriesToRepositoryGroup=function(repositoryGroup){
+ var managedRepositories=[];
+ for(var i=0;i<repositoryGroup.repositories().length;i++){
+ managedRepositories.push(self.repositoryGroupsViewModel.findManagedRepository(repositoryGroup.repositories()[i]));
+ }
+ return managedRepositories;
+ }
}
+
+
activateRepositoryGroupsGridTab=function(){
var mainContent = $("#main-content");
mainContent.find("#repository-groups-view-tabs-content div[class*='tab-pane']").removeClass("active");
</div>
<div class="span6">
<blockquote>
- ${managedRepository.id}
- <br/>
- ${managedRepository.name}
+ ${managedRepository.id}
+ <br/>
+ ${managedRepository.name}
</blockquote>
</div>
<div class="span2">
{{if proxyConnectorsViewModel.bulkSave()}}
<p>
- <a data-bind="click: function(){updateModifiedProxyConnectors()}"
- href="#" class="btn btn-warning">${$.i18n.prop('save.all')}</a></p>
+ <a data-bind="click: function(){updateModifiedProxyConnectors()}"
+ href="#" class="btn btn-warning">${$.i18n.prop('save.all')}</a></p>
{{/if}}
</div>
</div>
<div id="repository-groups-edit" class="tab-pane active">
<div id="repository-groups-edit-div" data-bind='template:{name:"repository-group-edit-tmpl"}'></div>
<div id="repository-groups-edit-order-div"
- data-bind="sortable: { template: 'repository-group-edit-order-tmpl',data:repositoryGroup.repositories,afterMove: repositoryMoved}">
+ data-bind="sortable: { template: 'repository-group-edit-order-tmpl',data:repositoryGroup.managedRepositories,afterMove: repositoryMoved}">
</div>
</div>
</div>
</thead>
<tbody>
{{each(i, repositoryGroup) repositoryGroups}}
- <tr>
+ <tr data-bind="css:{ 'modified': repositoryGroup.modified()}">
<td>${repositoryGroup.id}</td>
<td>
<ul>
<label class="control-label" for="id">${$.i18n.prop('id')}</label>
<div class="controls">
{{if update}}
- <span class="uneditable-input">${repositoryGroup.id}</span>
+ ${repositoryGroup.id}
+ <br/>
+ <a href="${window.archivaRuntimeInfo.baseUrl}/repository/${repositoryGroup.id()}" target="_blank">
+ ${window.archivaRuntimeInfo.baseUrl}/repository/${repositoryGroup.id()}
+ </a>
+
{{else}}
<input type="text" class="xlarge required" id="id" name="id" size="50"
data-bind="value: repositoryGroup.id,css:{'uneditable-input': update},readonly:update"/>
</script>
<script id="repository-group-edit-order-tmpl" type="text/html">
- <div class="well draggable-item">
- ${$data}-${managedRepository.name()}
+ <div class="well draggable-item span6">
+ <blockquote>
+ ${$data.id()}
+ <br/>
+ ${$data.name()}
+ <br/>
+ ${window.archivaRuntimeInfo.baseUrl}/repository/${$data.id()}
+ <br/>
+ </blockquote>
+
</div>
</script>
\ No newline at end of file