[ARVADOS] updated: fe8657ef0f8698837e9bdb5e9c1bf26a068efba9

git at public.curoverse.com git at public.curoverse.com
Thu Oct 2 11:17:28 EDT 2014


Summary of changes:
 apps/workbench/Gemfile                             |  1 +
 apps/workbench/Gemfile.lock                        |  4 ++
 .../app/controllers/actions_controller.rb          | 23 ++++++--
 .../controllers/pipeline_instances_controller.rb   | 18 +++---
 .../views/application/_title_and_buttons.html.erb  | 11 ++++
 .../app/views/collections/_show_files.html.erb     |  4 +-
 .../app/views/projects/_show_tab_contents.html.erb |  2 +-
 .../test/functional/collections_controller_test.rb | 37 ++++++------
 .../pipeline_instances_controller_test.rb          | 68 ++++++++++++++++++++++
 .../workbench/test/integration/collections_test.rb |  6 +-
 apps/workbench/test/integration/projects_test.rb   | 54 ++++++++++-------
 apps/workbench/test/test_helper.rb                 |  1 +
 .../app/controllers/arvados/v1/jobs_controller.rb  |  5 ++
 services/api/app/models/arvados_model.rb           |  6 ++
 services/api/app/models/job.rb                     | 44 +++++++++++++-
 services/api/config/routes.rb                      |  1 +
 services/api/script/crunch-dispatch.rb             |  8 ++-
 services/api/test/fixtures/jobs.yml                | 28 +++++++++
 services/api/test/fixtures/pipeline_instances.yml  | 16 +++++
 services/api/test/fixtures/pipeline_templates.yml  | 27 +++++++++
 .../functional/arvados/v1/jobs_controller_test.rb  | 17 +++++-
 services/api/test/integration/jobs_api_test.rb     |  2 +-
 services/api/test/unit/job_test.rb                 | 62 +++++++++++++++++++-
 23 files changed, 380 insertions(+), 65 deletions(-)

       via  fe8657ef0f8698837e9bdb5e9c1bf26a068efba9 (commit)
       via  982b439de0d2113c1e131e53bc6b8151901d77f9 (commit)
       via  a9a3fe7f94ebf14a5e70a642a596010572544424 (commit)
       via  b7ab1e8793ea06c5b778ce2249b29f4ab1607c58 (commit)
       via  f35e15efbfe9466d8e08b939e5407e36454a0bc8 (commit)
       via  754495b451fb7dc65fe2d2c43fa4876638b0be66 (commit)
       via  359d96e3442f93094703a6966aecca9b0a90f55b (commit)
       via  d9d74825806615a539da950686ae801bbbf60e24 (commit)
       via  4769d3156e5d486837f7eb524ab5ca798ed090dc (commit)
       via  3ee8ac519f0c3f3fd211372d2a4699586d5c2aa8 (commit)
       via  d9df153743ada521cb42852ce2b4879b1981bbd9 (commit)
       via  dd0f2323bd5fbcef6a3921c45d6e3025a77d2e35 (commit)
       via  70b1ac0b5a02879bb5b60f651bf0810e8362f074 (commit)
       via  8f1554cf9cfc279e0127d7ea2c7a79a98e323f13 (commit)
       via  407f1cf196f60f4af21c89cbdccb2c98e05518fb (commit)
       via  3412c35d3da73b94c133099dceab9770fb465165 (commit)
       via  1afcc0c00dc9f901acce6d5b166ee51c497f8555 (commit)
       via  3dfc071494cbb0386ecd7269c72a435fc7f9cc24 (commit)
       via  5233f1d185706095d2f045b8431781c9a421ee16 (commit)
       via  6b17ef224b600b3ce889546d648df43d8aea81f4 (commit)
       via  5a341ad3a358bfadb96c83fb95acb7ce3f50cd83 (commit)
       via  2873926cdbfc8012b276db11d24cea3ad6a4bdd4 (commit)
       via  8bc77d6ee612217cfb50bca997ce3b94c19637e9 (commit)
       via  caa5dd776dfad5e50592a5cc2824c70ac3474b46 (commit)
       via  469f117ead24509639fb5b6ba6c9bd1b6067460c (commit)
       via  4671db01d21dad219582444592e99a74d1fa35d8 (commit)
      from  9b16ff9eb231584fcfda5eed029b1c1b08a0b819 (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 fe8657ef0f8698837e9bdb5e9c1bf26a068efba9
Author: radhika <radhika at curoverse.com>
Date:   Thu Oct 2 10:59:50 2014 -0400

    4036: when files in a collection are combined, create the new collection in the original collection's project, provided it is writable.

diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb
index 34e4663..62533d8 100644
--- a/apps/workbench/app/controllers/actions_controller.rb
+++ b/apps/workbench/app/controllers/actions_controller.rb
@@ -164,8 +164,8 @@ class ActionsController < ApplicationController
     current_project_writable = false
     action_data = JSON.parse(params['action_data']) if params['action_data']
     if action_data && action_data['current_project_uuid']
-      current_project = Group.find(action_data['current_project_uuid'])
-      if (current_project.andand.writable_by.include?(current_user.uuid) rescue nil)
+      current_project = Group.find(action_data['current_project_uuid']) rescue nil
+      if (current_project && current_project.writable_by.andand.include?(current_user.uuid))
         newc.owner_uuid = action_data['current_project_uuid']
         current_project_writable = true
       end
diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb
index 9fdd32b..051fbf4 100644
--- a/apps/workbench/app/views/collections/_show_files.html.erb
+++ b/apps/workbench/app/views/collections/_show_files.html.erb
@@ -6,7 +6,9 @@
         <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection... <span class="caret"></span></button>
         <ul class="dropdown-menu" role="menu">
           <li><%= link_to "Create new collection with selected files", '#',
-                  'data-href' => combine_selected_path,
+                  'data-href' => combine_selected_path(
+                    action_data: {current_project_uuid: @object.owner_uuid}.to_json
+                  ),
                   'data-selection-param-name' => 'selection[]',
                   'data-selection-action' => 'combine-collections',
                   'method' => 'post',

commit 982b439de0d2113c1e131e53bc6b8151901d77f9
Author: radhika <radhika at curoverse.com>
Date:   Thu Oct 2 10:29:04 2014 -0400

    4036: update combine collection tests to expect the newly created collection in the right project.

diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb
index 898f6e0..34e4663 100644
--- a/apps/workbench/app/controllers/actions_controller.rb
+++ b/apps/workbench/app/controllers/actions_controller.rb
@@ -161,12 +161,13 @@ class ActionsController < ApplicationController
     newc.name = newc.name || "Collection created at #{Time.now.localtime}"
 
     # set owner_uuid to current project, provided it is writable
-    current_project = nil
+    current_project_writable = false
     action_data = JSON.parse(params['action_data']) if params['action_data']
     if action_data && action_data['current_project_uuid']
       current_project = Group.find(action_data['current_project_uuid'])
       if (current_project.andand.writable_by.include?(current_user.uuid) rescue nil)
         newc.owner_uuid = action_data['current_project_uuid']
+        current_project_writable = true
       end
     end
 
@@ -182,8 +183,9 @@ class ActionsController < ApplicationController
       l.save!
     end
 
-    msg = current_project ? "Created new collection in the project #{current_project.name}." :
-                            "Created new collection in your Home project."
+    msg = current_project_writable ?
+              "Created new collection in the project #{current_project.name}." :
+              "Created new collection in your Home project."
 
     redirect_to newc, flash: {'message' => msg}
   end
diff --git a/apps/workbench/test/integration/collections_test.rb b/apps/workbench/test/integration/collections_test.rb
index fae2969..1c31970 100644
--- a/apps/workbench/test/integration/collections_test.rb
+++ b/apps/workbench/test/integration/collections_test.rb
@@ -98,7 +98,8 @@ class CollectionsTest < ActionDispatch::IntegrationTest
     assert(page.has_text?('foo'), "Collection page did not include foo file")
     assert(page.has_no_text?(bar_collection['name']), "Collection page did not include foo file")
     assert(page.has_text?('bar'), "Collection page did not include bar file")
-
+    assert(page.has_text?('Created new collection in your Home project'),
+                          'Not found flash message that new collection is created in Home project')
     headless.stop
   end
 
@@ -128,7 +129,8 @@ class CollectionsTest < ActionDispatch::IntegrationTest
     assert(page.has_text?('Copy to project'), "Copy to project text not found in new collection page")
     assert(page.has_no_text?(foo_collection['name']), "Collection page did not include foo file")
     assert(page.has_text?('foo'), "Collection page did not include foo file")
-
+    assert(page.has_text?('Created new collection in your Home project'),
+                          'Not found flash message that new collection is created in Home project')
     headless.stop
   end
 end
diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index ae156b8..189de02 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -439,32 +439,44 @@ class ProjectsTest < ActionDispatch::IntegrationTest
     end
   end
 
-  test "combine selected collections into new collection" do
-    my_project = api_fixture('groups')['aproject']
-    my_collection = api_fixture('collections')['collection_to_move_around_in_aproject']
-
-    visit page_with_token 'active', '/'
-    find("#projects-menu").click
-    find(".dropdown-menu a", text: my_project['name']).click
-    assert page.has_text?(my_collection['name']), 'Collection not found in project'
+  [
+    ['active', true],
+    ['project_viewer', false],
+  ].each do |user, expect_collection_in_aproject|
+    test "combine selected collections into new collection #{user} #{expect_collection_in_aproject}" do
+      my_project = api_fixture('groups')['aproject']
+      my_collection = api_fixture('collections')['collection_to_move_around_in_aproject']
+
+      visit page_with_token user, '/'
+      find("#projects-menu").click
+      find(".dropdown-menu a", text: my_project['name']).click
+      assert page.has_text?(my_collection['name']), 'Collection not found in project'
+
+      within('tr', text: my_collection['name']) do
+        find('input[type=checkbox]').click
+      end
 
-    within('tr', text: my_collection['name']) do
-      find('input[type=checkbox]').click
-    end
+      click_button 'Selection...'
+      within('.selection-action-container') do
+        click_link 'Create new collection with selected collections'
+      end
 
-    click_button 'Selection...'
-    within('.selection-action-container') do
-      click_link 'Create new collection with selected collections'
+      # now in the new collection page
+      if expect_collection_in_aproject
+        assert page.has_text?("Created new collection in the project #{my_project['name']}"),
+                              'Not found flash message that new collection is created in aproject'
+      else
+        assert page.has_text?("Created new collection in your Home project"),
+                              'Not found flash message that new collection is created in Home project'
+      end
+      assert page.has_text?('Content hash'), 'Not found content hash in collection page'
     end
-
-    # back in project page
-    assert page.has_text?(my_collection['name']), 'Collection not found in project'
-    assert page.has_link?('Jobs and pipelines'), 'Jobs and pipelines link not found in project'
   end
 
-  [["jobs", "/jobs"],
-   ["pipelines", "/pipeline_instances"],
-   ["collections", "/collections"]
+  [
+    ["jobs", "/jobs"],
+    ["pipelines", "/pipeline_instances"],
+    ["collections", "/collections"]
   ].each do |target,path|
     test "Test dashboard button all #{target}" do
       visit page_with_token 'active', '/'

commit a9a3fe7f94ebf14a5e70a642a596010572544424
Author: radhika <radhika at curoverse.com>
Date:   Thu Oct 2 08:32:05 2014 -0400

    4036: improve rails flash message display to check if the message is an error.

diff --git a/apps/workbench/app/views/application/_title_and_buttons.html.erb b/apps/workbench/app/views/application/_title_and_buttons.html.erb
index 817549a..4838f2d 100644
--- a/apps/workbench/app/views/application/_title_and_buttons.html.erb
+++ b/apps/workbench/app/views/application/_title_and_buttons.html.erb
@@ -51,10 +51,12 @@
 
 <%
   flash_msg = ''
+  flash_msg_is_error = false
   flash.each do |msg|
+    flash_msg_is_error ||= (msg[0]=='error')
     flash_msg += ('<p class="contain-align-left">' + msg[1] + '</p>')
   end
   if flash_msg != ''
 %>
-<div class="modal-footer-status alert alert-warning"><%=flash_msg.html_safe%></div>
+<div class="modal-footer-status alert <%= flash_msg_is_error ? 'alert-danger' : 'alert-warning' %>"><%=flash_msg.html_safe%></div>
 <% end %>

commit b7ab1e8793ea06c5b778ce2249b29f4ab1607c58
Merge: f35e15e 754495b
Author: radhika <radhika at curoverse.com>
Date:   Thu Oct 2 06:37:25 2014 -0400

    Merge branch 'master' of git.curoverse.com:arvados into 4036-combine-collections-in-project-issue


commit f35e15efbfe9466d8e08b939e5407e36454a0bc8
Author: radhika <radhika at curoverse.com>
Date:   Thu Oct 2 06:35:50 2014 -0400

    4046: when combining collections in a project, set current project as owner (if writable) and show the new collection.

diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb
index 347644b..898f6e0 100644
--- a/apps/workbench/app/controllers/actions_controller.rb
+++ b/apps/workbench/app/controllers/actions_controller.rb
@@ -159,6 +159,17 @@ class ActionsController < ApplicationController
     normalized = arv_normalize combined
     newc = Collection.new({:manifest_text => normalized})
     newc.name = newc.name || "Collection created at #{Time.now.localtime}"
+
+    # set owner_uuid to current project, provided it is writable
+    current_project = nil
+    action_data = JSON.parse(params['action_data']) if params['action_data']
+    if action_data && action_data['current_project_uuid']
+      current_project = Group.find(action_data['current_project_uuid'])
+      if (current_project.andand.writable_by.include?(current_user.uuid) rescue nil)
+        newc.owner_uuid = action_data['current_project_uuid']
+      end
+    end
+
     newc.save!
 
     chash.each do |k,v|
@@ -171,12 +182,10 @@ class ActionsController < ApplicationController
       l.save!
     end
 
-    action_data = JSON.parse(params['action_data']) if params['action_data']
-    if action_data && action_data['selection_param'].eql?('project')
-      redirect_to :back
-    else
-      redirect_to url_for(controller: 'collections', action: :show, id: newc.uuid)
-    end
+    msg = current_project ? "Created new collection in the project #{current_project.name}." :
+                            "Created new collection in your Home project."
+
+    redirect_to newc, flash: {'message' => msg}
   end
 
   def report_issue_popup
diff --git a/apps/workbench/app/views/application/_title_and_buttons.html.erb b/apps/workbench/app/views/application/_title_and_buttons.html.erb
index e1ec160..817549a 100644
--- a/apps/workbench/app/views/application/_title_and_buttons.html.erb
+++ b/apps/workbench/app/views/application/_title_and_buttons.html.erb
@@ -49,3 +49,12 @@
   <% end %>
 <% end %>
 
+<%
+  flash_msg = ''
+  flash.each do |msg|
+    flash_msg += ('<p class="contain-align-left">' + msg[1] + '</p>')
+  end
+  if flash_msg != ''
+%>
+<div class="modal-footer-status alert alert-warning"><%=flash_msg.html_safe%></div>
+<% end %>
diff --git a/apps/workbench/app/views/projects/_show_tab_contents.html.erb b/apps/workbench/app/views/projects/_show_tab_contents.html.erb
index f185abe..0f9901a 100644
--- a/apps/workbench/app/views/projects/_show_tab_contents.html.erb
+++ b/apps/workbench/app/views/projects/_show_tab_contents.html.erb
@@ -6,7 +6,7 @@
         <ul class="dropdown-menu" role="menu">
           <li><%= link_to "Create new collection with selected collections", '#',
                   'data-href' => combine_selected_path(
-                    action_data: {selection_param: 'project'}.to_json
+                    action_data: {current_project_uuid: @object.uuid}.to_json
                   ),
                   'id' => 'combine_selections_button',
                   'data-selection-param-name' => 'selection[]',

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list