Fixed bug when selection list was cleared.
authorPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 6 Mar 2014 22:10:22 +0000 (17:10 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 6 Mar 2014 22:10:22 +0000 (17:10 -0500)
Fixed rendering collections in provenance graph.

apps/workbench/app/assets/javascripts/selection.js
apps/workbench/app/controllers/actions_controller.rb
apps/workbench/app/helpers/provenance_helper.rb

index ef1c59230bf4ac8f2756d89446040da789fafba6..c94a557f8681daaa45524f666a49451595c6322a 100644 (file)
@@ -48,18 +48,14 @@ jQuery(function($){
         update_count();
     }
 
-    var combine_selected_files_into_collection = function () {
-        
-    }
-
     var update_count = function(e) {
         var lst = get_selection_list();
         $("#persistent-selection-count").text(lst.length);
-
         if (lst.length > 0) {
             $('#selection-form-content').html('<li><input type="submit" name="combine_selected_files_into_collection" id="combine_selected_files_into_collection" value="Combine selected collections and files into a new collection"/></li>'
                                                  + '<li><a href="#" id="clear_selections_button">Clear selections</a></li>'
                                                  + '<li class="notification"><table style="width: 100%"></table></li>');
+
             for (var i = 0; i < lst.length; i++) {
                 $('#selection-form-content > li > table').append("<tr>"
                                                        + "<td>"
@@ -77,7 +73,7 @@ jQuery(function($){
                                                        + "</tr>");
             }
         } else {
-            $('#persistent-selection-list').html("<li class='notification empty'>No selections.</li>");
+            $('#selection-form-content').html("<li class='notification empty'>No selections.</li>");
         }
 
         var checkboxes = $('.persistent-selection:checkbox');
@@ -95,7 +91,6 @@ jQuery(function($){
         
         $('.remove-selection').on('click', remove_selection_click);
         $('#clear_selections_button').on('click', clear_selections);
-        $('#combine_selected_files_into_collection').on('click', combine_selected_files_into_collection);
     };
 
     $(document).
index 6f5ed608e91bd4f2c523641d9f913d7b35c46f54..c443c2196e372414c1d6e3361dc8e12f294c9527 100644 (file)
@@ -71,6 +71,18 @@ class ActionsController < ApplicationController
     newc = Collection.new({:uuid => newuuid, :manifest_text => normalized})
     newc.save!
 
+    chash.each do |k,v|
+      l = Link.new({
+                     tail_kind: "arvados#Collection",
+                     tail_uuid: k,
+                     head_kind: "arvados#Collection", 
+                     head_uuid: newuuid,
+                     link_class: "provenance",
+                     name: "provided"
+                   })
+      l.save!
+    end
+
     '/collections/' + newc.uuid
   end
 
index 8278d37f3ec022525bdfc42b0f2103bdf080e078..fced9da3aa98c6c728df6e950cb788a254e30ec0 100644 (file)
@@ -11,9 +11,11 @@ module ProvenanceHelper
     def self.collection_uuid(uuid)
       m = CollectionsHelper.match(uuid)
       if m
-        #if m[2]
-        return m[1]
-        #else
+        if m[2]
+          return m[1]+m[2]
+        else
+          return m[1]
+        end
         #  Collection.where(uuid: ['contains', m[1]]).each do |u|
         #    puts "fixup #{uuid} to #{u.uuid}"
         #    return u.uuid