fix artifact detail view when using url query param shortcut

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1302700 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-19 22:46:57 +00:00
parent 9bc2adb91c
commit e111ed7243
3 changed files with 43 additions and 6 deletions

View File

@ -83,16 +83,43 @@ $(function() {
}
var artifact= $.urlParam("artifact");
var repositoryId = $.urlParam("repositoryId");
// format groupId:artifactId org.apache.maven.plugins:maven-jar-plugin
//
// or groupId:artifactId:version org.apache.maven.plugins:maven-jar-plugin:2.3.1
// repository in param repositoryId
if (artifact){
if ( artifact.indexOf(':')>=0){
var splitted = artifact.split(':');
displayBrowseArtifactDetail(splitted[0],splitted[1],null,null);
return;
$.log("splitted.length:"+splitted.length);
if(splitted.length==2){
displayBrowseArtifactDetail(splitted[0],splitted[1],null,null);
return;
} else if (splitted.length==3) {
var mainContent=$("#main-content");
mainContent.html($("#browse-tmpl" ).tmpl());
mainContent.find("#browse_result" ).hide();
mainContent.find("#browse_artifact_detail").show();
mainContent.find("#browse_artifact_detail").html(mediumSpinnerImg());
mainContent.find("#browse_breadcrumb" ).show();
mainContent.find("#browse_breadcrumb" ).html(mediumSpinnerImg());
$.ajax("restServices/archivaServices/browseService/userRepositories", {
type: "GET",
dataType: 'json',
success: function(data) {
mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:repositoryId}));
var artifactVersionDetailViewModel=new ArtifactVersionDetailViewModel(splitted[0],splitted[1],splitted[2]);
artifactVersionDetailViewModel.display(true);
}
});
return;
} else {
displayWarningMessage( $.i18n.prop("shortcut.artifact.illegal"));
}
}
}
var screen = $.urlParam('screen');
if(screen){

View File

@ -75,6 +75,7 @@ $(function() {
for (var i=0;i<splitted.length;i++){
curGroupId+=splitted[i];
breadCrumbEntries.push(new BreadCrumbEntry(curGroupId,splitted[i]));
$.log("calculateBreadCrumbEntries:"+curGroupId+":"+splitted[i]);
curGroupId+="."
}
return breadCrumbEntries;
@ -138,19 +139,24 @@ $(function() {
}
displayArtifactVersionDetail=function(version){
var artifactVersionDetailViewModel=new ArtifactVersionDetailViewModel(self.groupId,self.artifactId,version,self);
var artifactVersionDetailViewModel=new ArtifactVersionDetailViewModel(self.groupId,self.artifactId,version,getSelectedBrowsingRepository());
artifactVersionDetailViewModel.display();
}
}
ArtifactVersionDetailViewModel=function(groupId,artifactId,version,artifactDetailViewModel){
ArtifactVersionDetailViewModel=function(groupId,artifactId,version){
var mainContent = $("#main-content");
var self=this;
this.groupId=groupId;
this.artifactId=artifactId;
this.version=version;
this.projectVersionMetadata=null;
displayGroupId=function(groupId){
displayGroupDetail(groupId,null);
}
breadCrumbEntries=function(){
var entries = calculateBreadCrumbEntries(self.groupId);
var artifactBreadCrumbEntry = new BreadCrumbEntry(self.groupId,self.artifactId);

View File

@ -397,7 +397,11 @@
<select id="select_browse_repository" onchange="changeBrowseRepository()">
<option value="">All</option>
{{each(i,repository) repositories}}
<option value="${repository.id}">${repository.name}</option>
{{if selected && selected==repository.id}}
<option value="${repository.id}" selected>${repository.name}</option>
{{else}}
<option value="${repository.id}">${repository.name}</option>
{{/if}}
{{/each}}
</select>
</script>