mirror of https://github.com/apache/archiva.git
implements repository browsing
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1245680 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d84ce095c1
commit
6d0d073824
|
@ -31,6 +31,8 @@ public class BrowseResult
|
||||||
{
|
{
|
||||||
private List<BrowseResultEntry> browseResultEntries;
|
private List<BrowseResultEntry> browseResultEntries;
|
||||||
|
|
||||||
|
private boolean rootLevel;
|
||||||
|
|
||||||
public BrowseResult()
|
public BrowseResult()
|
||||||
{
|
{
|
||||||
// no op
|
// no op
|
||||||
|
|
|
@ -22,19 +22,30 @@ $(function() {
|
||||||
// browse part
|
// browse part
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
|
|
||||||
BrowseViewModel=function(browseResultEntries,parentGroupdId){
|
BrowseViewModel=function(browseResultEntries,parentBrowseViewModel,groupId){
|
||||||
var self=this;
|
var self=this;
|
||||||
this.browseResultEntries=browseResultEntries;
|
this.browseResultEntries=browseResultEntries;
|
||||||
this.parentGroupdId=parentGroupdId;
|
this.parentBrowseViewModel=parentBrowseViewModel;
|
||||||
|
this.groupId=groupId;
|
||||||
displayGroupId=function(groupId){
|
displayGroupId=function(groupId){
|
||||||
displayGroupDetail(groupId,self.parentGroupdId);
|
displayGroupDetail(groupId,self);
|
||||||
|
$.log("called displayGroupDetail groupId:"+groupId
|
||||||
|
+",parentBrowseViewModel.groupId:"+(parentBrowseViewModel?parentBrowseViewModel.groupId:"null"));
|
||||||
|
}
|
||||||
|
displayParentGroupId=function(){
|
||||||
|
$.log("called displayParentGroupId groupId:"+self.parentBrowseViewModel.groupId);
|
||||||
|
// if null parent is root level
|
||||||
|
if (self.parentBrowseViewModel.groupId){
|
||||||
|
displayGroupDetail(self.parentBrowseViewModel.groupId,self.parentBrowseViewModel);
|
||||||
|
} else {
|
||||||
|
browseRoot();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
displayGroupDetail=function(groupId,parentGroupdId,restUrl){
|
displayGroupDetail=function(groupId,parentBrowseViewModel,restUrl){
|
||||||
var mainContent = $("#main-content");
|
var mainContent = $("#main-content");
|
||||||
var browseResult=mainContent.find("#browse_result");
|
var browseResult=mainContent.find("#browse_result");
|
||||||
var browseBreadCrumb=mainContent.find("#browse_breadcrumb");
|
var browseBreadCrumb=mainContent.find("#browse_breadcrumb");
|
||||||
|
@ -49,7 +60,8 @@ $(function() {
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var browseResultEntries = mapbrowseResultEntries(data);
|
var browseResultEntries = mapbrowseResultEntries(data);
|
||||||
var browseViewModel = new BrowseViewModel(browseResultEntries,parentGroupdId);
|
$.log("displayGroupDetail#sucess parentBrowseViewModel:"+parentBrowseViewModel);
|
||||||
|
var browseViewModel = new BrowseViewModel(browseResultEntries,parentBrowseViewModel,groupId);
|
||||||
|
|
||||||
ko.applyBindings(browseViewModel,mainContent.get(0));
|
ko.applyBindings(browseViewModel,mainContent.get(0));
|
||||||
}
|
}
|
||||||
|
@ -76,7 +88,7 @@ $(function() {
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var browseResultEntries = mapbrowseResultEntries(data);
|
var browseResultEntries = mapbrowseResultEntries(data);
|
||||||
$.log("size:"+browseResultEntries.length);
|
$.log("size:"+browseResultEntries.length);
|
||||||
var browseViewModel = new BrowseViewModel(browseResultEntries,"..");
|
var browseViewModel = new BrowseViewModel(browseResultEntries,null,null);
|
||||||
ko.applyBindings(browseViewModel,mainContent.get(0));
|
ko.applyBindings(browseViewModel,mainContent.get(0));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,7 +40,10 @@
|
||||||
<script id="browse-groups-tmpl" type="text/html">
|
<script id="browse-groups-tmpl" type="text/html">
|
||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="browse-list"><a href="#" data-bind="click:function(){displayGroupId($root.parentGroupdId)}">..</a></li>
|
<!-- if null we are on root level -->
|
||||||
|
{{if $root.parentBrowseViewModel}}
|
||||||
|
<li class="browse-list"><a href="#" data-bind="click:function(){displayParentGroupId()}">..</a></li>
|
||||||
|
{{/if}}
|
||||||
{{each(i,browseResultEntry) browseResultEntries}}
|
{{each(i,browseResultEntry) browseResultEntries}}
|
||||||
<li class="browse-list">
|
<li class="browse-list">
|
||||||
<a href="#" data-bind="click:function(){displayGroupId(browseResultEntry.name)}">
|
<a href="#" data-bind="click:function(){displayGroupId(browseResultEntry.name)}">
|
||||||
|
|
Loading…
Reference in New Issue