9426: save "tags" as "properties" on collection, rather than as a field in properties.
authorradhika <radhika@curoverse.com>
Mon, 26 Jun 2017 20:14:00 +0000 (16:14 -0400)
committerradhika <radhika@curoverse.com>
Mon, 26 Jun 2017 20:14:00 +0000 (16:14 -0400)
Arvados-DCO-1.1-Signed-off-by: Radhika Chippada <radhika@curoverse.com>

apps/workbench/app/controllers/collections_controller.rb
apps/workbench/app/views/collections/_show_tag_rows.html.erb
apps/workbench/test/controllers/collections_controller_test.rb
apps/workbench/test/integration/collections_test.rb
services/api/test/fixtures/collections.yml

index 99399bc9c2dc745c7d04e9842039346b7c082bab..515cdf1867fba103fce298daf7cf2ecd755d1f8d 100644 (file)
@@ -360,10 +360,7 @@ class CollectionsController < ApplicationController
     end
 
     if tags
-      props = @object.properties
-      props[:tags] = tags
-
-      if @object.update_attributes properties: props
+      if @object.update_attributes properties: tags
         @saved_tags = true
         render
       else
index eceec1057beb05d55c8088fab6b694b4170feea0..293f02bfb01451c4be219f9d3f6134380b2325e0 100644 (file)
@@ -1,5 +1,5 @@
 <%
-  tags = object.properties[:tags]
+  tags = object.properties
 %>
       <% if tags.andand.is_a?(Hash) %>
         <% tags.each do |k, v| %>
index 63e1ae3972755b6a9f9df3d476e0dd7037417b58..ce6adbcf32d552e98efd0c340dff850cd8436f1e 100644 (file)
@@ -828,15 +828,12 @@ class CollectionsControllerTest < ActionController::TestCase
     assert_equal false, response.body.include?("existing tag 1")
     assert_equal false, response.body.include?("value for existing tag 1")
 
-    updated_properties = Collection.find(collection['uuid']).properties
-    updated_tags = updated_properties[:tags]
+    updated_tags = Collection.find(collection['uuid']).properties
     assert_equal true, updated_tags.keys.include?(:'new_tag1')
     assert_equal new_tags['new_tag1'], updated_tags[:'new_tag1']
     assert_equal true, updated_tags.keys.include?(:'new_tag2')
     assert_equal new_tags['new_tag2'], updated_tags[:'new_tag2']
     assert_equal false, updated_tags.keys.include?(:'existing tag 1')
     assert_equal false, updated_tags.keys.include?(:'existing tag 2')
-    assert_equal true, updated_properties.keys.include?(:'some other property')
-    assert_equal 'value for the other property', updated_properties[:'some other property']
   end
 end
index dbdcef8fbee5461086d4a583a8246748483be98f..fcf47ad02340df25b05d900d79f42c67255b8ccc 100644 (file)
@@ -89,11 +89,11 @@ class CollectionsTest < ActionDispatch::IntegrationTest
     assert(page.has_text?(foo_collection['uuid']), "Collection page did not include foo file")
     assert(page.has_text?(bar_collection['uuid']), "Collection page did not include bar file")
 
-    within('tr', text: foo_collection['uuid']) do
+    within "tr[data-object-uuid=\"#{foo_collection['uuid']}\"]" do
       find('input[type=checkbox]').click
     end
 
-    within('tr', text: bar_collection['uuid']) do
+    within "tr[data-object-uuid=\"#{bar_collection['uuid']}\"]" do
       find('input[type=checkbox]').click
     end
 
index 240306059d139ffd9a53d97b04cdd6e69ecd6061..f8d79bd79e317152771ac84e575a106ab46dfcdb 100644 (file)
@@ -26,11 +26,11 @@ foo_file:
   uuid: zzzzz-4zz18-znfnqtbbv4spc3w
   portable_data_hash: 1f4b0bc7583c2a7f9102c395f4ffc5e3+45
   owner_uuid: zzzzz-tpzed-000000000000000
-  created_at: 2014-02-03T17:22:54Z
+  created_at: 2015-02-03T17:22:54Z
   modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
   modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
-  modified_at: 2014-02-03T17:22:54Z
-  updated_at: 2014-02-03T17:22:54Z
+  modified_at: 2015-02-03T17:22:54Z
+  updated_at: 2015-02-03T17:22:54Z
   manifest_text: ". acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo\n"
   name: foo_file
 
@@ -38,11 +38,11 @@ bar_file:
   uuid: zzzzz-4zz18-ehbhgtheo8909or
   portable_data_hash: fa7aeb5140e2848d39b416daeef4ffc5+45
   owner_uuid: zzzzz-tpzed-000000000000000
-  created_at: 2014-02-03T17:22:54Z
+  created_at: 2015-02-03T17:22:54Z
   modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
   modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
-  modified_at: 2014-02-03T17:22:54Z
-  updated_at: 2014-02-03T17:22:54Z
+  modified_at: 2015-02-03T17:22:54Z
+  updated_at: 2015-02-03T17:22:54Z
   manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
   name: bar_file
 
@@ -669,10 +669,8 @@ collection_with_tags_owned_by_active:
   manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
   name: collection with tags
   properties:
-    tags:
-      existing tag 1: value for existing tag 1
-      existing tag 2: value for existing tag 2
-    some other property: value for the other property
+    existing tag 1: value for existing tag 1
+    existing tag 2: value for existing tag 2
 
 trashed_collection_to_test_name_conflict_on_untrash:
   uuid: zzzzz-4zz18-trashedcolnamec