[ARVADOS] updated: a029956f9992053eab72d033d51413d2c47f2ad9
Git user
git at public.curoverse.com
Tue Oct 18 00:25:21 EDT 2016
Summary of changes:
.../app/assets/javascripts/work_unit_component.js | 16 ++++++++++++++++
apps/workbench/app/controllers/work_units_controller.rb | 7 +++++++
apps/workbench/app/views/work_units/_show_child.html.erb | 9 +++++----
.../workbench/app/views/work_units/show_component.js.erb | 13 +++++++++++++
apps/workbench/config/routes.rb | 1 +
5 files changed, 42 insertions(+), 4 deletions(-)
create mode 100644 apps/workbench/app/assets/javascripts/work_unit_component.js
create mode 100644 apps/workbench/app/views/work_units/show_component.js.erb
via a029956f9992053eab72d033d51413d2c47f2ad9 (commit)
from 1985ab4089fe89e792f0d687da081e00a21d08df (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 a029956f9992053eab72d033d51413d2c47f2ad9
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..3a3dead
--- /dev/null
+++ b/apps/workbench/app/assets/javascripts/work_unit_component.js
@@ -0,0 +1,16 @@
+$(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');
+ $.ajax(content_url, {dataType: 'html'}).
+ 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..73a5a6b 100644
--- a/apps/workbench/app/controllers/work_units_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -111,4 +111,11 @@ class WorkUnitsController < ApplicationController
render_error status: 422
end
end
+
+ def show_component
+ @object ||= object_for_dataclass resource_class_for_uuid(params['main_obj']), params['main_obj']
+ respond_to do |f|
+ f.js { render }
+ end
+ end
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..823b5cf 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,10 @@
</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 %>
+ <% 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%>">
+ <div class="panel-body work-unit-component-detail-body">
</div>
</div>
</div>
diff --git a/apps/workbench/app/views/work_units/show_component.js.erb b/apps/workbench/app/views/work_units/show_component.js.erb
new file mode 100644
index 0000000..9fa2cdb
--- /dev/null
+++ b/apps/workbench/app/views/work_units/show_component.js.erb
@@ -0,0 +1,13 @@
+<%
+ 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
+%>
+
+<%= escape_javascript(render partial: 'show_component', locals: {wu: wu}) %>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 7f78548..5ac72fc 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
+ get "work_units_show_component" => 'work_units#show_component', :as => :work_units_show_component
resources :nodes
resources :humans
resources :traits
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list