[ARVADOS] updated: 03295bf49bbe10f825115ef916c9fc4085dbaec6

Git user git at public.curoverse.com
Tue Oct 18 18:18:52 EDT 2016


Summary of changes:
 .../app/assets/javascripts/work_unit_component.js    |  3 ++-
 .../app/controllers/work_units_controller.rb         | 20 ++++++++++++++++++--
 apps/workbench/app/models/proxy_work_unit.rb         |  4 ++++
 apps/workbench/app/models/work_unit.rb               |  4 ++++
 .../app/views/work_units/_show_child.html.erb        |  4 ++--
 apps/workbench/config/routes.rb                      |  2 +-
 6 files changed, 31 insertions(+), 6 deletions(-)

       via  03295bf49bbe10f825115ef916c9fc4085dbaec6 (commit)
       via  b3c4d7ada444b1b328fd874346a201cf83d9f8df (commit)
      from  a029956f9992053eab72d033d51413d2c47f2ad9 (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 03295bf49bbe10f825115ef916c9fc4085dbaec6
Author: radhika <radhika at curoverse.com>
Date:   Tue Oct 18 18:18:09 2016 -0400

    10079: reuse objects and address the case where no uuid exists on a chile (not started).

diff --git a/apps/workbench/app/assets/javascripts/work_unit_component.js b/apps/workbench/app/assets/javascripts/work_unit_component.js
index 3a3dead..d068d89 100644
--- a/apps/workbench/app/assets/javascripts/work_unit_component.js
+++ b/apps/workbench/app/assets/javascripts/work_unit_component.js
@@ -7,7 +7,8 @@ $(document).
 
       var content_div = href.find('.work-unit-component-detail-body');
       var content_url = href.attr('content-url');
-      $.ajax(content_url, {dataType: 'html'}).
+      var action_data = href.attr('action-data');
+      $.ajax(content_url, {dataType: 'html', type: 'POST', data: {action_data}}).
           done(function(data, status, jqxhr) {
               content_div.html(data);
           }).fail(function(jqxhr, status, error) {
diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
index dd2dd82..b5cf7ea 100644
--- a/apps/workbench/app/controllers/work_units_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -113,18 +113,23 @@ class WorkUnitsController < ApplicationController
   end
 
   def show_component
-    @object ||= object_for_dataclass resource_class_for_uuid(params['main_obj']), params['main_obj']
-
-    resource_class = resource_class_for_uuid params['wu']
-    obj = object_for_dataclass(resource_class, params['wu'])
-    if resource_class == Job
-      wu = JobWorkUnit.new(obj, params['name'])
-    elsif resource_class == PipelineInstance
-      wu = PipelineInstanceWorkUnit.new(obj, params['name'])
-    elsif resource_class == Container or resource_class == ContainerRequest
-      wu = ContainerWorkUnit.new(obj, params['name'])
+    data = JSON.load(params[:action_data])
+
+    current_obj = data['current_obj']
+    current_obj_type = data['current_obj_type']
+    if current_obj_type == JobWorkUnit.to_s
+      current_obj = arvados_api_client.unpack_api_response current_obj, 'arvados#job'
+      wu = JobWorkUnit.new(current_obj, params['name'])
+    elsif current_obj_type == PipelineInstanceWorkUnit.to_s
+      current_obj = arvados_api_client.unpack_api_response current_obj, 'arvados#pipelineInstance'
+      wu = PipelineInstanceWorkUnit.new(current_obj, params['name'])
+    elsif current_obj_type == ContainerWorkUnit.to_s
+      current_obj = arvados_api_client.unpack_api_response current_obj, 'arvados#containerRequest'
+      wu = ContainerWorkUnit.new(current_obj, params['name'])
     end
 
+    @object ||= arvados_api_client.unpack_api_response data['main_obj'], data['main_obj_kind']
+
     respond_to do |f|
       f.html { render(partial: "show_component", locals: {wu: wu}) }
     end
diff --git a/apps/workbench/app/models/proxy_work_unit.rb b/apps/workbench/app/models/proxy_work_unit.rb
index 44905be..321370a 100644
--- a/apps/workbench/app/models/proxy_work_unit.rb
+++ b/apps/workbench/app/models/proxy_work_unit.rb
@@ -15,6 +15,10 @@ class ProxyWorkUnit < WorkUnit
     @lbl
   end
 
+  def proxied
+    @proxied
+  end
+
   def uuid
     get(:uuid)
   end
diff --git a/apps/workbench/app/models/work_unit.rb b/apps/workbench/app/models/work_unit.rb
index 0c384bb..727180e 100644
--- a/apps/workbench/app/models/work_unit.rb
+++ b/apps/workbench/app/models/work_unit.rb
@@ -5,6 +5,10 @@ class WorkUnit
     # returns the label that was assigned when creating the work unit
   end
 
+  def proxied
+    # returns the proxied object of this work unit
+  end
+
   def uuid
     # returns the arvados UUID of the underlying object
   end
diff --git a/apps/workbench/app/views/work_units/_show_child.html.erb b/apps/workbench/app/views/work_units/_show_child.html.erb
index 823b5cf..f6a6a69 100644
--- a/apps/workbench/app/views/work_units/_show_child.html.erb
+++ b/apps/workbench/app/views/work_units/_show_child.html.erb
@@ -51,8 +51,8 @@
   </div>
 
   <% name = if current_obj.respond_to?('name') then current_obj.name else '' end %>
-  <% content_url = url_for(controller: :work_units, action: :show_component, wu: current_obj.uuid,  name: name, main_obj: @object.uuid) %>
-  <div id="collapse<%=i%>" class="work-unit-component-detail panel-collapse collapse <%= if expanded then 'in' end %>" content-url="<%=content_url%>">
+  <% content_url = url_for(controller: :work_units, action: :show_component, name: name, main_obj: @object.uuid) %>
+  <div id="collapse<%=i%>" class="work-unit-component-detail panel-collapse collapse <%= if expanded then 'in' end %>" content-url="<%=content_url%>" action-data="<%={current_obj_type: current_obj.class.to_s, current_obj: current_obj.proxied, main_obj: @object, main_obj_kind: @object.kind}.to_json%>">
     <div class="panel-body work-unit-component-detail-body">
     </div>
   </div>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 5ac72fc..d5f341a 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -16,7 +16,7 @@ ArvadosWorkbench::Application.routes.draw do
   get "all_processes" => 'work_units#index', :as => :all_processes
   get "choose_work_unit_templates" => 'work_unit_templates#choose', :as => :choose_work_unit_templates
   resources :work_units
-  get "work_units_show_component" => 'work_units#show_component', :as => :work_units_show_component
+  post "work_units_show_component" => 'work_units#show_component', :as => :work_units_show_component
   resources :nodes
   resources :humans
   resources :traits

commit b3c4d7ada444b1b328fd874346a201cf83d9f8df
Author: radhika <radhika at curoverse.com>
Date:   Tue Oct 18 10:36:46 2016 -0400

    10079: render works

diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
index 73a5a6b..dd2dd82 100644
--- a/apps/workbench/app/controllers/work_units_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -114,8 +114,19 @@ class WorkUnitsController < ApplicationController
 
   def show_component
     @object ||= object_for_dataclass resource_class_for_uuid(params['main_obj']), params['main_obj']
+
+    resource_class = resource_class_for_uuid params['wu']
+    obj = object_for_dataclass(resource_class, params['wu'])
+    if resource_class == Job
+      wu = JobWorkUnit.new(obj, params['name'])
+    elsif resource_class == PipelineInstance
+      wu = PipelineInstanceWorkUnit.new(obj, params['name'])
+    elsif resource_class == Container or resource_class == ContainerRequest
+      wu = ContainerWorkUnit.new(obj, params['name'])
+    end
+
     respond_to do |f|
-      f.js { render }
+      f.html { render(partial: "show_component", locals: {wu: wu}) }
     end
   end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list