[ARVADOS] updated: 40cad1b6c6b969c78fb415ee7be59dac32c45891
Git user
git at public.curoverse.com
Tue Oct 25 18:29:59 EDT 2016
Summary of changes:
.../app/assets/javascripts/work_unit_component.js | 18 ++++++++
.../app/controllers/work_units_controller.rb | 54 ++++++++++++++++++++++
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 | 9 +++-
apps/workbench/app/models/work_unit.rb | 4 ++
.../pipeline_instances/_show_components.html.erb | 2 +-
.../views/work_units/_component_detail.html.erb | 28 +++++++++--
.../app/views/work_units/_show_child.html.erb | 29 +++---------
.../app/views/work_units/_show_component.html.erb | 47 +------------------
.../app/views/work_units/_show_status.html.erb | 2 +-
apps/workbench/config/routes.rb | 4 +-
.../test/controllers/work_units_controller_test.rb | 23 ---------
apps/workbench/test/integration/jobs_test.rb | 2 +-
apps/workbench/test/integration/work_units_test.rb | 25 ++++++++++
20 files changed, 155 insertions(+), 112 deletions(-)
create mode 100644 apps/workbench/app/assets/javascripts/work_unit_component.js
via 40cad1b6c6b969c78fb415ee7be59dac32c45891 (commit)
via 85292497b7a89b9a0681fc38d307eea26681924c (commit)
via 8d6ffdf2fba938e7fbb5f128664d828d2669bcfe (commit)
via c95fd352d669bc65c0dbc9970ca11291cc933577 (commit)
via f830fb6b5a8113aabe6a377cadbb50dc52d5d1e0 (commit)
via 4304baee8e6cc9483a0cae397149526a0e8356fb (commit)
via 28e0fb829175415c533ea783d90ade8a39bdb236 (commit)
via 9ac31a42d4c777c158b2b9a7623194217d7a0772 (commit)
from 182dd3521c1ea587a94ed2bfa4e1a3e935d493c7 (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 40cad1b6c6b969c78fb415ee7be59dac32c45891
Merge: 182dd35 8529249
Author: radhika <radhika at curoverse.com>
Date: Tue Oct 25 18:25:58 2016 -0400
closes #10079
Merge branch '10079-pipeline-display-perf'
commit 85292497b7a89b9a0681fc38d307eea26681924c
Author: radhika <radhika at curoverse.com>
Date: Tue Oct 25 12:35:55 2016 -0400
10079: show spinner when a child component details are being displayed using ajax.
diff --git a/apps/workbench/app/assets/javascripts/work_unit_component.js b/apps/workbench/app/assets/javascripts/work_unit_component.js
index 6c8374b..baff0e8 100644
--- a/apps/workbench/app/assets/javascripts/work_unit_component.js
+++ b/apps/workbench/app/assets/javascripts/work_unit_component.js
@@ -6,6 +6,7 @@ $(document).
}
var content_div = href.find('.work-unit-component-detail-body');
+ content_div.html('<div class="spinner spinner-32px col-sm-1"></div>');
var content_url = href.attr('content-url');
var action_data = href.attr('action-data');
$.ajax(content_url, {dataType: 'html', type: 'POST', data: {action_data: action_data}}).
diff --git a/apps/workbench/app/views/work_units/_component_detail.html.erb b/apps/workbench/app/views/work_units/_component_detail.html.erb
index 1ec5c32..bb5b913 100644
--- a/apps/workbench/app/views/work_units/_component_detail.html.erb
+++ b/apps/workbench/app/views/work_units/_component_detail.html.erb
@@ -1,8 +1,6 @@
<%
- collections = current_obj.outputs.flatten.uniq
- collections << current_obj.docker_image
- collections = collections.compact.uniq
- collections_pdhs = collections.select {|x| !(m = CollectionsHelper.match(x)).nil?}.uniq.compact
+ collections = [current_obj.outputs, current_obj.docker_image].flatten.compact.uniq
+ collections_pdhs = collections.select {|x| !CollectionsHelper.match(x).nil?}.uniq.compact
collections_uuids = collections - collections_pdhs
preload_collections_for_objects collections_uuids if collections_uuids.any?
preload_for_pdhs collections_pdhs if collections_pdhs.any?
@@ -21,10 +19,16 @@
<% keys << :log_collection if @object.uuid != current_obj.uuid %>
<% keys << :outputs %>
<% keys.each do |k| %>
- <% val = current_obj.send(k) if current_obj.respond_to?(k) %>
- <% has_val = val %>
- <% has_val = val.andand.any? if k == :outputs %>
- <% has_val = true if k == :log_collection and current_obj.state_label == "Running" %>
+ <%
+ val = current_obj.send(k) if current_obj.respond_to?(k)
+ if k == :outputs
+ has_val = val.andand.any?
+ elsif k == :log_collection and current_obj.state_label == "Running"
+ has_val = true
+ else
+ has_val = val
+ end
+ %>
<% if has_val %>
<tr>
<td style="padding-right: 1em">
commit 8d6ffdf2fba938e7fbb5f128664d828d2669bcfe
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 c95fd352d669bc65c0dbc9970ca11291cc933577
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
commit f830fb6b5a8113aabe6a377cadbb50dc52d5d1e0
Author: radhika <radhika at curoverse.com>
Date: Wed Oct 19 17:17:56 2016 -0400
10079: checking log_link on children needs to be an integration test.
diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
index e375689..804d7ce 100644
--- a/apps/workbench/app/controllers/work_units_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -135,7 +135,10 @@ class WorkUnitsController < ApplicationController
wu = ContainerWorkUnit.new(current_obj, params['name'])
end
- @object ||= arvados_api_client.unpack_api_response data['main_obj'], data['main_obj_kind']
+ if !@object
+ resource_class = resource_class_for_uuid data['main_obj']
+ @object = object_for_dataclass(resource_class, data['main_obj'])
+ end
respond_to do |f|
f.html { render(partial: "show_component", locals: {wu: wu}) }
diff --git a/apps/workbench/app/views/work_units/_component_detail.html.erb b/apps/workbench/app/views/work_units/_component_detail.html.erb
index 0085611..1ec5c32 100644
--- a/apps/workbench/app/views/work_units/_component_detail.html.erb
+++ b/apps/workbench/app/views/work_units/_component_detail.html.erb
@@ -24,6 +24,7 @@
<% val = current_obj.send(k) if current_obj.respond_to?(k) %>
<% has_val = val %>
<% has_val = val.andand.any? if k == :outputs %>
+ <% has_val = true if k == :log_collection and current_obj.state_label == "Running" %>
<% if has_val %>
<tr>
<td style="padding-right: 1em">
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 3451923..5bd1b46 100644
--- a/apps/workbench/app/views/work_units/_show_child.html.erb
+++ b/apps/workbench/app/views/work_units/_show_child.html.erb
@@ -51,9 +51,8 @@
</div>
<% name = if current_obj.respond_to?('name') then current_obj.name else '' end %>
- <% kind = if !@object.is_a?(Hash) then ('arvados#' + @object.class.to_s.camelcase(:lower)) 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, main_obj_kind: kind}.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: current_obj.proxied, main_obj: @object.uuid}.to_json%>">
<div class="panel-body work-unit-component-detail-body">
</div>
</div>
diff --git a/apps/workbench/test/controllers/work_units_controller_test.rb b/apps/workbench/test/controllers/work_units_controller_test.rb
index ee18861..12e0271 100644
--- a/apps/workbench/test/controllers/work_units_controller_test.rb
+++ b/apps/workbench/test/controllers/work_units_controller_test.rb
@@ -65,27 +65,4 @@ class WorkUnitsControllerTest < ActionController::TestCase
}]
get :index, encoded_params, session_for(:active)
end
-
- [
- [Job, 'active', 'running_job_with_components', '/jobs/zzzzz-8i9sb-jyq01m7in1jlofj#Log'],
- [PipelineInstance, 'active', 'pipeline_in_running_state', '/jobs/zzzzz-8i9sb-pshmckwoma9plh7#Log'],
- [PipelineInstance, nil, 'pipeline_in_publicly_accessible_project_but_other_objects_elsewhere', 'Log unavailable'],
- ].each do |type, token, fixture, log_link|
- test "link_to_log for #{fixture} for #{token}" do
- use_token 'admin'
- obj = find_fixture(type, fixture)
-
- @controller = if type == Job then JobsController.new else PipelineInstancesController.new end
-
- if token
- get :show, {id: obj['uuid']}, session_for(token)
- else
- Rails.configuration.anonymous_user_token =
- api_fixture("api_client_authorizations", "anonymous", "api_token")
- get :show, {id: obj['uuid']}
- end
-
- assert_includes @response.body, log_link
- end
- end
end
diff --git a/apps/workbench/test/integration/work_units_test.rb b/apps/workbench/test/integration/work_units_test.rb
index b1d5a21..f04616d 100644
--- a/apps/workbench/test/integration/work_units_test.rb
+++ b/apps/workbench/test/integration/work_units_test.rb
@@ -207,4 +207,29 @@ class WorkUnitsTest < ActionDispatch::IntegrationTest
assert_text(expect_log_text)
end
end
+
+ [
+ ['jobs', 'active', 'running_job_with_components', 'component1', '/jobs/zzzzz-8i9sb-jyq01m7in1jlofj#Log'],
+ ['pipeline_instances', 'active', 'pipeline_in_running_state', 'foo', '/jobs/zzzzz-8i9sb-pshmckwoma9plh7#Log'],
+ ['pipeline_instances', nil, 'pipeline_in_publicly_accessible_project_but_other_objects_elsewhere', 'foo', 'Log unavailable'],
+ ].each do |type, token, fixture, child, log_link|
+ test "link_to_log for #{fixture} for #{token}" do
+ obj = api_fixture(type)[fixture]
+ if token
+ visit page_with_token token, "/#{type}/#{obj['uuid']}"
+ else
+ Rails.configuration.anonymous_user_token =
+ api_fixture("api_client_authorizations", "anonymous", "api_token")
+ visit "/#{type}/#{obj['uuid']}"
+ end
+
+ click_link(child)
+
+ if token
+ assert_selector "a[href=\"#{log_link}\"]"
+ else
+ assert_text log_link
+ end
+ end
+ end
end
commit 4304baee8e6cc9483a0cae397149526a0e8356fb
Author: radhika <radhika at curoverse.com>
Date: Wed Oct 19 16:19:23 2016 -0400
10079: show_child_component method needs anonymous access
diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
index c0845ee..e375689 100644
--- a/apps/workbench/app/controllers/work_units_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -1,4 +1,9 @@
class WorkUnitsController < ApplicationController
+ skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ Rails.configuration.anonymous_user_token and
+ 'show_child_component' == ctrl.action_name
+ }
+
def find_objects_for_index
# If it's not the index rows partial display, just return
# The /index request will again be invoked to display the
commit 28e0fb829175415c533ea783d90ade8a39bdb236
Author: radhika <radhika at curoverse.com>
Date: Tue Oct 18 00:24:13 2016 -0400
10079: ajax to display child component details; not working yet.
diff --git a/apps/workbench/app/assets/javascripts/work_unit_component.js b/apps/workbench/app/assets/javascripts/work_unit_component.js
new file mode 100644
index 0000000..6c8374b
--- /dev/null
+++ b/apps/workbench/app/assets/javascripts/work_unit_component.js
@@ -0,0 +1,17 @@
+$(document).
+ on('click', '.component-detail-panel', function(event) {
+ var href = $($(event.target).attr('href'));
+ if ($(href).attr("class").split(' ').indexOf("in") == -1) {
+ return; // collapsed; nothing more to do
+ }
+
+ var content_div = href.find('.work-unit-component-detail-body');
+ var content_url = href.attr('content-url');
+ var action_data = href.attr('action-data');
+ $.ajax(content_url, {dataType: 'html', type: 'POST', data: {action_data: action_data}}).
+ done(function(data, status, jqxhr) {
+ content_div.html(data);
+ }).fail(function(jqxhr, status, error) {
+ content_div.html(error);
+ });
+ });
diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
index 6ed25dd..c0845ee 100644
--- a/apps/workbench/app/controllers/work_units_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -111,4 +111,29 @@ class WorkUnitsController < ApplicationController
render_error status: 422
end
end
+
+ def show_child_component
+ data = JSON.load(params[:action_data])
+
+ current_obj = data['current_obj']
+ current_obj_type = data['current_obj_type']
+ 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'])
+ elsif current_obj_type == PipelineInstanceWorkUnit.to_s
+ wu = PipelineInstanceWorkUnit.new(current_obj, params['name'])
+ elsif current_obj_type == ContainerWorkUnit.to_s
+ 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
+ end
end
diff --git a/apps/workbench/app/models/proxy_work_unit.rb b/apps/workbench/app/models/proxy_work_unit.rb
index 44905be..b5349ec 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
@@ -322,7 +326,7 @@ class ProxyWorkUnit < WorkUnit
if obj.respond_to? key
obj.send(key)
elsif obj.is_a?(Hash)
- obj[key]
+ obj[key] || obj[key.to_s]
end
end
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 0e918be..3451923 100644
--- a/apps/workbench/app/views/work_units/_show_child.html.erb
+++ b/apps/workbench/app/views/work_units/_show_child.html.erb
@@ -3,7 +3,7 @@
<div class="row">
<div class="col-md-3" style="word-break:break-all;">
<h4 class="panel-title">
- <a data-toggle="collapse" href="#collapse<%= i %>">
+ <a class="component-detail-panel" data-toggle="collapse" href="#collapse<%= i %>">
<%= current_obj.label %> <span class="caret"></span>
</a>
</h4>
@@ -50,9 +50,11 @@
</div>
</div>
- <div id="collapse<%= i %>" class="panel-collapse collapse <%= if expanded then 'in' end %>">
- <div class="panel-body">
- <%= render partial: 'work_units/show_component', locals: {wu: current_obj} %>
+ <% name = if current_obj.respond_to?('name') then current_obj.name else '' end %>
+ <% kind = if !@object.is_a?(Hash) then ('arvados#' + @object.class.to_s.camelcase(:lower)) 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, main_obj_kind: kind}.to_json%>">
+ <div class="panel-body work-unit-component-detail-body">
</div>
</div>
</div>
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 4c0f660..8f0c2d7 100644
--- a/apps/workbench/app/views/work_units/_show_component.html.erb
+++ b/apps/workbench/app/views/work_units/_show_component.html.erb
@@ -41,9 +41,7 @@
<%= render(partial: "pipeline_instances/show_components_json",
locals: {error_name: "Unreadable components", backtrace: nil, wu: wu}) %>
<% else %>
- <% @descendent_count = 0 if !@descendent_count %>
<% wu.children.each do |c| %>
- <% @descendent_count += 1 %>
- <%= render(partial: 'work_units/show_child', locals: {current_obj: c, i: @descendent_count, expanded: false}) %>
+ <%= render(partial: 'work_units/show_child', locals: {current_obj: c, i: (c.uuid || rand(2**128).to_s(36)), expanded: false}) %>
<% end %>
<% end %>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 7f78548..9bcebbd 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -16,6 +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
+ post "show_child_component" => 'work_units#show_child_component'
resources :nodes
resources :humans
resources :traits
diff --git a/apps/workbench/test/integration/jobs_test.rb b/apps/workbench/test/integration/jobs_test.rb
index e39d6f4..7708ffd 100644
--- a/apps/workbench/test/integration/jobs_test.rb
+++ b/apps/workbench/test/integration/jobs_test.rb
@@ -154,7 +154,7 @@ class JobsTest < ActionDispatch::IntegrationTest
if readable
click_link('component1')
- within('#collapse1') do
+ within('.panel-collapse') do
assert(has_text? component1['uuid'])
assert(has_text? component1['script_version'])
assert(has_text? 'script_parameters')
commit 9ac31a42d4c777c158b2b9a7623194217d7a0772
Author: radhika <radhika at curoverse.com>
Date: Thu Oct 13 17:21:04 2016 -0400
10079: Move Log and Output links into child details. This will make it possible
to not need tt preload the jobs and outputs during the pipeline display. Instead,
they can be fetched when the child panel is expanded by the user.
diff --git a/apps/workbench/app/views/work_units/_component_detail.html.erb b/apps/workbench/app/views/work_units/_component_detail.html.erb
index 7d588ba..0085611 100644
--- a/apps/workbench/app/views/work_units/_component_detail.html.erb
+++ b/apps/workbench/app/views/work_units/_component_detail.html.erb
@@ -1,3 +1,15 @@
+<%
+ collections = current_obj.outputs.flatten.uniq
+ collections << current_obj.docker_image
+ collections = collections.compact.uniq
+ collections_pdhs = collections.select {|x| !(m = CollectionsHelper.match(x)).nil?}.uniq.compact
+ collections_uuids = collections - collections_pdhs
+ preload_collections_for_objects collections_uuids if collections_uuids.any?
+ preload_for_pdhs collections_pdhs if collections_pdhs.any?
+
+ preload_objects_for_dataclass(Repository, [current_obj.repository], :name) if current_obj.repository
+%>
+
<div class="container">
<div class="row">
<div class="col-md-5">
@@ -6,7 +18,8 @@
<% else %>
<table>
<% keys = [:uuid, :modified_by_user_uuid, :created_at, :started_at, :finished_at, :container_uuid, :priority] %>
- <% keys << :outputs if @object.uuid == current_obj.uuid %>
+ <% keys << :log_collection if @object.uuid != current_obj.uuid %>
+ <% keys << :outputs %>
<% keys.each do |k| %>
<% val = current_obj.send(k) if current_obj.respond_to?(k) %>
<% has_val = val %>
@@ -29,6 +42,8 @@
<% else %>
<%= render partial: 'work_units/show_outputs', locals: {id: current_obj.uuid, outputs: val, align:""} %>
<% end %>
+ <% elsif k == :log_collection %>
+ <%= render partial: 'work_units/show_log_link', locals: {wu: current_obj} %>
<% else %>
<%= val %>
<% 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 2693334..0e918be 100644
--- a/apps/workbench/app/views/work_units/_show_child.html.erb
+++ b/apps/workbench/app/views/work_units/_show_child.html.erb
@@ -1,7 +1,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
- <div class="col-md-2" style="word-break:break-all;">
+ <div class="col-md-3" style="word-break:break-all;">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse<%= i %>">
<%= current_obj.label %> <span class="caret"></span>
@@ -14,12 +14,8 @@
</div>
<% if not current_obj %>
- <div class="col-md-8"></div>
+ <div class="col-md-7"></div>
<% else %>
- <div class="col-md-1">
- <%= render partial: 'work_units/show_log_link', locals: {wu: current_obj} %>
- </div>
-
<% walltime = current_obj.walltime %>
<% cputime = current_obj.cputime %>
<div class="col-md-3">
@@ -40,19 +36,6 @@
<%= current_obj.child_summary_str %>
</span>
</div>
- <% elsif current_obj.is_finished? %>
- <div class="col-md-3 text-overflow-ellipsis">
- <% outputs = current_obj.outputs %>
- <% if outputs.any? %>
- <% if outputs.size == 1 %>
- <%= link_to_arvados_object_if_readable(outputs[0], 'Output data not available', link_text: "Output of #{current_obj.label}") %>
- <% else %>
- <%= render partial: 'work_units/show_outputs', locals: {id: current_obj.uuid, outputs: outputs, align:"pull-right"} %>
- <% end %>
- <% else %>
- No output.
- <% end %>
- </div>
<% end %>
<div class="col-md-1 pipeline-instance-spacing">
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 4feb292..4c0f660 100644
--- a/apps/workbench/app/views/work_units/_show_component.html.erb
+++ b/apps/workbench/app/views/work_units/_show_component.html.erb
@@ -37,49 +37,6 @@
</p>
<%# 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)
-
- start = 0; inc = 200
- while start < uuids.length
- preload_objects_for_dataclass resource_class, uuids[start, inc]
- start += inc
- end
- end
-
- 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
- collections.concat wu.children.collect {|j| j.log_collection}.uniq.compact
- collections_pdhs = collections.select {|x| !(m = CollectionsHelper.match(x)).nil?}.uniq.compact
- collections_uuids = collections - collections_pdhs
-
- if collections_uuids.any?
- start = 0; inc = 200
- while start < collections_uuids.length
- preload_collections_for_objects collections_uuids[start, inc]
- start += inc
- end
- end
-
- if collections_pdhs.any?
- start = 0; inc = 200
- while start < collections_pdhs.length
- preload_for_pdhs collections_pdhs[start, inc]
- start += inc
- end
- end
-
- repos = wu.children.collect {|c| c.repository}.uniq.compact
- preload_objects_for_dataclass(Repository, repos, :name) if repos.any?
-%>
-
<% if wu.has_unreadable_children %>
<%= render(partial: "pipeline_instances/show_components_json",
locals: {error_name: "Unreadable components", backtrace: nil, wu: wu}) %>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list