Add basic select-and-compare interface to pipeline_instances#index.
authorTom Clegg <tom@curoverse.com>
Sun, 2 Feb 2014 00:05:55 +0000 (16:05 -0800)
committerTom Clegg <tom@curoverse.com>
Sun, 2 Feb 2014 00:05:55 +0000 (16:05 -0800)
refs #1978

apps/workbench/app/controllers/pipeline_instances_controller.rb
apps/workbench/app/views/pipeline_instances/index.html.erb
apps/workbench/config/routes.rb

index 507131f8ebcf63c319a861532494554351887b80..d77694172bda87242ccd0a6108bcc3315c17e187 100644 (file)
@@ -71,7 +71,7 @@ class PipelineInstancesController < ApplicationController
   end
 
   def find_objects_by_uuid
-    @objects = model_class.where(uuid: params[:uuid].split('/'))
+    @objects = model_class.where(uuid: params[:uuids])
   end
 
 end
index f5b672d9166951b59a4be0abeea6c16e1f5d1d82..2789ca113badb96d2b33d1d84369be4420c28f4e 100644 (file)
@@ -1,7 +1,11 @@
+<%= form_tag({action: 'compare', controller: 'pipeline_instances', method: 'get'}, {method: 'get', id: 'compare'}) do |f| %>
+
 <table class="table table-hover">
   <thead>
     <tr class="contain-align-left">
       <th>
+       <%= submit_tag 'Compare', {class: 'btn btn-primary', disabled: true} %>
+      </th><th>
        status
       </th><th>
        id
   </thead>
   <tbody>
 
-    <% @objects.sort_by { |ob| ob[:created_at] }.reverse.each do |ob| %>
+    <% @objects.sort_by { |ob| ob.created_at }.reverse.each do |ob| %>
 
     <tr>
       <td>
+        <%= check_box_tag 'uuids[]', ob.uuid, false %>
+      </td><td>
         <% if ob.success %>
         <span class="label label-success">success</span>
         <% elsif ob.active %>
 
   </tbody>
 </table>
+
+<% end %>
+
+<% content_for :footer_js do %>
+$('form#compare input[name="uuids[]"]').on('click', function() {
+    var form = $('form#compare')[0]
+    $('input[type=submit]', form).prop('disabled',true);
+    $('input[name="uuids[]"]', form).each(function(){
+        if(this.checked) {
+            $('input[type=submit]', form).prop('disabled',false);
+        }
+    });
+});
+<% end %>
index c9bf19b59c73c1341580708c0404e7f41a3ef561..5330a9148a2f8574c0d410e8ff83acb67eaa4911 100644 (file)
@@ -26,8 +26,9 @@ ArvadosWorkbench::Application.routes.draw do
   resources :groups
   resources :specimens
   resources :pipeline_templates
-  resources :pipeline_instances
-  get '/pipeline_instances/compare/*uuid' => 'pipeline_instances#compare'
+  resources :pipeline_instances do
+    get 'compare', on: :collection
+  end
   resources :links
   match '/collections/graph' => 'collections#graph'
   resources :collections