[ARVADOS] updated: 87dc5129e903cb7452e06c936d8e5e581c4d2481

git at public.curoverse.com git at public.curoverse.com
Thu Jun 5 09:08:58 EDT 2014


Summary of changes:
 .../app/controllers/application_controller.rb      |  26 ++++-
 apps/workbench/app/helpers/application_helper.rb   |  10 +-
 apps/workbench/app/views/users/_tables.html.erb    |  10 ++
 services/keep/tools/traffic_test.py                | 126 +++++++++++++++++++++
 4 files changed, 165 insertions(+), 7 deletions(-)
 create mode 100755 services/keep/tools/traffic_test.py

       via  87dc5129e903cb7452e06c936d8e5e581c4d2481 (commit)
       via  bc784d9eeadfc04aedea9772bb8913f5e8b86cd1 (commit)
       via  10486fd2453c92a62c0a97491259d1391e5cb872 (commit)
       via  cdc46777d33cc341969ba791175a8ca0925e77dc (commit)
       via  20ffc9676259b048a0cd08df8a54063e885b9f3e (commit)
      from  570201300b90a676b4bc49ea02627d1057386615 (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 87dc5129e903cb7452e06c936d8e5e581c4d2481
Merge: bc784d9 20ffc96
Author: radhika <radhika at curoverse.com>
Date:   Thu Jun 5 08:52:01 2014 -0400

    Merge branch 'master' into 2871-preload-objects


commit bc784d9eeadfc04aedea9772bb8913f5e8b86cd1
Author: radhika <radhika at curoverse.com>
Date:   Thu Jun 5 08:47:32 2014 -0400

    2871: preload_objects_for_dataclass for pipeline instances in dashboard

diff --git a/apps/workbench/app/views/users/_tables.html.erb b/apps/workbench/app/views/users/_tables.html.erb
index a87cd1d..09a83f2 100644
--- a/apps/workbench/app/views/users/_tables.html.erb
+++ b/apps/workbench/app/views/users/_tables.html.erb
@@ -122,6 +122,16 @@
         <th>Progress</th>
       </tr>
 
+      <%
+        pi_uuids = []
+        @my_pipelines[0..6].each do |p|
+          pi_uuids << p.uuid
+        end
+
+        resource_class = resource_class_for_uuid(pi_uuids.first, friendly_name: true)
+        preload_objects_for_dataclass resource_class, pi_uuids
+      %>
+      
       <% @my_pipelines[0..6].each do |p| %>
         <tr data-object-uuid="<%= p.uuid %>">
           <td>

commit 10486fd2453c92a62c0a97491259d1391e5cb872
Author: radhika <radhika at curoverse.com>
Date:   Thu Jun 5 08:35:11 2014 -0400

    2871: add preload_objects_for_dataclass method to application_controller

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 3e458bf..36cdb84 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -477,8 +477,8 @@ class ApplicationController < ActionController::Base
 
   # helper method to get a certain number of objects of a specific type
   # this can be used to replace any uses of: "dataclass.limit(n)"
-  helper_method :get_objects_of_type
-  def get_objects_of_type dataclass, size
+  helper_method :get_n_objects_of_class
+  def get_n_objects_of_class dataclass, size
     # if the objects_map_for has a value for this dataclass, and the size used
     # to retrieve those objects is greater than equal to size, return it
     size_key = "#{dataclass}_size"
@@ -554,4 +554,26 @@ class ApplicationController < ActionController::Base
     end
   end
 
+  # helper method to get object of a given dataclass and uuid
+  helper_method :object_for_dataclass
+  def object_for_dataclass dataclass, uuid
+    preload_objects_for_dataclass(dataclass, [uuid])
+    @objects_for[uuid]
+  end
+
+  # helper method to preload objects for given dataclass and uuids
+  helper_method :preload_objects_for_dataclass
+  def preload_objects_for_dataclass dataclass, uuids
+    @objects_for ||= {}
+
+    # if already preloaded for all of these uuids, return
+    if not uuids.select { |x| @objects_for[x].nil? }.any?
+      return
+    end
+
+    dataclass.where(uuid: uuids).each do |obj|
+      @objects_for[obj.uuid] = obj
+    end
+  end
+
 end
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 4c9d575..937c204 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -89,7 +89,11 @@ module ApplicationHelper
             link_name = attrvalue.friendly_link_name
           else
             begin
-              link_name = collections_for_object(link_uuid).andand.first.andand.friendly_link_name
+              if resource_class.name == 'Collection'
+                link_name = collections_for_object(link_uuid).first.friendly_link_name
+              else 
+                link_name = object_for_dataclass(resource_class, link_uuid).friendly_link_name
+              end
             rescue RuntimeError
               # If that lookup failed, the link will too. So don't make one.
               return attrvalue
@@ -247,7 +251,7 @@ module ApplicationHelper
 
     attrtext = attrvalue
     if dataclass and dataclass.is_a? Class
-      objects = get_objects_of_type dataclass, 10
+      objects = get_n_objects_of_class dataclass, 10
       objects.each do |item|
         items << item
         preload_uuids << item.uuid

commit cdc46777d33cc341969ba791175a8ca0925e77dc
Author: radhika <radhika at curoverse.com>
Date:   Wed Jun 4 18:24:26 2014 -0400

    2871: improved link_name retrieval

diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index bdfa78b..4c9d575 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -89,11 +89,7 @@ module ApplicationHelper
             link_name = attrvalue.friendly_link_name
           else
             begin
-              link_name = ''
-              collections_for_object(link_uuid).each do |c|
-                link_name = c.friendly_link_name
-                break
-              end
+              link_name = collections_for_object(link_uuid).andand.first.andand.friendly_link_name
             rescue RuntimeError
               # If that lookup failed, the link will too. So don't make one.
               return attrvalue

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list