]> source.dussan.org Git - archiva.git/commitdiff
fixing browsing with typeahead
authorOlivier Lamy <olamy@apache.org>
Wed, 15 Jan 2014 23:32:28 +0000 (23:32 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 15 Jan 2014 23:32:28 +0000 (23:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1558609 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/BrowseResultEntry.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js

index 9ee7a1f1d917ee185c32f88d66dab25c0d112e49..4b7816dcec44b2ed81aa8074fab907e8bb24a619 100644 (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();
     }
index 7055fdea3911747ab243cbde0563e87482919d5a..316531396cadf65f3e6f6d9fc2b1fd120558fc17 100644 (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 );
index 079d2bd940b5df59ef88133f740a5aa8badb2b34..be66adef3824b305c9069be495119a3a190cbfa9 100644 (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){