From: Olivier Lamy Date: Fri, 17 Feb 2012 17:40:43 +0000 (+0000) Subject: implements repository browsing X-Git-Tag: archiva-1.4-M3~1256 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6d0d0738245fbd69e98697f4daf0f7fa59641938;p=archiva.git implements repository browsing git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1245680 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/BrowseResult.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/BrowseResult.java index 57dcd4943..8278ac1db 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/BrowseResult.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/BrowseResult.java @@ -31,6 +31,8 @@ public class BrowseResult { private List browseResultEntries; + private boolean rootLevel; + public BrowseResult() { // no op diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js index 313061e9c..764398360 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js @@ -22,19 +22,30 @@ $(function() { // browse part //----------------------------------------- - BrowseViewModel=function(browseResultEntries,parentGroupdId){ + BrowseViewModel=function(browseResultEntries,parentBrowseViewModel,groupId){ var self=this; this.browseResultEntries=browseResultEntries; - this.parentGroupdId=parentGroupdId; + this.parentBrowseViewModel=parentBrowseViewModel; + this.groupId=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 browseResult=mainContent.find("#browse_result"); var browseBreadCrumb=mainContent.find("#browse_breadcrumb"); @@ -49,7 +60,8 @@ $(function() { dataType: 'json', success: function(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)); } @@ -76,7 +88,7 @@ $(function() { success: function(data) { var browseResultEntries = mapbrowseResultEntries(data); $.log("size:"+browseResultEntries.length); - var browseViewModel = new BrowseViewModel(browseResultEntries,".."); + var browseViewModel = new BrowseViewModel(browseResultEntries,null,null); ko.applyBindings(browseViewModel,mainContent.get(0)); } }); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html index c80b4d3ea..7d8e4dfb8 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html @@ -40,7 +40,10 @@