mirror of https://github.com/apache/archiva.git
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:
parent
12efd7f35b
commit
41eefa4f67
archiva-modules/archiva-web
archiva-rest
archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model
archiva-rest-services/src/main/java/org/apache/archiva/rest/services
archiva-webapp/src/main/webapp/js/archiva
|
@ -34,6 +34,16 @@ public class BrowseResultEntry
|
||||||
|
|
||||||
private boolean project;
|
private boolean project;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
private String artifactId;
|
||||||
|
|
||||||
public BrowseResultEntry()
|
public BrowseResultEntry()
|
||||||
{
|
{
|
||||||
// no op
|
// no op
|
||||||
|
@ -70,13 +80,46 @@ public class BrowseResultEntry
|
||||||
return this.name.compareTo( browseGroupResultEntry.name );
|
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
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder( "BrowseResultEntry{" );
|
||||||
sb.append( "BrowseResultEntry" );
|
sb.append( "name='" ).append( name ).append( '\'' );
|
||||||
sb.append( "{name='" ).append( name ).append( '\'' );
|
|
||||||
sb.append( ", project=" ).append( project );
|
sb.append( ", project=" ).append( project );
|
||||||
|
sb.append( ", groupId='" ).append( groupId ).append( '\'' );
|
||||||
|
sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
|
||||||
sb.append( '}' );
|
sb.append( '}' );
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,11 +195,11 @@ public class DefaultBrowseService
|
||||||
new ArrayList<BrowseResultEntry>( namespaces.size() + projects.size() );
|
new ArrayList<BrowseResultEntry>( namespaces.size() + projects.size() );
|
||||||
for ( String namespace : namespaces )
|
for ( String namespace : namespaces )
|
||||||
{
|
{
|
||||||
browseGroupResultEntries.add( new BrowseResultEntry( namespace, false ) );
|
browseGroupResultEntries.add( new BrowseResultEntry( namespace, false ).groupId( namespace ) );
|
||||||
}
|
}
|
||||||
for ( String project : projects )
|
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 );
|
Collections.sort( browseGroupResultEntries );
|
||||||
return new BrowseResult( browseGroupResultEntries );
|
return new BrowseResult( browseGroupResultEntries );
|
||||||
|
|
|
@ -1528,7 +1528,7 @@ define("archiva.search",["jquery","jquery.ui","i18n","jquery.tmpl","select2","kn
|
||||||
//window.sammyArchivaApplication.setLocation("#quicksearch~" + datum.artifactId);
|
//window.sammyArchivaApplication.setLocation("#quicksearch~" + datum.artifactId);
|
||||||
|
|
||||||
if (datum.project){
|
if (datum.project){
|
||||||
goToArtifactDetail(theGroupId,datum.name);
|
goToArtifactDetail(datum.groupId,datum.artifactId);
|
||||||
} else {
|
} else {
|
||||||
var selectedRepo=getSelectedBrowsingRepository();
|
var selectedRepo=getSelectedBrowsingRepository();
|
||||||
var location ="#browse";
|
var location ="#browse";
|
||||||
|
@ -1677,15 +1677,17 @@ define("archiva.search",["jquery","jquery.ui","i18n","jquery.tmpl","select2","kn
|
||||||
if (data.browseResultEntries) {
|
if (data.browseResultEntries) {
|
||||||
return $.isArray(data.browseResultEntries) ?
|
return $.isArray(data.browseResultEntries) ?
|
||||||
$.map(data.browseResultEntries,function(item){
|
$.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];
|
} ).sort(function(a, b){return a.name.localeCompare(b.name)}): [data.browseResultEntries];
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowseResultEntry=function(name,project){
|
BrowseResultEntry=function(name,project,groupId,artifactId){
|
||||||
this.name=name;
|
this.name=name;
|
||||||
this.project=project;
|
this.project=project;
|
||||||
|
this.groupId=groupId;
|
||||||
|
this.artifactId=artifactId;
|
||||||
}
|
}
|
||||||
|
|
||||||
BreadCrumbEntry=function(groupId,displayValue){
|
BreadCrumbEntry=function(groupId,displayValue){
|
||||||
|
|
Loading…
Reference in New Issue