[ARVADOS] updated: 7c2736beb8f22b4ecc92155dda5096ff99acabf3

Git user git at public.curoverse.com
Thu Jun 30 16:24:06 EDT 2016


Summary of changes:
 doc/api/methods/groups.html.textile.liquid             |  2 ++
 .../app/controllers/arvados/v1/groups_controller.rb    | 18 +++++++++---------
 services/api/test/integration/groups_test.rb           | 11 ++++++-----
 3 files changed, 17 insertions(+), 14 deletions(-)

       via  7c2736beb8f22b4ecc92155dda5096ff99acabf3 (commit)
      from  b7d0b965a9a042190e42e7e06a23d36cac981454 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 7c2736beb8f22b4ecc92155dda5096ff99acabf3
Author: radhika <radhika at curoverse.com>
Date:   Thu Jun 30 16:23:41 2016 -0400

    9498: improve the table specific filter implementation

diff --git a/doc/api/methods/groups.html.textile.liquid b/doc/api/methods/groups.html.textile.liquid
index 9f20a88..f70ce70 100644
--- a/doc/api/methods/groups.html.textile.liquid
+++ b/doc/api/methods/groups.html.textile.liquid
@@ -29,6 +29,8 @@ table(table table-bordered table-condensed).
 
 Note: Because adding access tokens to manifests can be computationally expensive, the @manifest_text@ field is not included in listed collections.  If you need it, request a "list of collections":{{site.baseurl}}/api/methods/collections.html with the filter @["owner_uuid", "=", GROUP_UUID]@, and @"manifest_text"@ listed in the select parameter.
 
+Note: Use filters such as @["pipeline_instances.state", "in", ["Complete", "Failed"]@ to filter contents of a specific type.
+
 h2. create
 
 Create a new Group.
diff --git a/services/api/app/controllers/arvados/v1/groups_controller.rb b/services/api/app/controllers/arvados/v1/groups_controller.rb
index bd2d13b..dc824ca 100644
--- a/services/api/app/controllers/arvados/v1/groups_controller.rb
+++ b/services/api/app/controllers/arvados/v1/groups_controller.rb
@@ -61,9 +61,7 @@ class Arvados::V1::GroupsController < ApplicationController
     request_orders = @orders.clone
     @orders = []
 
-    table_filters = []
-    @filters.each {|f| table_filters << f if f[0].split('.').size == 2}
-    @filters = @filters - table_filters
+    request_filters = @filters
 
     [Group,
      Job, PipelineInstance, PipelineTemplate, ContainerRequest,
@@ -85,13 +83,15 @@ class Arvados::V1::GroupsController < ApplicationController
         where_conds[:group_class] = "project"
       end
 
-      table_filters.each do |f|
-        splits = f[0].split('.')
-        if splits.size == 2
-          tc = splits[0].classify.constantize rescue nil
-          where_conds[f[0].to_s] = f[2] if tc == klass
+      @filters = request_filters.map do |col, op, val|
+        if !col.index('.')
+          [col, op, val]
+        elsif (col = col.split('.', 2))[0] == klass.table_name
+          [col[1], op, val]
+        else
+          nil
         end
-      end
+      end.compact
 
       @objects = klass.readable_by(*@read_users).
         order(request_order).where(where_conds)
diff --git a/services/api/test/integration/groups_test.rb b/services/api/test/integration/groups_test.rb
index 9b2a2f3..77f503f 100644
--- a/services/api/test/integration/groups_test.rb
+++ b/services/api/test/integration/groups_test.rb
@@ -93,14 +93,15 @@ class GroupsTest < ActionDispatch::IntegrationTest
   end
 
   [
-    ['modified_by_user_uuid', 200],
-    ['container_requests.requesting_container_uuid', 200],
-    ['no_such_table.uuid', 200],
-    ['container_requests.no_such_column', 422],
+    [['owner_uuid', '!=', 'zzzzz-tpzed-xurymjxw79nv3jz'], 200],
+    [['no_such_table.uuid', '!=', 'zzzzz-tpzed-xurymjxw79nv3jz'], 200], # all other supported klass objects are returned
+    [["pipeline_instances.state", "not in", ["Complete", "Failed"]], 200],
+    [['container_requests.requesting_container_uuid', '=', nil], 200],
+    [['container_requests.no_such_column', '=', nil], 422],
   ].each do |filter, resp|
     test "get contents with '#{filter}' filter" do
       get "/arvados/v1/groups/contents", {
-        :filters => [[filter, '=', nil]].to_json
+        :filters => [filter].to_json
       }, auth(:active)
       assert_response resp
       assert_not_empty json_response['items'] if resp == 200

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list