2884: Added fail callback preview loading fails. Added comments explaining a
authorPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 19 Jun 2014 20:27:26 +0000 (16:27 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 19 Jun 2014 20:27:26 +0000 (16:27 -0400)
couple of things.  Removed spurious puts.

apps/workbench/app/assets/javascripts/application.js
apps/workbench/app/assets/javascripts/select_modal.js
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/controllers/collections_controller.rb
apps/workbench/app/views/collections/_choose_rows.html.erb

index 1a8b9900a21fb50417dde6498d868682cc52b7e0..1ade33f0cc9ae81ecd534ecf01d1533f0e2bf354 100644 (file)
@@ -59,11 +59,14 @@ jQuery(function($){
             }
         }).
         on('ajaxSend', function(e, xhr) {
-            // map jquery event to rails event
+            // jQuery triggers 'ajaxSend' event when starting an ajax call, but
+            // rails-generated ajax triggers generate 'ajax:send'.  Workbench
+            // event listeners currently expect 'ajax:send', so trigger the
+            // rails event in response to the jQuery one.
             $(document).trigger('ajax:send');
         }).
         on('ajaxComplete', function(e, xhr) {
-            // map jquery event to rails event
+            // See comment above about ajaxSend/ajax:send
             $(document).trigger('ajax:complete');
         }).
         on('click', '.removable-tag a', function(e) {
index a22b990e30e76aa438b50df971dd246e80c36b70..9107a010a87ea4f83b5229baa14fe396b50ac75a 100644 (file)
@@ -17,10 +17,14 @@ $(document).on('click', '.selectable', function() {
 
     if ($this.hasClass('active')) {
         $(".modal-dialog-preview-pane").html('<img src="/assets/ajax-loader.gif"></img>');
-        $.ajax($(this).attr('data-preview-href'),
-               {dataType: "html"}).done(function(data, status, jqxhr) {
-                   $(".modal-dialog-preview-pane").html(data);
-               });
+        $.ajax($this.attr('data-preview-href'),
+               {dataType: "html"}).
+           done(function(data, status, jqxhr) {
+                $(".modal-dialog-preview-pane").html(data);
+            }).
+            fail(function(data, status, jqxhr) {
+                $(".modal-dialog-preview-pane").text('Preview load failed.');
+            });
     }
 
 }).on('click', '.modal button[data-action-href]', function() {
index d7ffd9c792420396b9251d15d103014330b5a93e..9e918f533f407c434da9e031c690c271c3a3bf81 100644 (file)
@@ -148,6 +148,10 @@ class ApplicationController < ActionController::Base
     params[:limit] ||= 40
     if !@objects
       if params[:project_uuid] and !params[:project_uuid].empty?
+        # We want the chooser to show objects of the controllers's model_class
+        # type within a specific project specified by project_uuid, so fetch the
+        # project and request the contents of the project filtered on the
+        # controllers's model_class kind.
         @objects = Group.find(params[:project_uuid]).contents({:filters => [['uuid', 'is_a', "arvados\##{ArvadosApiClient.class_kind(model_class)}"]]})
       end
       find_objects_for_index if !@objects
index 2ca5929510af2086371ae9bca8618a68e111d434..77374235df49e913a1e7f785c1367fd6d3f8cd87 100644 (file)
@@ -59,8 +59,6 @@ class CollectionsController < ApplicationController
                        url_for(offset: next_page_offset, partial: true))
     @name_links = @objects
 
-    puts "and the result is (1) ", @name_links.results
-
     @objects = Collection.
       filter([['uuid','in',@name_links.collect(&:head_uuid)]])
     super
index 170ce77b7a355f63e6841bbb73d21975f8aaedd5..5cce19a0cc0b308e61149f3880d22c775932ded4 100644 (file)
@@ -1,4 +1,3 @@
-<% puts "and the result is (2) ", @name_links.results, "objects is #{@objects}" %>
 <% @name_links.each do |name_link| %>
   <% puts "looking up #{name_link.head_uuid}" %>
   <% if (object = get_object(name_link.head_uuid)) %>