fixing browsing with typeahead

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1558609 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2014-01-15 23:32:28 +00:00
parent 12efd7f35b
commit 41eefa4f67
3 changed files with 53 additions and 8 deletions

View File

@ -34,6 +34,16 @@ public class BrowseResultEntry
private boolean project;
/**
* @since 2.0.0
*/
private String groupId;
/**
* @since 2.0.0
*/
private String artifactId;
public BrowseResultEntry()
{
// no op
@ -70,13 +80,46 @@ public class BrowseResultEntry
return this.name.compareTo( browseGroupResultEntry.name );
}
public String getGroupId()
{
return groupId;
}
public void setGroupId( String groupId )
{
this.groupId = groupId;
}
public BrowseResultEntry groupId( String groupId )
{
this.groupId = groupId;
return this;
}
public String getArtifactId()
{
return artifactId;
}
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
}
public BrowseResultEntry artifactId( String artifactId )
{
this.artifactId = artifactId;
return this;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append( "BrowseResultEntry" );
sb.append( "{name='" ).append( name ).append( '\'' );
final StringBuilder sb = new StringBuilder( "BrowseResultEntry{" );
sb.append( "name='" ).append( name ).append( '\'' );
sb.append( ", project=" ).append( project );
sb.append( ", groupId='" ).append( groupId ).append( '\'' );
sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
sb.append( '}' );
return sb.toString();
}

View File

@ -195,11 +195,11 @@ public class DefaultBrowseService
new ArrayList<BrowseResultEntry>( namespaces.size() + projects.size() );
for ( String namespace : namespaces )
{
browseGroupResultEntries.add( new BrowseResultEntry( namespace, false ) );
browseGroupResultEntries.add( new BrowseResultEntry( namespace, false ).groupId( namespace ) );
}
for ( String project : projects )
{
browseGroupResultEntries.add( new BrowseResultEntry( groupId + '.' + project, true ) );
browseGroupResultEntries.add( new BrowseResultEntry( groupId + '.' + project, true ).groupId( groupId ).artifactId( project ) );
}
Collections.sort( browseGroupResultEntries );
return new BrowseResult( browseGroupResultEntries );

View File

@ -1528,7 +1528,7 @@ define("archiva.search",["jquery","jquery.ui","i18n","jquery.tmpl","select2","kn
//window.sammyArchivaApplication.setLocation("#quicksearch~" + datum.artifactId);
if (datum.project){
goToArtifactDetail(theGroupId,datum.name);
goToArtifactDetail(datum.groupId,datum.artifactId);
} else {
var selectedRepo=getSelectedBrowsingRepository();
var location ="#browse";
@ -1677,15 +1677,17 @@ define("archiva.search",["jquery","jquery.ui","i18n","jquery.tmpl","select2","kn
if (data.browseResultEntries) {
return $.isArray(data.browseResultEntries) ?
$.map(data.browseResultEntries,function(item){
return new BrowseResultEntry(item.name, item.project);
return new BrowseResultEntry(item.name, item.project,item.groupId,item.artifactId);
} ).sort(function(a, b){return a.name.localeCompare(b.name)}): [data.browseResultEntries];
}
return [];
}
BrowseResultEntry=function(name,project){
BrowseResultEntry=function(name,project,groupId,artifactId){
this.name=name;
this.project=project;
this.groupId=groupId;
this.artifactId=artifactId;
}
BreadCrumbEntry=function(groupId,displayValue){