]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1620] add a tab to browse artifact content in artifact detail view
authorOlivier Lamy <olamy@apache.org>
Mon, 21 May 2012 14:23:35 +0000 (14:23 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 21 May 2012 14:23:35 +0000 (14:23 +0000)
being able to see file content of each artifact (pom, sources etc..)

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1341043 13f79535-47bb-0310-9956-ffa450edef68

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 1a7f0d0db22a307390c513192aa442d52be23dd5..3daaa608473d004c283f3561a687948fed06a195 100644 (file)
@@ -270,20 +270,28 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
                   });
                 }
 
-                if ($(e.target).attr("href")=="#artifact-details-file-content") {
+                if ($(e.target).attr("href")=="#artifact-details-files-content") {
                   $.log("file content:"+self.groupId+":"+self.artifactId+":"+self.version);
 
-                  var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(self.groupId);
-                  entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
-                  entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
-                  //entriesUrl+="&p="+encodeURIComponent(artifactContentEntry.name);
-
-                  $("#main-content #artifact_content_tree").fileTree({
-                    script: entriesUrl,
-                    root: ""
-                       },function(file) {
-                         //alert(file);
-                       });
+                  var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(self.groupId);
+                  artifactDownloadInfosUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
+                  artifactDownloadInfosUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
+
+                  $.get(artifactDownloadInfosUrl,function(data){
+                    $("#artifact-details-files-content" ).html($("#artifact-details-files-content_tmpl").tmpl({artifactDownloadInfos:data}));
+                    var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(self.groupId);
+                    entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
+                    entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
+                    //entriesUrl+="&p="+encodeURIComponent(artifactContentEntry.name);
+
+                    $("#main-content #artifact_content_tree").fileTree({
+                      script: entriesUrl,
+                      root: ""
+                                 },function(file) {
+
+                                 });
+                  });
+
                 }
               });
             }
index a5d6d471e1df2062d207193ad27445d3d9383149..19a159cb0ed63cb105cbd3dd281579484f8b1b79 100644 (file)
         <a data-toggle="tab" href="#artifact-details-dependency-tree-content">${$.i18n.prop('artifact.detail.tab.header.dependency.tree')}</a>
       </li>
       <li>
-        <a data-toggle="tab" href="#artifact-details-file-content">${$.i18n.prop('artifact.detail.tab.header.file.content')}</a>
+        <a data-toggle="tab" href="#artifact-details-files-content">${$.i18n.prop('artifact.detail.tab.header.file.content')}</a>
       </li>
       <li>
         <a data-toggle="tab" href="#artifact-details-used-by-content">${$.i18n.prop('artifact.detail.tab.header.used.by')}</a>
       <div id="artifact-details-dependency-tree-content" class="tab-pane">
       </div>
 
-      <div id="artifact-details-file-content" class="tab-pane">
-          <div id="artifact_content_tree">
-          </div>
+      <div id="artifact-details-files-content" class="tab-pane">
+
       </div>
 
       <div id="artifact-details-used-by-content" class="tab-pane"></div>
       {{/if}}
     {{/each}}
   </ul>
+</script>
+
+<script id="artifact-details-files-content_tmpl" type="text/html">
+      <div class="row">
+        <div class="span4">
+           <ul>
+           {{each artifactDownloadInfos}}
+             <li>${$value.type}:${$value.classifier}</li>
+           {{/each}}
+           </ul>
+        </div>
+        <div class="span8">
+          <div id="artifact_content_tree">
+          </div>
+        </div>
+      </div>
 </script>
\ No newline at end of file