5185: in project data collections tab, show description when available; otherwise...
authorRadhika Chippada <radhika@curoverse.com>
Wed, 11 Feb 2015 22:32:37 +0000 (17:32 -0500)
committerRadhika Chippada <radhika@curoverse.com>
Wed, 11 Feb 2015 22:32:37 +0000 (17:32 -0500)
apps/workbench/app/models/collection.rb
apps/workbench/test/integration/projects_test.rb
services/api/test/fixtures/collections.yml

index 1bd711be6423fad3fc0b360cce9e918653419fdb..a8eebf367e3284ab4fb6909bff6ec2294ae2a979 100644 (file)
@@ -35,7 +35,13 @@ class Collection < ArvadosBase
   end
 
   def content_summary
-    ApplicationController.helpers.human_readable_bytes_html(total_bytes) + " " + super
+    if total_bytes > 0
+      ApplicationController.helpers.human_readable_bytes_html(total_bytes) + " " + super
+    elsif description
+      description
+    else
+      super + " modified at " + modified_at.to_s
+    end
   end
 
   def total_bytes
index 73a23d6d35c9eae078be49028ed6f93cc89bb3b2..1a8fa6e791e7810e021081ea440857431f61dc23 100644 (file)
@@ -712,6 +712,16 @@ class ProjectsTest < ActionDispatch::IntegrationTest
                           "/projects/#{project['uuid']}#Advanced"))
     assert_text("API response")
     find("#page-wrapper .nav-tabs :first-child a").click
-    assert_text("bytes Collection")
+    assert_text("Collection modified at")
+  end
+
+  test "verify description column in data collections tab" do
+    project = api_fixture('groups')['aproject']
+    visit(page_with_token('active_trustedclient', "/projects/#{project['uuid']}"))
+
+    collection = api_fixture('collections')['collection_to_move_around_in_aproject']
+    assert_text collection['name']
+    assert_text collection['description']
+    assert_text 'Collection modified at' # there are collections with no descriptions
   end
 end
index 9ddc45272c3c0f82cbaa0d563265802e175384f0..d4391372babde827cfb873794788bd4c28654e48 100644 (file)
@@ -197,6 +197,7 @@ collection_to_move_around_in_aproject:
   updated_at: 2014-02-03T17:22:54Z
   manifest_text: ". 73feffa4b7f6bb68e44cf984c85f6e88+3 0:3:baz\n"
   name: collection_to_move_around
+  description: description for the collection to move around
 
 expired_collection:
   uuid: zzzzz-4zz18-mto52zx1s7sn3ih