mirror of https://github.com/apache/archiva.git
[MRM-1711] Add buttons for managing repository group as can be a pain with long list of repositories.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1411157 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d412df4dd2
commit
7e5ef1556b
|
@ -75,21 +75,31 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
|
||||||
$.log("removeRepository:"+id);
|
$.log("removeRepository:"+id);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.renderSortableAvailables=function(){
|
this.renderSortableAvailables=function(repositoryGroupsViewModel){
|
||||||
$.log("renderSortableAvailables");
|
$("#main-content").find("#repository-groups-edit-available-repositories").find(".icon-plus-sign" ).on("click",function(){
|
||||||
//$("#main-content").find("#repository-groups-edit-available-repositories" ).find(".icon-minus-sign" ).hide();
|
var idVal = $(this).attr("id");
|
||||||
|
idVal=idVal.substringAfterFirst("plus-");
|
||||||
|
for (var i=0;i<self.repositoryGroupsViewModel.managedRepositories().length;i++){
|
||||||
|
if(self.repositoryGroupsViewModel.managedRepositories()[i].id()==idVal){
|
||||||
|
self.availableRepositories.remove(repositoryGroupsViewModel.managedRepositories()[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$.log("size before:"+self.repositoryGroup.repositories().length+","+self.repositoryGroup.managedRepositories().length);
|
||||||
|
|
||||||
this.removeChoosed=function(id){
|
for(var i= 0;i<self.repositoryGroupsViewModel.managedRepositories().length;i++){
|
||||||
$.log("removeChoosed:"+id);
|
if(self.repositoryGroupsViewModel.managedRepositories()[i].id()==idVal){
|
||||||
|
$.log("find repo to add");
|
||||||
|
self.repositoryGroup.repositories.push(idVal);
|
||||||
|
self.repositoryGroup.managedRepositories.push(findManagedRepository(idVal,self.repositoryGroupsViewModel.managedRepositories()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.renderSortableChoosed=function(repositoryGroupsViewModel){
|
this.renderSortableChoosed=function(repositoryGroupsViewModel){
|
||||||
$("#main-content").find("#repository-groups-edit-order-div").find(".icon-minus-sign" ).on("click",function(){
|
$("#main-content").find("#repository-groups-edit-order-div").find(".icon-minus-sign" ).on("click",function(){
|
||||||
var idVal = $(this).attr("id");
|
var idVal = $(this).attr("id");
|
||||||
idVal=idVal.substringAfterFirst("minus-");
|
idVal=idVal.substringAfterFirst("minus-");
|
||||||
$.log("renderSortableChoosed:"+idVal);
|
|
||||||
for (var i=0;i<self.repositoryGroupsViewModel.managedRepositories().length;i++){
|
for (var i=0;i<self.repositoryGroupsViewModel.managedRepositories().length;i++){
|
||||||
if(self.repositoryGroupsViewModel.managedRepositories()[i].id()==idVal){
|
if(self.repositoryGroupsViewModel.managedRepositories()[i].id()==idVal){
|
||||||
self.availableRepositories.push(repositoryGroupsViewModel.managedRepositories()[i]);
|
self.availableRepositories.push(repositoryGroupsViewModel.managedRepositories()[i]);
|
||||||
|
@ -106,9 +116,6 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
|
||||||
repositories.push(self.repositoryGroup.managedRepositories()[i].id());
|
repositories.push(self.repositoryGroup.managedRepositories()[i].id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//self.repositoryGroup.repositories(repositories);
|
|
||||||
//self.repositoryGroup.modified(true);
|
|
||||||
$.log("size after:"+self.repositoryGroup.repositories().length+","+self.repositoryGroup.managedRepositories().length);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,6 +172,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
|
||||||
activateRepositoryGroupEditTab();
|
activateRepositoryGroupEditTab();
|
||||||
ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-edit" ).get(0));
|
ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-edit" ).get(0));
|
||||||
repositoryGroupViewModel.renderSortableChoosed(self);
|
repositoryGroupViewModel.renderSortableChoosed(self);
|
||||||
|
repositoryGroupViewModel.renderSortableAvailables(self);
|
||||||
mainContent.find("#repository-groups-view-tabs-li-edit" ).find("a").html($.i18n.prop("edit"));
|
mainContent.find("#repository-groups-view-tabs-li-edit" ).find("a").html($.i18n.prop("edit"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -280,7 +288,8 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
|
||||||
|
|
||||||
activateRepositoryGroupEditTab();
|
activateRepositoryGroupEditTab();
|
||||||
ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-edit" ).get(0));
|
ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-edit" ).get(0));
|
||||||
repositoryGroupViewModel.renderSortableChoosed();
|
repositoryGroupViewModel.renderSortableChoosed(self.repositoryGroupsViewModel);
|
||||||
|
repositoryGroupViewModel.renderSortableAvailables(self.repositoryGroupsViewModel);
|
||||||
}
|
}
|
||||||
if ($(e.target).attr("href")=="#repository-groups-view") {
|
if ($(e.target).attr("href")=="#repository-groups-view") {
|
||||||
mainContent.find("#repository-groups-view-tabs-li-edit a").html($.i18n.prop("add"));
|
mainContent.find("#repository-groups-view-tabs-li-edit a").html($.i18n.prop("add"));
|
||||||
|
|
|
@ -1224,7 +1224,7 @@
|
||||||
<script id="repository-group-edit-order-tmpl-available" type="text/html">
|
<script id="repository-group-edit-order-tmpl-available" type="text/html">
|
||||||
<div class="well draggable-item">
|
<div class="well draggable-item">
|
||||||
<span class="pull-right">
|
<span class="pull-right">
|
||||||
<i class="icon-plus-sign" id="plus-${$data.id()}"/>
|
<i class="icon-plus-sign cursor-hand" id="plus-${$data.id()}"/>
|
||||||
</span>
|
</span>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
${$data.id()}
|
${$data.id()}
|
||||||
|
|
Loading…
Reference in New Issue