[ARVADOS] created: 78b94fd03e3c0a2d225d0ab8882ee62dee9f8a11
Git user
git at public.curoverse.com
Thu Feb 9 19:07:35 EST 2017
at 78b94fd03e3c0a2d225d0ab8882ee62dee9f8a11 (commit)
commit 78b94fd03e3c0a2d225d0ab8882ee62dee9f8a11
Author: radhika <radhika at curoverse.com>
Date: Thu Feb 9 19:06:40 2017 -0500
10945: show jobs in which this job is used in job#show page.
diff --git a/apps/workbench/app/views/jobs/_show_status.html.erb b/apps/workbench/app/views/jobs/_show_status.html.erb
index bb5444f..5218883 100644
--- a/apps/workbench/app/views/jobs/_show_status.html.erb
+++ b/apps/workbench/app/views/jobs/_show_status.html.erb
@@ -4,7 +4,7 @@
<div class="panel-heading">
<span class="panel-title">Used in pipelines</span>
</div>
- <div class="panel-body">
+ <div class="panel-body used-in-pipelines">
<% pi = PipelineInstance.order("created_at desc").filter([["components", "like", "%#{@object.uuid}%"]]) %>
<% pi.each do |pipeline| %>
@@ -21,4 +21,31 @@
<% end %>
<% end %>
</div>
+
+ <% jobs = Job.order("created_at desc").filter([["components", "like", "%#{@object.uuid}%"]]).limit(10) %>
+ <% if jobs.results.size > 0
+ message = "Used in the jobs"
+ if jobs.items_available > jobs.results.size
+ message += ' (' + (jobs.items_available - jobs.results.size).to_s + ' more jobs are not listed)'
+ end
+ %>
+ <div class="panel-heading">
+ <span class="panel-title"> <%= message %> </span>
+ </div>
+
+ <div class="panel-body used-in-jobs">
+ <% jobs.each do |j| %>
+ <% j.components.each do |k, v| %>
+ <% if v == @object.uuid %>
+ <div>
+ <b><%= k %></b>
+ component of
+ <%= link_to_if_arvados_object j, friendly_name: true %>
+ created at
+ <%= render_localized_date(j.created_at) %>.
+ </div>
+ <% end %>
+ <% end %>
+ <% end %>
+ <% end %>
</div>
diff --git a/apps/workbench/test/controllers/jobs_controller_test.rb b/apps/workbench/test/controllers/jobs_controller_test.rb
index 1e26435..ae94b61 100644
--- a/apps/workbench/test/controllers/jobs_controller_test.rb
+++ b/apps/workbench/test/controllers/jobs_controller_test.rb
@@ -5,4 +5,19 @@ class JobsControllerTest < ActionController::TestCase
get :index, {}, session_for(:active)
assert_response :success
end
+
+ test "job page lists pipelines and jobs in which it is used" do
+ get(:show,
+ {id: api_fixture('jobs')['completed_job_in_publicly_accessible_project']['uuid']},
+ session_for(:active))
+ assert_response :success
+
+ assert_select "div.used-in-pipelines" do
+ assert_select "a[href=/pipeline_instances/zzzzz-d1hrv-n68vc490mloy4fi]"
+ end
+
+ assert_select "div.used-in-jobs" do
+ assert_select "a[href=/jobs/zzzzz-8i9sb-with2components]"
+ end
+ end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list