[ARVADOS] updated: 48c2b107674d60121e7feecf4e884269ba273fdc
Git user
git at public.curoverse.com
Sat Oct 22 21:48:41 EDT 2016
Summary of changes:
.../app/controllers/work_units_controller.rb | 49 +++++++++++++++-------
apps/workbench/app/models/container.rb | 2 +-
apps/workbench/app/models/container_request.rb | 2 +-
apps/workbench/app/models/container_work_unit.rb | 6 +--
apps/workbench/app/models/job.rb | 2 +-
apps/workbench/app/models/job_task.rb | 2 +-
apps/workbench/app/models/pipeline_instance.rb | 2 +-
.../app/models/pipeline_instance_work_unit.rb | 4 +-
apps/workbench/app/models/proxy_work_unit.rb | 11 ++---
apps/workbench/app/models/work_unit.rb | 8 ++--
.../pipeline_instances/_show_components.html.erb | 2 +-
.../app/views/work_units/_show_child.html.erb | 5 +--
.../app/views/work_units/_show_status.html.erb | 2 +-
apps/workbench/config/routes.rb | 5 ++-
14 files changed, 62 insertions(+), 40 deletions(-)
via 48c2b107674d60121e7feecf4e884269ba273fdc (commit)
via 64136ec483765ba948a98e893768166b7362d5e2 (commit)
from b2c424b286798d187d3260316787cb29d0076a1e (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 48c2b107674d60121e7feecf4e884269ba273fdc
Author: radhika <radhika at curoverse.com>
Date: Sat Oct 22 21:47:51 2016 -0400
10079: add "parent" to work_unit to aid the child display
diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
index a7d0feb..fe6bff1 100644
--- a/apps/workbench/app/controllers/work_units_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -128,21 +128,37 @@ class WorkUnitsController < ApplicationController
def show_child_component
data = JSON.load(params[:action_data])
- current_obj = data['current_obj']
- current_obj_type = data['current_obj_type']
+ current_obj = {}
+ current_obj_uuid = data['current_obj_uuid']
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_type = data['current_obj_type']
+ current_obj_parent = data['current_obj_parent']
+ 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, current_obj_name)
- elsif current_obj_type == PipelineInstanceWorkUnit.to_s
- wu = PipelineInstanceWorkUnit.new(current_obj, current_obj_name)
- elsif current_obj_type == ContainerWorkUnit.to_s
- wu = ContainerWorkUnit.new(current_obj, current_obj_name)
+ if current_obj.is_a?(Hash) and !current_obj.any?
+ if current_obj_parent
+ resource_class = resource_class_for_uuid current_obj_parent
+ parent = object_for_dataclass(resource_class, current_obj_parent)
+ parent_wu = parent.work_unit
+ children = parent_wu.children
+ if current_obj_uuid
+ wu = children.select {|c| c.uuid == current_obj_uuid}.first
+ else current_obj_name
+ wu = children.select {|c| c.label.to_s == current_obj_name}.first
+ end
+ end
+ else
+ if current_obj_type == JobWorkUnit.to_s
+ wu = JobWorkUnit.new(current_obj, current_obj_name, current_obj_parent)
+ elsif current_obj_type == PipelineInstanceWorkUnit.to_s
+ wu = PipelineInstanceWorkUnit.new(current_obj, current_obj_name, current_obj_parent)
+ elsif current_obj_type == ContainerWorkUnit.to_s
+ wu = ContainerWorkUnit.new(current_obj, current_obj_name, current_obj_parent)
+ end
end
respond_to do |f|
diff --git a/apps/workbench/app/models/container.rb b/apps/workbench/app/models/container.rb
index 0a7c288..e683a6e 100644
--- a/apps/workbench/app/models/container.rb
+++ b/apps/workbench/app/models/container.rb
@@ -4,6 +4,6 @@ class Container < ArvadosBase
end
def work_unit(label=nil)
- ContainerWorkUnit.new(self, label)
+ ContainerWorkUnit.new(self, label, self.uuid)
end
end
diff --git a/apps/workbench/app/models/container_request.rb b/apps/workbench/app/models/container_request.rb
index 0148de5..aae712b 100644
--- a/apps/workbench/app/models/container_request.rb
+++ b/apps/workbench/app/models/container_request.rb
@@ -12,6 +12,6 @@ class ContainerRequest < ArvadosBase
end
def work_unit(label=nil)
- ContainerWorkUnit.new(self, label)
+ ContainerWorkUnit.new(self, label, self.uuid)
end
end
diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index b6e72dc..88aab30 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -1,7 +1,7 @@
class ContainerWorkUnit < ProxyWorkUnit
attr_accessor :container
- def initialize proxied, label
+ def initialize proxied, label, parent
super
if @proxied.is_a?(ContainerRequest)
container_uuid = get(:container_uuid)
@@ -12,7 +12,7 @@ class ContainerWorkUnit < ProxyWorkUnit
end
def children
- return self.my_children if self.my_children
+ return @my_children if @my_children
container_uuid = nil
container_uuid = if @proxied.is_a?(Container) then uuid else get(:container_uuid) end
@@ -25,7 +25,7 @@ class ContainerWorkUnit < ProxyWorkUnit
end
end
- self.my_children = items
+ @my_children = items
end
def title
diff --git a/apps/workbench/app/models/job.rb b/apps/workbench/app/models/job.rb
index bf202c4..7bfed6d 100644
--- a/apps/workbench/app/models/job.rb
+++ b/apps/workbench/app/models/job.rb
@@ -54,6 +54,6 @@ class Job < ArvadosBase
end
def work_unit(label=nil)
- JobWorkUnit.new(self, label)
+ JobWorkUnit.new(self, label, self.uuid)
end
end
diff --git a/apps/workbench/app/models/job_task.rb b/apps/workbench/app/models/job_task.rb
index 9fb0473..654e0a3 100644
--- a/apps/workbench/app/models/job_task.rb
+++ b/apps/workbench/app/models/job_task.rb
@@ -1,5 +1,5 @@
class JobTask < ArvadosBase
def work_unit(label=nil)
- JobTaskWorkUnit.new(self, label)
+ JobTaskWorkUnit.new(self, label, self.uuid)
end
end
diff --git a/apps/workbench/app/models/pipeline_instance.rb b/apps/workbench/app/models/pipeline_instance.rb
index 62bbc54..e9fa04a 100644
--- a/apps/workbench/app/models/pipeline_instance.rb
+++ b/apps/workbench/app/models/pipeline_instance.rb
@@ -133,7 +133,7 @@ class PipelineInstance < ArvadosBase
end
def work_unit(label=nil)
- PipelineInstanceWorkUnit.new(self, label || self.name)
+ PipelineInstanceWorkUnit.new(self, label || self.name, self.uuid)
end
private
diff --git a/apps/workbench/app/models/pipeline_instance_work_unit.rb b/apps/workbench/app/models/pipeline_instance_work_unit.rb
index dd5685a..293a77c 100644
--- a/apps/workbench/app/models/pipeline_instance_work_unit.rb
+++ b/apps/workbench/app/models/pipeline_instance_work_unit.rb
@@ -18,10 +18,10 @@ class PipelineInstanceWorkUnit < ProxyWorkUnit
if job[:uuid] and jobs[job[:uuid]]
items << jobs[job[:uuid]].work_unit(name)
else
- items << JobWorkUnit.new(job, name)
+ items << JobWorkUnit.new(job, name, uuid)
end
else
- items << JobWorkUnit.new(c, name)
+ items << JobWorkUnit.new(c, name, uuid)
end
else
@unreadable_children = true
diff --git a/apps/workbench/app/models/proxy_work_unit.rb b/apps/workbench/app/models/proxy_work_unit.rb
index b5349ec..48bc3a0 100644
--- a/apps/workbench/app/models/proxy_work_unit.rb
+++ b/apps/workbench/app/models/proxy_work_unit.rb
@@ -6,23 +6,24 @@ class ProxyWorkUnit < WorkUnit
attr_accessor :my_children
attr_accessor :unreadable_children
- def initialize proxied, label
+ def initialize proxied, label, parent
@lbl = label
@proxied = proxied
+ @parent = parent
end
def label
@lbl
end
- def proxied
- @proxied
- end
-
def uuid
get(:uuid)
end
+ def parent
+ @parent
+ end
+
def modified_by_user_uuid
get(:modified_by_user_uuid)
end
diff --git a/apps/workbench/app/models/work_unit.rb b/apps/workbench/app/models/work_unit.rb
index 727180e..dd4a706 100644
--- a/apps/workbench/app/models/work_unit.rb
+++ b/apps/workbench/app/models/work_unit.rb
@@ -5,14 +5,14 @@ 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
+ def parent
+ # returns the parent uuid of this work unit
+ end
+
def children
# returns an array of child work units
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 277aa37..8bb33b5 100644
--- a/apps/workbench/app/views/work_units/_show_child.html.erb
+++ b/apps/workbench/app/views/work_units/_show_child.html.erb
@@ -51,7 +51,7 @@
</div>
<% 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 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_uuid: current_obj.uuid, current_obj_name: current_obj.label, current_obj_parent: current_obj.parent}.to_json%>">
<div class="panel-body work-unit-component-detail-body">
</div>
</div>
commit 64136ec483765ba948a98e893768166b7362d5e2
Author: radhika <radhika at curoverse.com>
Date: Fri Oct 21 17:19:53 2016 -0400
10079: fixed route so that @object is available
diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
index 804d7ce..a7d0feb 100644
--- a/apps/workbench/app/controllers/work_units_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -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|
diff --git a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
index b79759f..560b3a5 100644
--- a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
@@ -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 %>"
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 5bd1b46..277aa37 100644
--- a/apps/workbench/app/views/work_units/_show_child.html.erb
+++ b/apps/workbench/app/views/work_units/_show_child.html.erb
@@ -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>
diff --git a/apps/workbench/app/views/work_units/_show_status.html.erb b/apps/workbench/app/views/work_units/_show_status.html.erb
index 4b629c8..f2052ef 100644
--- a/apps/workbench/app/views/work_units/_show_status.html.erb
+++ b/apps/workbench/app/views/work_units/_show_status.html.erb
@@ -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)})
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 9bcebbd..7c2312c 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -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
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list