]> source.dussan.org Git - archiva.git/commitdiff
history navigation when seeing artifact dependency tree
authorOlivier Lamy <olamy@apache.org>
Thu, 9 Aug 2012 21:12:28 +0000 (21:12 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 9 Aug 2012 21:12:28 +0000 (21:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1371486 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html

index d429e96f6038e632396d633cb673faebac9ea34a..a6dbf99a9588a2c191aebc53604c587102766556 100644 (file)
@@ -281,6 +281,28 @@ function() {
 
         });
 
+
+        this.get('#artifact-dependency-tree/:groupId/:artifactId/:version',function(context){
+
+          var repositoryId = this.params.repositoryId;
+          var groupId= this.params.groupId;
+          var artifactId= this.params.artifactId;
+          var version= this.params.version;
+          generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,function(){$("#main-content #artifact-details-dependency-tree-content-a").tab('show')});
+
+        });
+
+        this.get('#artifact-dependency-tree~:repositoryId/:groupId/:artifactId/:version',function(context){
+
+          var repositoryId = this.params.repositoryId;
+          var groupId= this.params.groupId;
+          var artifactId= this.params.artifactId;
+          var version= this.params.version;
+          generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,function(){$("#main-content #artifact-details-dependency-tree-content-a").tab('show')});
+
+        });
+
+
         this.get('#browse/:groupId',function(context){
           var groupId = this.params.groupId;
           if (groupId){
index 7874b1322b6c2aedb3e18809eacb4ac6da0c69a0..8bc309e0419aa505380c3c56328d0f9d3002f9a3 100644 (file)
@@ -243,8 +243,43 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
               ko.applyBindings(self,mainContent.find("#browse_breadcrumb" ).get(0));
               mainContent.find("#browse-autocomplete" ).hide();
               mainContent.find("#browse-autocomplete-divider" ).hide();
+
+              //calculate tree content
+              var treeContentDiv=mainContent.find("#artifact-details-dependency-tree-content" );
+              if( $.trim(treeContentDiv.html()).length<1){
+                treeContentDiv.html(mediumSpinnerImg());
+                var treeDependencyUrl="restServices/archivaServices/browseService/treeEntries/"+encodeURIComponent(groupId);
+                treeDependencyUrl+="/"+encodeURIComponent(artifactId);
+                treeDependencyUrl+="/"+encodeURIComponent(version);
+                var selectedRepo=getSelectedBrowsingRepository();
+                if (selectedRepo){
+                  treeDependencyUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
+                }
+                $.ajax(treeDependencyUrl, {
+                  type: "GET",
+                  dataType: 'json',
+                  success: function(data) {
+                    var treeEntries = mapTreeEntries(data);
+                    treeContentDiv.html($("#dependency_tree_tmpl" ).tmpl({treeEntries: treeEntries}));
+                  }
+                });
+              }
+
+
               mainContent.find("#artifact-details-tabs").on('show', function (e) {
 
+                if ($(e.target).attr("data-target")=="#artifact-details-info-content") {
+                  var location ="#artifact";
+                  if (self.repositoryId){
+                    location+="~"+self.repositoryId;
+                  }
+                  location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version;
+
+                  window.sammyArchivaApplication.setLocation(location);
+                  return;
+                }
+
+
                 if ($(e.target).attr("data-target")=="#artifact-details-dependencies-content") {
                   var location ="#artifact-dependencies";
                   if (self.repositoryId){
@@ -253,28 +288,18 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
                   location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version;
 
                   window.sammyArchivaApplication.setLocation(location);
+                  return;
                 }
 
-                if ($(e.target).attr("href")=="#artifact-details-dependency-tree-content") {
-                  var treeContentDiv=mainContent.find("#artifact-details-dependency-tree-content" );
-                  if( $.trim(treeContentDiv.html()).length<1){
-                    treeContentDiv.html(mediumSpinnerImg());
-                    var treeDependencyUrl="restServices/archivaServices/browseService/treeEntries/"+encodeURIComponent(groupId);
-                    treeDependencyUrl+="/"+encodeURIComponent(artifactId);
-                    treeDependencyUrl+="/"+encodeURIComponent(version);
-                    var selectedRepo=getSelectedBrowsingRepository();
-                    if (selectedRepo){
-                      treeDependencyUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
-                    }
-                    $.ajax(treeDependencyUrl, {
-                      type: "GET",
-                      dataType: 'json',
-                      success: function(data) {
-                        var treeEntries = mapTreeEntries(data);
-                        treeContentDiv.html($("#dependency_tree_tmpl" ).tmpl({treeEntries: treeEntries}));
-                      }
-                    });
+                if ($(e.target).attr("data-target")=="#artifact-details-dependency-tree-content") {
+                  var location ="#artifact-dependency-tree";
+                  if (self.repositoryId){
+                    location+="~"+self.repositoryId;
                   }
+                  location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version;
+
+                  window.sammyArchivaApplication.setLocation(location);
+                  return;
                   return;
                 }
                 if ($(e.target).attr("href")=="#artifact-details-used-by-content") {
index cdf46e64666822e76049d88caa47150b72bde2f9..6b95a5bb8a96b466b6d26167209d2bcc7829e2bd 100644 (file)
 <script id="browse-artifact-detail-tmpl" type="text/html">
     <ul id="artifact-details-tabs" class="nav nav-tabs">
       <li class="active">
-        <a data-toggle="tab" href="#artifact-details-info-content">${$.i18n.prop('artifact.detail.tab.header.info')}</a>
+        <a data-toggle="tab" id="artifact-details-info-content-a" data-target="#artifact-details-info-content" href="#artifact-details-info-content">${$.i18n.prop('artifact.detail.tab.header.info')}</a>
       </li>
       <li>
         <a data-toggle="tab" id="artifact-details-dependencies-content-a" data-target="#artifact-details-dependencies-content" href="#artifact-details-dependencies-content">${$.i18n.prop('artifact.detail.tab.header.dependencies')}</a>