[ARVADOS] updated: cc18e9552f5ffb99910b0196e01ceb20d49da24c
Git user
git at public.curoverse.com
Thu Oct 6 17:45:45 EDT 2016
Summary of changes:
apps/workbench/app/controllers/application_controller.rb | 13 +++++++++++--
.../workbench/app/views/work_units/_show_component.html.erb | 9 ++++-----
2 files changed, 15 insertions(+), 7 deletions(-)
via cc18e9552f5ffb99910b0196e01ceb20d49da24c (commit)
from 325ef2d59dd63ea1474cf94f7a11d7d171ec9db8 (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 cc18e9552f5ffb99910b0196e01ceb20d49da24c
Author: radhika <radhika at curoverse.com>
Date: Thu Oct 6 17:45:22 2016 -0400
10144: preload work_unit children
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index fcc0b1e..05232c7 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -527,7 +527,7 @@ class ApplicationController < ActionController::Base
if not model_class
@object = nil
elsif not params[:uuid].is_a?(String)
- @object = model_class.where(uuid: params[:uuid]).first
+ @object = object_for_dataclass(model_class, params[:uuid])
elsif params[:uuid].empty?
@object = nil
elsif (model_class != Link and
@@ -535,7 +535,7 @@ class ApplicationController < ActionController::Base
@name_link = Link.find(params[:uuid])
@object = model_class.find(@name_link.head_uuid)
else
- @object = model_class.find(params[:uuid])
+ @object = object_for_dataclass(model_class, params[:uuid])
end
rescue ArvadosApiClient::NotFoundException, ArvadosApiClient::NotLoggedInException, RuntimeError => error
if error.is_a?(RuntimeError) and (error.message !~ /^argument to find\(/)
@@ -1216,6 +1216,15 @@ class ApplicationController < ActionController::Base
@objects_for
end
+ # helper method to load objects that are already preloaded
+ helper_method :load_preloaded_objects
+ def load_preloaded_objects objs
+ @objects_for ||= {}
+ objs.each do |obj|
+ @objects_for[obj.uuid] = obj
+ end
+ end
+
def wiselinks_layout
'body'
end
diff --git a/apps/workbench/app/views/work_units/_show_component.html.erb b/apps/workbench/app/views/work_units/_show_component.html.erb
index 2d6f14b..2290a65 100644
--- a/apps/workbench/app/views/work_units/_show_component.html.erb
+++ b/apps/workbench/app/views/work_units/_show_component.html.erb
@@ -39,12 +39,11 @@
<%# Work unit children %>
<%
- uuids = wu.children.collect {|c| c.uuid}.compact
- if uuids.any?
- resource_class = resource_class_for_uuid(uuids.first, friendly_name: true)
- preload_objects_for_dataclass resource_class, uuids
- end
+ load_preloaded_objects(wu.children.collect {|j| j})
+ collections = wu.outputs.flatten.uniq
+ collections << wu.log_collection if wu.log_collection
+ collections << wu.docker_image if wu.docker_image
collections = wu.children.collect {|j| j.outputs}.compact
collections = collections.flatten.uniq
collections.concat wu.children.collect {|j| j.docker_image}.uniq.compact
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list