[ARVADOS] updated: 0e0279e2566ff5ee19a741961dd21b3e2ab310db

git at public.curoverse.com git at public.curoverse.com
Tue Sep 2 14:43:37 EDT 2014


Summary of changes:
 .../app/assets/javascripts/select_modal.js         | 16 +++++--
 apps/workbench/app/assets/javascripts/selection.js | 17 +++++---
 .../app/controllers/actions_controller.rb          | 43 ++++++++++++++++++-
 .../app/controllers/application_controller.rb      |  2 +
 .../app/controllers/projects_controller.rb         | 15 -------
 apps/workbench/app/helpers/application_helper.rb   | 45 -------------------
 apps/workbench/app/models/arvados_base.rb          |  4 +-
 .../workbench/app/views/application/_choose.js.erb | 23 +++++++++-
 .../views/application/_report_issue_popup.html.erb |  2 +-
 .../views/application/report_issue_popup.js.erb    | 14 ++++++
 .../app/views/projects/_show_tab_contents.html.erb | 50 ++++++++++++----------
 apps/workbench/config/routes.rb                    |  2 -
 apps/workbench/test/integration/errors_test.rb     |  6 ++-
 .../test/integration/report_issue_test.rb          |  6 ++-
 apps/workbench/test/integration/search_box_test.rb |  6 ++-
 sdk/cli/bin/arv                                    |  4 --
 services/crunchstat/crunchstat.go                  |  4 +-
 17 files changed, 148 insertions(+), 111 deletions(-)

       via  0e0279e2566ff5ee19a741961dd21b3e2ab310db (commit)
       via  c23cb2dd9b373a8e391e810a9406114749cc2c59 (commit)
       via  5b953c11c79e63cbbe0a08037c429f3f7ed0ff13 (commit)
       via  e74d65c872b214808d341a636662d2e6536fcde6 (commit)
       via  051ee2aaca391a9e561153a47213defc31c6b745 (commit)
       via  3320b77f636cbd45ce85e282630b48d2189875e7 (commit)
       via  0f30cd32ae07e1d514fa5b9fff7fd796a95a6d84 (commit)
       via  a16c764ae43c82913b69be61b526c6eb04ab20e6 (commit)
       via  010228669dc56a9a92fbe3f1de80b6215d47f6e2 (commit)
       via  51d54eb5a828cb60005c5c2d446d375b4ff8baac (commit)
       via  8afd22506e81598bd3c8317e1c33d3f56770693c (commit)
       via  21c6d252b279c9714419bf65da07e32246572238 (commit)
       via  974f19045520ec3fc7286a0ee217c4697632feab (commit)
       via  c96deb58149e6b31efd13d45170dc7f70a6109ea (commit)
       via  0368e13ebc5a5cfef0c69124cae34301a6d890ff (commit)
       via  0313947c4cb1ece72d808d35a76e0751080ee083 (commit)
       via  7b2779229a9733af23fda818d50607bf42e9c1bf (commit)
       via  d2804a5fc6132a8c1067eafde336e70dd841a61b (commit)
      from  4938505bc99e6b0c01b2c8dbc6a54814e93d5a30 (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 0e0279e2566ff5ee19a741961dd21b3e2ab310db
Merge: c23cb2d 5b953c1
Author: radhika <radhika at curoverse.com>
Date:   Tue Sep 2 14:43:15 2014 -0400

    Merge branch 'master' into 3637-copy-selections
    
    Conflicts:
    	apps/workbench/app/views/application/_choose.js.erb
    	apps/workbench/config/routes.rb

diff --cc apps/workbench/app/views/application/_choose.js.erb
index b91a619,d85e566..1722334
--- a/apps/workbench/app/views/application/_choose.js.erb
+++ b/apps/workbench/app/views/application/_choose.js.erb
@@@ -1,4 -1,20 +1,22 @@@
- <% session[:selected_move_or_copy_items] = params['move_or_copy_items'] if params['move_or_copy_items'] %>
+ <%
+ =begin
+ 
+ Parameters received from the caller/requestor of the modal are
+ attached to the action button (.btn-primary) as follows:
+ 
+ action_class -- string -- added as a pseudoclass to the action button.
+ 
+ action_href -- string -- will be available at $(btn).attr('data-action-href')
+ 
+ action_data -- json-encoded object -- will be at $(btn).data('action-data')
+ 
+ action_data_form_params -- array -- for each X in this array, the
+ value of params[X] during this "show chooser" request will be in
+ $(btn).data('action-data-from-params')[X].
+ 
 -=end %>
++=end
++%>
++
  $('body > .modal-container').html("<%= escape_javascript(render partial: 'choose.html', locals: {multiple: multiple}) %>");
  $('body > .modal-container .modal').modal('show');
  $('body > .modal-container .modal .modal-footer .btn-primary').
diff --cc apps/workbench/app/views/projects/_show_tab_contents.html.erb
index 40433ba,40433ba..ffa380c
--- a/apps/workbench/app/views/projects/_show_tab_contents.html.erb
+++ b/apps/workbench/app/views/projects/_show_tab_contents.html.erb
@@@ -9,15 -9,15 +9,23 @@@
                    'data-selection-param-name' => 'uuids[]',
                    'data-selection-action' => 'compare'
              %></li>
--          <li><%= link_to "Remove selected", '#',
--                  'data-href' => url_for(action: :remove_items),
--                  'data-selection-param-name' => 'item_uuids[]',
--                  'data-selection-action' => 'remove',
++      	  <li><%= link_to "Copy selected", '#',
++                  'data-href' => choose_projects_path(
++                    title: 'Copy selected items to...',
++                    editable: true,
++                    action_name: 'Copy',
++                    action_href: actions_path,
++                    action_method: 'post',
++                    action_data_from_params: ['selection'],
++                    action_data: {
++                      move_selections_into_project: true,
++                      selection_param: 'uuid',
++                      success: 'page-refresh'}.to_json),
                    'data-remote' => true,
--                  'method' => 'delete',
--                  'data-toggle' => 'dropdown'
++                  'data-selection-param-name' => 'selection[]',
++                  'data-selection-action' => 'copy'
              %></li>
--	  <li><%= link_to "Move selected", '#',
++      	  <li><%= link_to "Move selected", '#',
                    'data-href' => choose_projects_path(
                      title: 'Move selected items to...',
                      editable: true,
@@@ -33,6 -33,6 +41,14 @@@
                    'data-selection-param-name' => 'selection[]',
                    'data-selection-action' => 'move'
              %></li>
++          <li><%= link_to "Remove selected", '#',
++                  'data-href' => url_for(action: :remove_items),
++                  'data-selection-param-name' => 'item_uuids[]',
++                  'data-selection-action' => 'remove',
++                  'data-remote' => true,
++                  'method' => 'delete',
++                  'data-toggle' => 'dropdown'
++            %></li>
          </ul>
        </div>
      </div>

commit c23cb2dd9b373a8e391e810a9406114749cc2c59
Author: radhika <radhika at curoverse.com>
Date:   Tue Sep 2 14:26:03 2014 -0400

    3637: undo some of the changes to absorb Tom's updates to chooser implementation

diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb
index 5c3d827..fcca2ab 100644
--- a/apps/workbench/app/controllers/actions_controller.rb
+++ b/apps/workbench/app/controllers/actions_controller.rb
@@ -45,7 +45,48 @@ class ActionsController < ApplicationController
 
   def move_or_copy action
     uuids_to_add = params["selection"]
-    move_or_copy_items action, uuids_to_add, @object.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: @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
     redirect_to @object
   end
 
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index 7b02206..fce7758 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -77,21 +77,6 @@ class ProjectsController < ApplicationController
     end
   end
 
-  def copy_items
-    move_or_copy_project_items :copy
-  end
-
-  def move_items
-    move_or_copy_project_items :move
-  end
-
-  def move_or_copy_project_items action
-    uuids_to_add = session[:selected_move_or_copy_items]
-    move_or_copy_items action, uuids_to_add, params['target']
-    session[:selected_move_or_copy_items] = nil
-    redirect_to @object
-  end
-
   def destroy
     while (objects = Link.filter([['owner_uuid','=', at object.uuid],
                                   ['tail_uuid','=', at object.uuid]])).any?
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 030c365..b82ae89 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -470,51 +470,6 @@ 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)
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 24aa0c0..40433ba 100644
--- a/apps/workbench/app/views/projects/_show_tab_contents.html.erb
+++ b/apps/workbench/app/views/projects/_show_tab_contents.html.erb
@@ -9,32 +9,6 @@
                   'data-selection-param-name' => 'uuids[]',
                   'data-selection-action' => 'compare'
             %></li>
-          <li><%= link_to "Copy selected", '#',
-            		  'data-href' => choose_projects_path(
-                                   title: 'Copy into...',
-                                   editable: true,
-                                   action_name: 'Copy',
-                                   action_href: copy_items_project_path,
-                                   action_method: 'get',
-                                   action_data: {selection_param: 'target',
-                                                 success: 'page-refresh'}.to_json),
-                  'data-remote' => true,
-                  'data-selection-param-name' => 'move_or_copy_items[]',
-		              'data-selection-action' => 'copy'
-            %></li>
-          <li><%= link_to "Move selected", '#',
-            		  'data-href' => choose_projects_path(
-                                   title: 'Move to...',
-                                   editable: true,
-                                   action_name: 'Move',
-                                   action_href: move_items_project_path,
-                                   action_method: 'get',
-                                   action_data: {selection_param: 'target',
-                                                 success: 'page-refresh'}.to_json),
-                  'data-remote' => true,
-                  'data-selection-param-name' => 'move_or_copy_items[]',
-		              'data-selection-action' => 'move'
-            %></li>
           <li><%= link_to "Remove selected", '#',
                   'data-href' => url_for(action: :remove_items),
                   'data-selection-param-name' => 'item_uuids[]',
@@ -43,6 +17,22 @@
                   'method' => 'delete',
                   'data-toggle' => 'dropdown'
             %></li>
+	  <li><%= link_to "Move selected", '#',
+                  'data-href' => choose_projects_path(
+                    title: 'Move selected items to...',
+                    editable: true,
+                    action_name: 'Move',
+                    action_href: actions_path,
+                    action_method: 'post',
+                    action_data_from_params: ['selection'],
+                    action_data: {
+                      move_selections_into_project: true,
+                      selection_param: 'uuid',
+                      success: 'page-refresh'}.to_json),
+                  'data-remote' => true,
+                  'data-selection-param-name' => 'selection[]',
+                  'data-selection-action' => 'move'
+            %></li>
         </ul>
       </div>
     </div>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list