You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2015/10/07 15:35:19 UTC

ambari git commit: AMBARI-13338 Ambari Web should surface HTTP 413 error. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/trunk 61f6523a6 -> 15ac28364


AMBARI-13338 Ambari Web should surface HTTP 413 error. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/15ac2836
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/15ac2836
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/15ac2836

Branch: refs/heads/trunk
Commit: 15ac283641e22a5c1ce25a24020480ade79ffd0e
Parents: 61f6523
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Wed Oct 7 15:10:33 2015 +0300
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Wed Oct 7 15:10:33 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/utils/ajax/ajax.js | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/15ac2836/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 1e389aa..f10eff1 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2749,6 +2749,13 @@ var ajax = Em.Object.extend({
 
   // A single instance of App.ModalPopup view
   modalPopup: null,
+
+  /**
+   * Upon error with one of these statuses modal should be displayed
+   * @type {Array}
+   */
+  statuses: ['500', '401', '407', '413'],
+
   /**
    * defaultErrorHandler function is referred from App.ajax.send function and App.HttpClient.defaultErrorHandler function
    * @jqXHR {jqXHR Object}
@@ -2759,15 +2766,14 @@ var ajax = Em.Object.extend({
   defaultErrorHandler: function (jqXHR, url, method, showStatus) {
     method = method || 'GET';
     var self = this;
+    showStatus = (Em.isNone(showStatus)) ? this.get('statuses') : [showStatus];
     try {
       var json = $.parseJSON(jqXHR.responseText);
       var message = json.message;
     } catch (err) {
     }
-    if (!showStatus) {
-      showStatus = 500;
-    }
-    if (jqXHR.status === showStatus && !this.get('modalPopup')) {
+
+    if (showStatus.contains(jqXHR.status) && !this.get('modalPopup')) {
       this.set('modalPopup', App.ModalPopup.show({
         header: Em.I18n.t('common.error'),
         secondary: false,