You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2012/05/21 16:23:36 UTC

svn commit: r1341043 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js: archiva/search.js templates/archiva/search.html

Author: olamy
Date: Mon May 21 14:23:35 2012
New Revision: 1341043

URL: http://svn.apache.org/viewvc?rev=1341043&view=rev
Log:
 [MRM-1620] add a tab to browse artifact content in artifact detail view
being able to see file content of each artifact (pom, sources etc..)

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

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js?rev=1341043&r1=1341042&r2=1341043&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js Mon May 21 14:23:35 2012
@@ -270,20 +270,28 @@ define("search",["jquery","i18n","jquery
                   });
                 }
 
-                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) {
+
+                		  });
+                  });
+
                 }
               });
             }

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html?rev=1341043&r1=1341042&r2=1341043&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html Mon May 21 14:23:35 2012
@@ -433,7 +433,7 @@
         <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>
@@ -628,9 +628,8 @@
       <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>
@@ -806,4 +805,20 @@
       {{/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