Add pipeline_instances/compare page
authorTom Clegg <tom@curoverse.com>
Tue, 28 Jan 2014 15:57:47 +0000 (07:57 -0800)
committerTom Clegg <tom@curoverse.com>
Sat, 1 Feb 2014 23:29:49 +0000 (15:29 -0800)
apps/workbench/app/controllers/pipeline_instances_controller.rb
apps/workbench/app/views/pipeline_instances/compare.html.erb [new file with mode: 0644]
apps/workbench/config/routes.rb

index afb9949f4bf2686bb97d98dd4a2a2810831a5bab..f3932bf7694f3ead228f8c7ce18bbcc7ae9f7fff 100644 (file)
@@ -1,2 +1,12 @@
 class PipelineInstancesController < ApplicationController
+  skip_before_filter :find_object_by_uuid, only: :compare
+  before_filter :find_objects_by_uuid, only: :compare
+
+  def compare
+  end
+
+  protected
+  def find_objects_by_uuid
+    @objects = model_class.where(uuid: params[:uuid])
+  end
 end
diff --git a/apps/workbench/app/views/pipeline_instances/compare.html.erb b/apps/workbench/app/views/pipeline_instances/compare.html.erb
new file mode 100644 (file)
index 0000000..f75f32a
--- /dev/null
@@ -0,0 +1,44 @@
+<table class="table table-condensed table-hover topalign">
+  <thead>
+  </thead>
+  <tbody>
+    <tr>
+      <% @objects.each do |object| %>
+      <td>
+
+        <table class="table table-condensed table-hover topalign">
+          <thead>
+          </thead>
+          <tbody>
+            <% object.attributes_for_display.each do |attr, attrvalue| %>
+            <% if attr == 'components' and attrvalue.is_a? Hash %>
+
+            <tr class="info"><td><%= attr %></td><td>
+                <table class="table">
+                  <% pipeline_jobs.each do |pj| %>
+                  <tr><% %w(index name result job_link script script_version progress_detail progress_bar output_link).each do |key| %>
+                    <td>
+                      <% if key == 'script_version' %>
+                      <%= pj[key.to_sym][0..6] rescue '' %>
+                      <% else %>
+                      <%= pj[key.to_sym] %>
+                      <% end %>
+                    </td>
+                    <% end %>
+                  </tr>
+                  <% end %>
+                </table>
+            </td></tr>
+
+            <% else %>
+            <%= render partial: 'application/arvados_object_attr', locals: { attr: attr, attrvalue: attrvalue } %>
+            <% end %>
+            <% end %>
+          </tbody>
+        </table>
+
+      </td>
+      <% end %>
+    </tr>
+  </tbody>
+</table>
index f2480c6541a758ae4190de78d415aecef0df38a4..a035535da5bc56e60a3d1733cd8e14a63e302b59 100644 (file)
@@ -26,7 +26,9 @@ ArvadosWorkbench::Application.routes.draw do
   resources :groups
   resources :specimens
   resources :pipeline_templates
-  resources :pipeline_instances
+  resources :pipeline_instances do
+    get 'compare/*uuid' => 'pipeline_instances#compare'
+  end
   resources :links
   match '/collections/graph' => 'collections#graph'
   resources :collections