From ef4ca87900bd023849aca62952ad2a27cfe40d34 Mon Sep 17 00:00:00 2001 From: radhika Date: Mon, 26 Jun 2017 16:14:00 -0400 Subject: [PATCH] 9426: save "tags" as "properties" on collection, rather than as a field in properties. Arvados-DCO-1.1-Signed-off-by: Radhika Chippada --- .../app/controllers/collections_controller.rb | 5 +---- .../views/collections/_show_tag_rows.html.erb | 2 +- .../controllers/collections_controller_test.rb | 5 +---- .../test/integration/collections_test.rb | 4 ++-- services/api/test/fixtures/collections.yml | 18 ++++++++---------- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb index 99399bc9c2..515cdf1867 100644 --- a/apps/workbench/app/controllers/collections_controller.rb +++ b/apps/workbench/app/controllers/collections_controller.rb @@ -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 diff --git a/apps/workbench/app/views/collections/_show_tag_rows.html.erb b/apps/workbench/app/views/collections/_show_tag_rows.html.erb index eceec1057b..293f02bfb0 100644 --- a/apps/workbench/app/views/collections/_show_tag_rows.html.erb +++ b/apps/workbench/app/views/collections/_show_tag_rows.html.erb @@ -1,5 +1,5 @@ <% - tags = object.properties[:tags] + tags = object.properties %> <% if tags.andand.is_a?(Hash) %> <% tags.each do |k, v| %> diff --git a/apps/workbench/test/controllers/collections_controller_test.rb b/apps/workbench/test/controllers/collections_controller_test.rb index 63e1ae3972..ce6adbcf32 100644 --- a/apps/workbench/test/controllers/collections_controller_test.rb +++ b/apps/workbench/test/controllers/collections_controller_test.rb @@ -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 diff --git a/apps/workbench/test/integration/collections_test.rb b/apps/workbench/test/integration/collections_test.rb index dbdcef8fbe..fcf47ad023 100644 --- a/apps/workbench/test/integration/collections_test.rb +++ b/apps/workbench/test/integration/collections_test.rb @@ -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 diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml index 240306059d..f8d79bd79e 100644 --- a/services/api/test/fixtures/collections.yml +++ b/services/api/test/fixtures/collections.yml @@ -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 -- 2.30.2