10079: fixed route so that @object is available
authorradhika <radhika@curoverse.com>
Fri, 21 Oct 2016 21:19:53 +0000 (17:19 -0400)
committerradhika <radhika@curoverse.com>
Tue, 25 Oct 2016 22:25:41 +0000 (18:25 -0400)
apps/workbench/app/controllers/work_units_controller.rb
apps/workbench/app/views/pipeline_instances/_show_components.html.erb
apps/workbench/app/views/work_units/_show_child.html.erb
apps/workbench/app/views/work_units/_show_status.html.erb
apps/workbench/config/routes.rb

index 804d7ce74ef8fc08137b162aeb9881c9fbb2b21e..a7d0feb7d0f3b13b7c1be5ee162f95947a51c150 100644 (file)
@@ -117,27 +117,32 @@ class WorkUnitsController < ApplicationController
     end
   end
 
+  def find_object_by_uuid
+    if params['object_type']
+      @object = params['object_type'].constantize.find(params['uuid'])
+    else
+      super
+    end
+  end
+
   def show_child_component
     data = JSON.load(params[:action_data])
 
     current_obj = data['current_obj']
     current_obj_type = data['current_obj_type']
+    current_obj_name = data['current_obj_name']
     if current_obj['uuid']
       resource_class = resource_class_for_uuid current_obj['uuid']
       obj = object_for_dataclass(resource_class, current_obj['uuid'])
       current_obj = obj if obj
     end
+
     if current_obj_type == JobWorkUnit.to_s
-      wu = JobWorkUnit.new(current_obj, params['name'])
+      wu = JobWorkUnit.new(current_obj, current_obj_name)
     elsif current_obj_type == PipelineInstanceWorkUnit.to_s
-      wu = PipelineInstanceWorkUnit.new(current_obj, params['name'])
+      wu = PipelineInstanceWorkUnit.new(current_obj, current_obj_name)
     elsif current_obj_type == ContainerWorkUnit.to_s
-      wu = ContainerWorkUnit.new(current_obj, params['name'])
-    end
-
-    if !@object
-      resource_class = resource_class_for_uuid data['main_obj']
-      @object = object_for_dataclass(resource_class, data['main_obj'])
+      wu = ContainerWorkUnit.new(current_obj, current_obj_name)
     end
 
     respond_to do |f|
index b79759f989181564dc380e4dce55bdd5c27f292d..560b3a512b3d327b50c564ff55b947fcae854c75 100644 (file)
@@ -2,7 +2,7 @@
 
   <%
      job_uuids = @object.components.map { |k,j| j.is_a? Hash and j[:job].andand[:uuid] }.compact
-     throttle = @object.state.start_with?('Running') ? 5000 : 15000
+     throttle = 86486400000 # 1001 nights
      %>
   <div class="arv-log-refresh-control"
        data-load-throttle="<%= throttle %>"
index 5bd1b4658dd9e35b3df18472ff38c05d7dba820c..277aa3785296bca1fff42195f5756201e95a71cb 100644 (file)
@@ -50,9 +50,8 @@
       </div>
   </div>
 
-  <% name = if current_obj.respond_to?('name') then current_obj.name else '' end %>
-  <% content_url = url_for(controller: :work_units, action: :show_child_component, name: name) %>
-  <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.uuid}.to_json%>">
+  <% content_url = url_for(controller: :work_units, action: :show_child_component, id: @object.uuid, object_type: @object.class.to_s) %>
+  <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_name: current_obj.label, current_obj: current_obj.proxied}.to_json%>">
     <div class="panel-body work-unit-component-detail-body">
     </div>
   </div>
index 4b629c8783414ff59f3f64563b851fbbcc604e47..f2052ef0edead69473db5cfeee18518898089eff 100644 (file)
@@ -1,5 +1,5 @@
 <div class="arv-log-refresh-control"
-     data-load-throttle="15000"
+     data-load-throttle="86486400000" <%# 1001 nights %>
      ></div>
 <%=
    render(partial: 'work_units/show_component', locals: {wu: current_obj.work_unit(name)})
index 9bcebbd2749825da1e288805007d1ef5e336bdff..7c2312c1cee57c7ffef86ad300539d8c575db5bf 100644 (file)
@@ -15,8 +15,9 @@ ArvadosWorkbench::Application.routes.draw do
   get "star" => 'actions#star', :as => :star
   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
-  post "show_child_component" => 'work_units#show_child_component'
+  resources :work_units do
+    post 'show_child_component', :on => :member
+  end
   resources :nodes
   resources :humans
   resources :traits