diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js index fa72b4b27..84294fd68 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js @@ -204,6 +204,15 @@ function() { goToBrowseArtifactDetail(groupId,artifactId);//,null,null); return; + }); + this.get('#artifact~:repositoryId/:groupId/:artifactId',function(context){ + var groupId= this.params.groupId; + var artifactId= this.params.artifactId; + var repositoryId = this.params.repositoryId; + $.log("get #artifact:"+groupId+":"+artifactId); + goToBrowseArtifactDetail(groupId,artifactId,repositoryId);//,null,null); + return; + }); this.get('#artifact/:groupId/:artifactId/:version',function(context){ 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 be9d585ca..479b030e5 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 @@ -154,6 +154,16 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno artifactVersionDetailViewModel.display(); } + displayGroupId=function(groupId){ + var selectedRepo=getSelectedBrowsingRepository(); + var location ="#browse"; + if (selectedRepo){ + location+="~"+selectedRepo; + } + location+="/"+groupId; + window.sammyArchivaApplication.setLocation(location); + } + } displayArtifactVersionDetailViewModel=function(groupId,artifactId,version){ @@ -598,10 +608,10 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno artifactVersionDetailViewModel.display(); } - goToBrowseArtifactDetail=function(groupId, artifactId){ + goToBrowseArtifactDetail=function(groupId, artifactId,repositoryId){ $.log("goToBrowseArtifactDetail:"+groupId+":"+artifactId); - displayBrowseGroupId(groupId,null,null); - displayArtifactDetail(groupId,artifactId,null,null); + //displayBrowseGroupId(groupId,null,null); + displayArtifactDetail(groupId,artifactId,null,null,repositoryId); } /** @@ -636,42 +646,56 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno * @param parentBrowseViewModel * @param restUrl */ - displayArtifactDetail=function(groupId,artifactId,parentBrowseViewModel,restUrl){ + displayArtifactDetail=function(groupId,artifactId,parentBrowseViewModel,restUrl,repositoryId){ $.log("displayArtifactDetail:"+groupId+":"+artifactId); var artifactDetailViewModel=new ArtifactDetailViewModel(groupId,artifactId); var mainContent = $("#main-content"); - mainContent.find("#browse_artifact_detail" ).hide(); - mainContent.find("#browse_result").hide(); - mainContent.find("#main_browse_result_content").hide("slide", {}, 300,function(){ - mainContent.find("#browse_breadcrumb").html(smallSpinnerImg()); - mainContent.find("#browse_artifact").show(); - mainContent.find("#browse_artifact").html(mediumSpinnerImg()); - mainContent.find("#main_browse_result_content").show(); - var metadataUrl="restServices/archivaServices/browseService/projectVersionMetadata/"+encodeURIComponent(groupId)+"/"+encodeURIComponent(artifactId); - var versionsListUrl="restServices/archivaServices/browseService/versionsList/"+encodeURIComponent(groupId)+"/"+encodeURIComponent(artifactId); - var selectedRepo=getSelectedBrowsingRepository(); - if (selectedRepo){ - metadataUrl+="?repositoryId="+encodeURIComponent(selectedRepo); - versionsListUrl+="?repositoryId="+encodeURIComponent(selectedRepo); - } - $.ajax(metadataUrl, { - type: "GET", - dataType: 'json', - success: function(data) { - artifactDetailViewModel.projectVersionMetadata=mapProjectVersionMetadata(data); - $.ajax(versionsListUrl, { + + mainContent.html($("#browse-tmpl" ).tmpl()); + + userRepositoriesCall( + function(data){ + + if(repositoryId){ + mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:repositoryId})); + } else { + mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:''})); + } + + mainContent.find("#browse_artifact_detail" ).hide(); + mainContent.find("#browse_result").hide(); + mainContent.find("#main_browse_result_content").hide("slide", {}, 300,function(){ + mainContent.find("#browse_breadcrumb").html(smallSpinnerImg()); + mainContent.find("#browse_artifact").show(); + mainContent.find("#browse_artifact").html(mediumSpinnerImg()); + mainContent.find("#main_browse_result_content").show(); + var metadataUrl="restServices/archivaServices/browseService/projectVersionMetadata/"+encodeURIComponent(groupId)+"/"+encodeURIComponent(artifactId); + var versionsListUrl="restServices/archivaServices/browseService/versionsList/"+encodeURIComponent(groupId)+"/"+encodeURIComponent(artifactId); + var selectedRepo=getSelectedBrowsingRepository(); + if (selectedRepo){ + metadataUrl+="?repositoryId="+encodeURIComponent(selectedRepo); + versionsListUrl+="?repositoryId="+encodeURIComponent(selectedRepo); + } + $.ajax(metadataUrl, { type: "GET", dataType: 'json', success: function(data) { - artifactDetailViewModel.versions=mapVersionsList(data); - ko.applyBindings(artifactDetailViewModel,mainContent.find("#browse_artifact").get(0)); - ko.applyBindings(artifactDetailViewModel,mainContent.find("#browse_breadcrumb").get(0)); - - } + artifactDetailViewModel.projectVersionMetadata=mapProjectVersionMetadata(data); + $.ajax(versionsListUrl, { + type: "GET", + dataType: 'json', + success: function(data) { + artifactDetailViewModel.versions=mapVersionsList(data); + ko.applyBindings(artifactDetailViewModel,mainContent.find("#browse_artifact").get(0)); + ko.applyBindings(artifactDetailViewModel,mainContent.find("#browse_breadcrumb").get(0)); + } + }); + } }); - } }); + }); + } browseRoot=function(){ @@ -847,7 +871,6 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno } location+="/"+ui.item.name; window.sammyArchivaApplication.setLocation(location); - //displayBrowseGroupIdFromAutoComplete(ui.item.name); } return false; }