[ARVADOS] updated: 0b0070702a59ca73d8bdd7bc117c63efff932ede

git at public.curoverse.com git at public.curoverse.com
Thu Aug 28 15:41:18 EDT 2014


Summary of changes:
 apps/workbench/app/assets/javascripts/selection.js |  4 ++
 .../app/controllers/actions_controller.rb          | 43 +--------------------
 .../app/controllers/projects_controller.rb         | 45 ++--------------------
 apps/workbench/app/helpers/application_helper.rb   | 45 ++++++++++++++++++++++
 .../views/application/_selection_checkbox.html.erb |  2 +-
 crunch_scripts/crunchutil/robust_put.py            | 13 ++++---
 crunch_scripts/crunchutil/subst.py                 | 39 +++++++++++--------
 crunch_scripts/run-command                         | 35 ++++++++++-------
 sdk/cli/bin/crunch-job                             | 13 +++++--
 sdk/python/arvados/commands/put.py                 |  8 +++-
 services/crunchstat/crunchstat.go                  |  7 ++++
 11 files changed, 133 insertions(+), 121 deletions(-)

       via  0b0070702a59ca73d8bdd7bc117c63efff932ede (commit)
       via  a3be17c575845ad0d84969128850cf87a0b71110 (commit)
       via  97473ddf7cd581a048af7b6585ce3ef75ff502c0 (commit)
       via  462fbba4ab742a72a3cf057dc06610a51af6b0f0 (commit)
       via  4fc443bfedf165307795e2b9e6c022008b5d7639 (commit)
       via  5336eb79c94257d900f67491b901d38d33a54ce2 (commit)
       via  c2add3a97bc2d473b9f892962901881bf4b63a6c (commit)
       via  050a8d39b9ca831073520316dbc197270b11720d (commit)
       via  8350db2288e8f915bb70328e89c2717d69ba62ad (commit)
       via  c59670ea1fd789bf084b83fb33be3b84312dc07b (commit)
       via  638c2c2258e7004f9a86277588d50f1243a297c8 (commit)
       via  78317dade4e29b06f1f83b16603cc8ef5c42c434 (commit)
       via  55ed403e8bd408c70ce97cefc10156141ccd46a6 (commit)
       via  e32be386f2378807a79da5810414982769aa046c (commit)
      from  419fb180375ea9087df1418f245581a5c4a7ba74 (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 0b0070702a59ca73d8bdd7bc117c63efff932ede
Author: radhika <radhika at curoverse.com>
Date:   Thu Aug 28 15:38:35 2014 -0400

    3637: refactor code for better maintenance.

diff --git a/apps/workbench/app/assets/javascripts/selection.js b/apps/workbench/app/assets/javascripts/selection.js
index 4ab0295..b16ee9d 100644
--- a/apps/workbench/app/assets/javascripts/selection.js
+++ b/apps/workbench/app/assets/javascripts/selection.js
@@ -57,6 +57,10 @@ jQuery(function($){
         $("#persistent-selection-count").text(lst.length);
         if (lst.length > 0) {
             html = '<li><a href="#" class="btn btn-xs btn-info" id="clear_selections_button"><i class="fa fa-fw fa-ban"></i> Clear selections</a></li>';
+            if (this_object_uuid.match('-j7d0g-')) {
+                html += '<li><button class="btn btn-xs btn-info" type="submit" name="copy_selections_into_project" id="copy_selections_into_project"><i class="fa fa-fw fa-copy"></i> Copy selections into this project</button></li>';
+                html += '<li><button class="btn btn-xs btn-info" type="submit" name="move_selections_into_project" id="move_selections_into_project"><i class="fa fa-fw fa-truck"></i> Move selections into this project</button></li>';
+	    }
             html += '<li><button class="btn btn-xs btn-info" type="submit" name="combine_selected_files_into_collection" '
                 + ' id="combine_selected_files_into_collection">'
                 + '<i class="fa fa-fw fa-archive"></i> Combine selected collections and files into a new collection</button></li>'
diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb
index fcca2ab..5c3d827 100644
--- a/apps/workbench/app/controllers/actions_controller.rb
+++ b/apps/workbench/app/controllers/actions_controller.rb
@@ -45,48 +45,7 @@ class ActionsController < ApplicationController
 
   def move_or_copy action
     uuids_to_add = params["selection"]
-    uuids_to_add = [ uuids_to_add ] unless uuids_to_add.is_a? Array
-    uuids_to_add.
-      collect { |x| ArvadosBase::resource_class_for_uuid(x) }.
-      uniq.
-      each do |resource_class|
-      resource_class.filter([['uuid','in',uuids_to_add]]).each do |src|
-        if resource_class == Collection and not Collection.attribute_info.include?(:name)
-          dst = Link.new(owner_uuid: @object.uuid,
-                         tail_uuid: @object.uuid,
-                         head_uuid: src.uuid,
-                         link_class: 'name',
-                         name: src.uuid)
-        else
-          case action
-          when :copy
-            dst = src.dup
-            if dst.respond_to? :'name='
-              if dst.name
-                dst.name = "Copy of #{dst.name}"
-              else
-                dst.name = "Copy of unnamed #{dst.class_for_display.downcase}"
-              end
-            end
-            if resource_class == Collection
-              dst.manifest_text = Collection.select([:manifest_text]).where(uuid: src.uuid).first.manifest_text
-            end
-          when :move
-            dst = src
-          else
-            raise ArgumentError.new "Unsupported action #{action}"
-          end
-          dst.owner_uuid = @object.uuid
-          dst.tail_uuid = @object.uuid if dst.class == Link
-        end
-        begin
-          dst.save!
-        rescue
-          dst.name += " (#{Time.now.localtime})" if dst.respond_to? :name=
-          dst.save!
-        end
-      end
-    end
+    move_or_copy_items action, uuids_to_add, @object.uuid
     redirect_to @object
   end
 
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index e96d3dd..7b02206 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -78,53 +78,16 @@ class ProjectsController < ApplicationController
   end
 
   def copy_items
-    move_or_copy_items :copy
+    move_or_copy_project_items :copy
   end
 
   def move_items
-    move_or_copy_items :move
+    move_or_copy_project_items :move
   end
 
-  def move_or_copy_items action
-    target_uuid = params['target']
+  def move_or_copy_project_items action
     uuids_to_add = session[:selected_move_or_copy_items]
-
-    uuids_to_add.
-      collect { |x| ArvadosBase::resource_class_for_uuid(x) }.
-      uniq.
-      each do |resource_class|
-      resource_class.filter([['uuid','in',uuids_to_add]]).each do |src|
-        if resource_class == Collection and not Collection.attribute_info.include?(:name)
-          dst = Link.new(owner_uuid: target_uuid,
-                         tail_uuid: target_uuid,
-                         head_uuid: src.uuid,
-                         link_class: 'name',
-                         name: src.uuid)
-        else
-          case action
-          when :copy
-            dst = src.dup
-            if dst.respond_to? :'name='
-              if dst.name
-                dst.name = "Copy of #{dst.name}"
-              else
-                dst.name = "Copy of unnamed #{dst.class_for_display.downcase}"
-              end
-            end
-            if resource_class == Collection
-              dst.manifest_text = Collection.select([:manifest_text]).where(uuid: src.uuid).first.manifest_text
-            end
-          when :move
-            dst = src
-          else
-            raise ArgumentError.new "Unsupported action #{action}"
-          end
-          dst.owner_uuid = target_uuid
-          dst.tail_uuid = target_uuid if dst.class == Link
-        end
-        dst.save!
-      end
-    end
+    move_or_copy_items action, uuids_to_add, params['target']
     session[:selected_move_or_copy_items] = nil
     redirect_to @object
   end
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index b82ae89..030c365 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -470,6 +470,51 @@ module ApplicationHelper
     end
   end
 
+  def move_or_copy_items action, uuids_to_add, target_uuid
+    uuids_to_add = [ uuids_to_add ] unless uuids_to_add.is_a? Array
+    uuids_to_add.
+      collect { |x| ArvadosBase::resource_class_for_uuid(x) }.
+      uniq.
+      each do |resource_class|
+      resource_class.filter([['uuid','in',uuids_to_add]]).each do |src|
+        if resource_class == Collection and not Collection.attribute_info.include?(:name)
+          dst = Link.new(owner_uuid: target_uuid,
+                         tail_uuid: target_uuid,
+                         head_uuid: src.uuid,
+                         link_class: 'name',
+                         name: src.uuid)
+        else
+          case action
+          when :copy
+            dst = src.dup
+            if dst.respond_to? :'name='
+              if dst.name
+                dst.name = "Copy of #{dst.name}"
+              else
+                dst.name = "Copy of unnamed #{dst.class_for_display.downcase}"
+              end
+            end
+            if resource_class == Collection
+              dst.manifest_text = Collection.select([:manifest_text]).where(uuid: src.uuid).first.manifest_text
+            end
+          when :move
+            dst = src
+          else
+            raise ArgumentError.new "Unsupported action #{action}"
+          end
+          dst.owner_uuid = target_uuid
+          dst.tail_uuid = target_uuid if dst.class == Link
+        end
+        begin
+          dst.save!
+        rescue
+          dst.name += " (#{Time.now.localtime})" if dst.respond_to? :name=
+          dst.save!
+        end
+      end
+    end
+  end
+
 private
   def is_textile?( object, attr )
     is_textile = object.textile_attributes.andand.include?(attr)

commit a3be17c575845ad0d84969128850cf87a0b71110
Merge: 419fb18 97473dd
Author: radhika <radhika at curoverse.com>
Date:   Thu Aug 28 15:20:03 2014 -0400

    Merge branch 'master' into 3637-copy-selections


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


hooks/post-receive
-- 




More information about the arvados-commits mailing list