From e9d4231e1b820320ca8321f9ecfc01b5872edc33 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 21 May 2012 14:23:35 +0000 Subject: [PATCH] [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..) git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1341043 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/js/archiva/search.js | 32 ++++++++++++------- .../webapp/js/templates/archiva/search.html | 23 ++++++++++--- 2 files changed, 39 insertions(+), 16 deletions(-) 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 1a7f0d0db..3daaa6084 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 @@ -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) { + + }); + }); + } }); } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html index a5d6d471e..19a159cb0 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html @@ -433,7 +433,7 @@ ${$.i18n.prop('artifact.detail.tab.header.dependency.tree')}
  • - ${$.i18n.prop('artifact.detail.tab.header.file.content')} + ${$.i18n.prop('artifact.detail.tab.header.file.content')}
  • ${$.i18n.prop('artifact.detail.tab.header.used.by')} @@ -628,9 +628,8 @@
    -
    -
    -
    +
    +
    @@ -806,4 +805,20 @@ {{/if}} {{/each}} + + + \ No newline at end of file -- 2.39.5