fix up collections index/show
authorTom Clegg <tom@clinicalfuture.com>
Tue, 9 Jul 2013 22:32:57 +0000 (18:32 -0400)
committerTom Clegg <tom@clinicalfuture.com>
Tue, 9 Jul 2013 22:32:57 +0000 (18:32 -0400)
apps/workbench/app/controllers/collections_controller.rb
apps/workbench/app/views/collections/graph.html.erb
apps/workbench/app/views/collections/show.html.erb

index 5c5e16b6da1c94e30ef89483c346737c9b3061b4..bad1378622a56f7b25b5a1e1d368d24027201b04 100644 (file)
@@ -6,9 +6,9 @@ class CollectionsController < ApplicationController
   end
 
   def index
-    @links = Link.eager.limit(100).where(head_kind: 'arvados#collection') |
-      Link.eager.limit(100).where(tail_kind: 'arvados#collection')
     @collections = Collection.limit(100).to_hash
+    @links = Link.eager.limit(100).where(head_kind: 'arvados#collection', link_class: 'resources', name: 'wants') |
+      Link.eager.limit(100).where(tail_kind: 'arvados#collection', link_class: 'data_origin')
     @collections.merge!(Collection.
                         limit(100).
                         where(uuid: @links.select{|x|x.head_kind=='arvados#collection'}.collect(&:head_uuid) |
@@ -34,10 +34,6 @@ class CollectionsController < ApplicationController
       end
       if l.tail_kind == 'arvados#collection'
         c = (@collection_info[l.tail_uuid] ||= {uuid: l.tail_uuid})
-        if l.link_class == 'group' and l.name == 'member_of'
-          c[:groups] ||= {}
-          c[:groups][l.tail_uuid] = true
-        end
         if l.link_class == 'data_origin'
           c[:origin] = l
         end
@@ -52,25 +48,9 @@ class CollectionsController < ApplicationController
     @output2colorindex = {}
     @sourcedata = {params[:uuid] => {uuid: params[:uuid]}}
     @protected = {}
-    whence = `whence #{params[:uuid]}`
-    colorindex = -1
-    whence.split("\n").each do |line|
-      if line.match /^(\#\d+@\S+)$/
-        job = Job.where(submit_id: line).first
-        @provenance << {job: job, target: line}
-      elsif (re = line.match /^ +output *= *(\S+)/)
-        if !@provenance.empty?
-          @provenance[-1][:output] = re[1]
-          @output2job[re[1]] = @provenance[-1][:job]
-          if !@output2colorindex[re[1]]
-            @output2colorindex[re[1]] = (colorindex += 1) % 10
-          end
-          @sourcedata.delete re[1]
-        end
-      elsif (re = line.match /^([0-9a-f]{32}\b)/)
-        @sourcedata[re[1]] ||= {uuid: re[1]}
-      end
-    end
+
+    # TODO: compile provenance data using Job.where(...)
+
     Link.where(head_uuid: @sourcedata.keys | @output2job.keys).each do |link|
       if link.link_class == 'resources' and link.name == 'wants'
         @protected[link.head_uuid] = true
index c6a256532bbabee0fd8ba473b2e2fe4905d3acb8..91598b72789427bd6189d254853c47bf1a8999ef 100644 (file)
@@ -1,4 +1,4 @@
-<%= render :partial => 'nav' %>
+<%#= render :partial => 'nav' %>
 <table class="table table-bordered">
   <tbody>
     <tr>
index e7c0990fd942d9a69f3e9660b93a18b589696ce5..f8f9c0c8fb7df58fdebc29cae06372e061e22e72 100644 (file)
@@ -15,7 +15,7 @@
 </style>
 <% end %>
 
-<%= render :partial => 'nav' %>
+<%#= render :partial => 'nav' %>
 
 <ul class="nav nav-tabs">
   <li class="active"><a href="#files" data-toggle="tab">Files (<%= @object.files ? @object.files.size : 0 %>)</a></li>