[ARVADOS] updated: fdc4fd98ee963559ac13e737700a8be1f5c736c7

git at public.curoverse.com git at public.curoverse.com
Thu Jul 24 11:02:11 EDT 2014


Summary of changes:
 apps/workbench/app/assets/javascripts/editable.js  | 11 ++++++-
 apps/workbench/app/assets/javascripts/tab_panes.js | 38 ++++++++++++++++++++++
 .../app/assets/stylesheets/application.css.scss    |  5 +++
 apps/workbench/app/models/arvados_api_client.rb    |  7 +++-
 4 files changed, 59 insertions(+), 2 deletions(-)

       via  fdc4fd98ee963559ac13e737700a8be1f5c736c7 (commit)
       via  7223231e30b3e0e0b488f8db6d7b1749117a05e9 (commit)
       via  315312d808d6b8144d7638b108c0a02be3c14f46 (commit)
       via  fb77c937ac1e0fe4463cfe48c3b60f8a32e8c128 (commit)
      from  fa3f6860158dda089c0b4b96c346bbc643232421 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit fdc4fd98ee963559ac13e737700a8be1f5c736c7
Merge: fa3f686 7223231
Author: Brett Smith <brett at curoverse.com>
Date:   Thu Jul 24 11:03:04 2014 -0400

    Merge branch '3200-ajax-error-handling'
    
    Closes #3200, #3207, #3251, #3276, #3322.


commit 7223231e30b3e0e0b488f8db6d7b1749117a05e9
Author: Brett Smith <brett at curoverse.com>
Date:   Wed Jul 23 16:50:18 2014 -0400

    3200: Improve error handling in Workbench's API client.
    
    * Fix the class used for error responses that can be parsed but don't
      have a dedicated subclass.
    
    * Ensure that exception.api_response[:errors] is always an array.
    
    This improves the error reporting for #3207.

diff --git a/apps/workbench/app/models/arvados_api_client.rb b/apps/workbench/app/models/arvados_api_client.rb
index 9f34a29..78d3bee 100644
--- a/apps/workbench/app/models/arvados_api_client.rb
+++ b/apps/workbench/app/models/arvados_api_client.rb
@@ -8,6 +8,10 @@ class ArvadosApiClient
     def initialize(request_url, errmsg)
       @request_url = request_url
       @api_response ||= {}
+      errors = @api_response[:errors]
+      if not errors.is_a?(Array)
+        @api_response[:errors] = [errors || errmsg]
+      end
       super(errmsg)
     end
   end
@@ -138,7 +142,8 @@ class ArvadosApiClient
     if not resp.is_a? Hash
       raise InvalidApiResponseException.new(url, msg)
     elsif msg.status_code != 200
-      error_class = ERROR_CODE_CLASSES.fetch(msg.status_code, ApiError)
+      error_class = ERROR_CODE_CLASSES.fetch(msg.status_code,
+                                             ApiErrorResponseException)
       raise error_class.new(url, msg)
     end
 

commit 315312d808d6b8144d7638b108c0a02be3c14f46
Author: Brett Smith <brett at curoverse.com>
Date:   Wed Jul 23 16:29:12 2014 -0400

    3200: X-Editable renders errors even without a message array.
    
    The previous version was causing the X-Editable popup to spin
    infinitely when the JSON errors were null.  See #3207, #3251.

diff --git a/apps/workbench/app/assets/javascripts/editable.js b/apps/workbench/app/assets/javascripts/editable.js
index ab66833..76a129b 100644
--- a/apps/workbench/app/assets/javascripts/editable.js
+++ b/apps/workbench/app/assets/javascripts/editable.js
@@ -58,7 +58,16 @@ $(document).
                     return;
                 },
                 error: function(response, newValue) {
-                    return response.responseJSON.errors.join();
+                    var errlist = response.responseJSON.errors;
+                    var errmsg;
+                    if (Array.isArray(errlist)) {
+                        errmsg = errlist.join();
+                    } else {
+                        errmsg = ("The server returned an error when making " +
+                                  "this update (status " + response.status +
+                                  ": " + errlist + ").");
+                    }
+                    return errmsg;
                 }
             }).
             on('hidden', function(e, reason) {

commit fb77c937ac1e0fe4463cfe48c3b60f8a32e8c128
Author: Brett Smith <brett at curoverse.com>
Date:   Tue Jul 22 18:04:58 2014 -0400

    3200: Workbench copes better when a tab fails to load.

diff --git a/apps/workbench/app/assets/javascripts/tab_panes.js b/apps/workbench/app/assets/javascripts/tab_panes.js
index ec4a519..0b7800c 100644
--- a/apps/workbench/app/assets/javascripts/tab_panes.js
+++ b/apps/workbench/app/assets/javascripts/tab_panes.js
@@ -12,6 +12,44 @@ $(document).on('shown.bs.tab', '[data-toggle="tab"]', function(e) {
         done(function(data, status, jqxhr) {
             $('> div > div', this).html(data);
             $(this).addClass('loaded');
+        }).fail(function(jqxhr, status, error) {
+            var errhtml;
+            if (jqxhr.getResponseHeader('Content-Type').match(/\btext\/html\b/)) {
+                var $response = $(jqxhr.responseText);
+                var $wrapper = $('div#page-wrapper', $response);
+                if ($wrapper.length) {
+                    errhtml = $wrapper.html();
+                } else {
+                    errhtml = jqxhr.responseText;
+                }
+            } else {
+                errhtml = ("An error occurred: " +
+                           (jqxhr.responseText || status)).
+                    replace(/&/g, '&').
+                    replace(/</g, '<').
+                    replace(/>/g, '>');
+            }
+            $('> div > div', this).html(
+                '<div><p>' +
+                    '<a href="#" class="btn btn-primary tab_reload">' +
+                    '<i class="fa fa-fw fa-refresh"></i> ' +
+                    'Reload tab</a></p><iframe></iframe></div>');
+            $('.tab_reload', this).click(function() {
+                $('> div > div', $pane).html(
+                    '<div class="spinner spinner-32px spinner-h-center"></div>');
+                $pane.trigger('arv:pane:reload');
+            });
+            // We want to render the error in an iframe, in order to
+            // avoid conflicts with the main page's element ids, etc.
+            // In order to do that dynamically, we have to set a
+            // timeout on the iframe window to load our HTML *after*
+            // the default source (e.g., about:blank) has loaded.
+            var iframe = $('iframe', this)[0];
+            iframe.contentWindow.setTimeout(function() {
+                $('body', iframe.contentDocument).html(errhtml);
+                iframe.height = iframe.contentDocument.body.scrollHeight + "px";
+            }, 1);
+            $(this).addClass('loaded');
         });
 });
 
diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss
index e3f4f0a..75d58ed 100644
--- a/apps/workbench/app/assets/stylesheets/application.css.scss
+++ b/apps/workbench/app/assets/stylesheets/application.css.scss
@@ -235,3 +235,8 @@ div#wrapper {
 svg text {
     font-size: 6pt;
 }
+
+div.pane-content iframe {
+  width: 100%;
+  border: none;
+}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list