ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [31/31] ambari git commit: AMBARI-13338 Ambari Web should surface HTTP 413 error. (atkach)
Date Wed, 07 Oct 2015 13:52:12 GMT
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/branch-dev-patch-upgrade
Commit: 15ac283641e22a5c1ce25a24020480ade79ffd0e
Parents: 61f6523
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Wed Oct 7 15:10:33 2015 +0300
Committer: Andrii Tkach <atkach@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,


Mime
View raw message