ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject [3/3] ambari git commit: AMBARI-15908. Default Error Handler Popup doesn't show correct request type (onechiporenko)
Date Fri, 15 Apr 2016 11:45:06 GMT
AMBARI-15908. Default Error Handler Popup doesn't show correct request type (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 94c23298adc0410b963a25290b9eb5d7f6932a65
Parents: ebc66f7
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Fri Apr 15 12:44:23 2016 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Fri Apr 15 14:43:14 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js |  2 +-
 ambari-web/app/controllers/main/service/item.js |  2 +-
 ambari-web/app/controllers/wizard.js            |  2 +-
 ambari-web/app/mixins/common/reload_popup.js    |  2 +-
 .../common/widgets/export_metrics_mixin.js      |  2 +-
 .../host_components/install_component.js        |  2 +-
 .../mixins/wizard/assign_master_components.js   |  2 +-
 .../wizard/wizardProgressPageController.js      |  2 +-
 .../main/service/add_controller_test.js         |  2 +-
 .../test/mixins/common/reload_popup_test.js     |  5 --
 .../test/mixins/common/widget_mixin_test.js     |  8 ---
 .../common/widgets/export_metrics_mixin_test.js |  2 +-
 .../host_components/install_component_test.js   |  2 +-
 .../admin/stack_upgrade/version_view_test.js    | 13 -----
 .../wizard/step7/assign_master_view_test.js     | 58 +++++++++++---------
 15 files changed, 44 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index b2569d2..8664d8c 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -2261,7 +2261,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
       else {
         completeCallback();
         deleteError.xhr.responseText = "{\"message\": \"" + deleteError.xhr.statusText +
"\"}";
-        App.ajax.defaultErrorHandler(deleteError.xhr, deleteError.url, deleteError.method,
deleteError.xhr.status);
+        App.ajax.defaultErrorHandler(deleteError.xhr, deleteError.url, deleteError.type,
deleteError.xhr.status);
       }
     });
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 46488d9..b1ea523 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -1394,7 +1394,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
   },
 
   deleteServiceCallErrorCallback: function (jqXHR, ajaxOptions, error, opt) {
-    App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
+    App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.type, jqXHR.status);
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index c3d7f08..adce5ff 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -1233,7 +1233,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
   },
 
   loadHostsErrorCallback: function (jqXHR, ajaxOptions, error, opt) {
-    App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
+    App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.type, jqXHR.status);
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/app/mixins/common/reload_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/reload_popup.js b/ambari-web/app/mixins/common/reload_popup.js
index 1a0a7f7..c4b37d7 100644
--- a/ambari-web/app/mixins/common/reload_popup.js
+++ b/ambari-web/app/mixins/common/reload_popup.js
@@ -32,7 +32,7 @@ App.ReloadPopupMixin = Em.Mixin.create({
     if (jqXHR.status) {
       this.closeReloadPopup();
       if (params.shouldUseDefaultHandler) {
-        App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
+        App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.type, jqXHR.status);
       }
     } else {
       var times = Em.isNone(params.times) ? App.get('maxRetries') : params.times,

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/app/mixins/common/widgets/export_metrics_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/widgets/export_metrics_mixin.js b/ambari-web/app/mixins/common/widgets/export_metrics_mixin.js
index 2ecb045..7517efd 100644
--- a/ambari-web/app/mixins/common/widgets/export_metrics_mixin.js
+++ b/ambari-web/app/mixins/common/widgets/export_metrics_mixin.js
@@ -76,7 +76,7 @@ App.ExportMetricsMixin = Em.Mixin.create({
   },
 
   exportGraphDataErrorCallback: function (jqXHR, ajaxOptions, error, opt) {
-    App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
+    App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.type, jqXHR.status);
   },
 
   prepareCSV: function (data) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/app/mixins/main/host/details/host_components/install_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/host/details/host_components/install_component.js
b/ambari-web/app/mixins/main/host/details/host_components/install_component.js
index 58f0dca..4b535f3 100644
--- a/ambari-web/app/mixins/main/host/details/host_components/install_component.js
+++ b/ambari-web/app/mixins/main/host/details/host_components/install_component.js
@@ -90,7 +90,7 @@ App.InstallComponent = Em.Mixin.create({
    * @method ajaxErrorCallback
    */
   ajaxErrorCallback: function (request, ajaxOptions, error, opt, params) {
-    App.ajax.defaultErrorHandler(request, opt.url, opt.method);
+    App.ajax.defaultErrorHandler(request, opt.url, opt.type);
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/app/mixins/wizard/assign_master_components.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/assign_master_components.js b/ambari-web/app/mixins/wizard/assign_master_components.js
index b78daf9..cd8ef14 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -793,7 +793,7 @@ App.AssignMasterComponents = Em.Mixin.create({
    * @method loadRecommendationsErrorCallback
    */
   loadRecommendationsErrorCallback: function (jqXHR, ajaxOptions, error, opt) {
-    App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
+    App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.type, jqXHR.status);
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/app/mixins/wizard/wizardProgressPageController.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/wizardProgressPageController.js b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
index 7e97459..3ee8a9a 100644
--- a/ambari-web/app/mixins/wizard/wizardProgressPageController.js
+++ b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
@@ -377,7 +377,7 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create(App.InstallComponent,
{
   },
 
   onSingleRequestError: function (jqXHR, ajaxOptions, error, opt) {
-    App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
+    App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.type, jqXHR.status);
     this.set('status', 'FAILED');
     this.set('isLoaded', true);
     this.set('showRetry', true);

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/test/controllers/main/service/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js
index 5621ff4..90670a8 100644
--- a/ambari-web/test/controllers/main/service/add_controller_test.js
+++ b/ambari-web/test/controllers/main/service/add_controller_test.js
@@ -295,7 +295,7 @@ describe('App.AddServiceController', function() {
     });
 
     it('should execute default error handler', function () {
-      addServiceController.loadHostsErrorCallback({status: '500'}, 'textStatus', 'errorThrown',
{url: 'url', method: 'GET'});
+      addServiceController.loadHostsErrorCallback({status: '500'}, 'textStatus', 'errorThrown',
{url: 'url', type: 'GET'});
       expect(App.ajax.defaultErrorHandler.calledOnce).to.be.true;
       expect(App.ajax.defaultErrorHandler.calledWith({status: '500'}, 'url', 'GET', '500')).to.be.true;
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/test/mixins/common/reload_popup_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/reload_popup_test.js b/ambari-web/test/mixins/common/reload_popup_test.js
index c00abf7..6df35a2 100644
--- a/ambari-web/test/mixins/common/reload_popup_test.js
+++ b/ambari-web/test/mixins/common/reload_popup_test.js
@@ -134,7 +134,6 @@ describe('App.ReloadPopupMixin', function () {
       sinon.stub(App.ajax, 'defaultErrorHandler', Em.K);
       sinon.stub(obj, 'showReloadPopup', Em.K);
       sinon.stub(App, 'get').withArgs('maxRetries').returns(3);
-      sinon.spy(window, 'setTimeout');
     });
 
     afterEach(function () {
@@ -142,7 +141,6 @@ describe('App.ReloadPopupMixin', function () {
       App.ajax.defaultErrorHandler.restore();
       obj.showReloadPopup.restore();
       App.get.restore();
-      window.setTimeout.restore();
     });
 
     cases.forEach(function (item) {
@@ -170,9 +168,6 @@ describe('App.ReloadPopupMixin', function () {
         it('showReloadPopup is called needed number of times', function () {
           expect(obj.showReloadPopup.callCount).to.equal(item.showReloadPopupCallCount);
         });
-        it('setTimeout is called needed number of times', function () {
-          expect(window.setTimeout.callCount).to.equal(item.setTimeoutCount);
-        });
       });
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/test/mixins/common/widget_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/widget_mixin_test.js b/ambari-web/test/mixins/common/widget_mixin_test.js
index b2816b8..b56863c 100644
--- a/ambari-web/test/mixins/common/widget_mixin_test.js
+++ b/ambari-web/test/mixins/common/widget_mixin_test.js
@@ -590,25 +590,17 @@ describe('App.WidgetLoadAggregator', function () {
   var aggregator = App.WidgetLoadAggregator;
 
   describe("#add()", function () {
-    beforeEach(function () {
-      sinon.spy(window, 'setTimeout');
-    });
-    afterEach(function () {
-      window.setTimeout.restore();
-    });
     it("timeout started", function () {
       aggregator.set('timeoutId', 'timeId');
       aggregator.get('requests').clear();
       aggregator.add({});
       expect(aggregator.get('requests')).to.not.be.empty;
-      expect(window.setTimeout.called).to.be.false;
     });
     it("timeout started (2)", function () {
       aggregator.set('timeoutId', null);
       aggregator.get('requests').clear();
       aggregator.add({});
       expect(aggregator.get('requests')).to.not.be.empty;
-      expect(window.setTimeout.calledOnce).to.be.true;
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/test/mixins/common/widgets/export_metrics_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/widgets/export_metrics_mixin_test.js b/ambari-web/test/mixins/common/widgets/export_metrics_mixin_test.js
index 1cc0730..6b1dd20 100644
--- a/ambari-web/test/mixins/common/widgets/export_metrics_mixin_test.js
+++ b/ambari-web/test/mixins/common/widgets/export_metrics_mixin_test.js
@@ -243,7 +243,7 @@ describe('App.ExportMetricsMixin', function () {
           status: 404
         }, null, '', {
           url: 'url',
-          method: 'GET'
+          type: 'GET'
         });
       expect(App.ajax.defaultErrorHandler.calledOnce).to.be.true;
       expect(App.ajax.defaultErrorHandler.calledWith({

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js
b/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js
index c039107..234468e 100644
--- a/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js
+++ b/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js
@@ -108,7 +108,7 @@ describe('App.InstallComponent', function () {
     });
 
     it("App.ajax.defaultErrorHandler should be called", function() {
-      installComponent.ajaxErrorCallback({}, {}, 'error', {method: 'method1', url: 'url1'},
{});
+      installComponent.ajaxErrorCallback({}, {}, 'error', {type: 'method1', url: 'url1'},
{});
       expect(App.ajax.defaultErrorHandler.calledWith({}, 'url1', 'method1')).to.be.true;
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
index 38fe9a7..4fb7ba6 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
@@ -408,19 +408,6 @@ describe('App.mainAdminStackVersionsView', function () {
     });
   });
 
-  describe("#doPolling()", function() {
-    before(function () {
-      sinon.spy(window, 'setTimeout');
-    });
-    after(function () {
-      window.setTimeout.restore();
-    });
-    it("setTimeout is called once", function() {
-      view.doPolling();
-      expect(window.setTimeout.calledOnce).to.be.true;
-    });
-  });
-
   describe("#poll()", function() {
     beforeEach(function () {
       this.mock = sinon.stub(App.router, 'get');

http://git-wip-us.apache.org/repos/asf/ambari/blob/94c23298/ambari-web/test/views/wizard/step7/assign_master_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step7/assign_master_view_test.js b/ambari-web/test/views/wizard/step7/assign_master_view_test.js
index 1aaec7e..7c4a63e 100644
--- a/ambari-web/test/views/wizard/step7/assign_master_view_test.js
+++ b/ambari-web/test/views/wizard/step7/assign_master_view_test.js
@@ -27,23 +27,23 @@ function getView() {
   });
 }
 
-describe('App.AssignMasterOnStep7View', function() {
+describe('App.AssignMasterOnStep7View', function () {
 
-  beforeEach(function() {
+  beforeEach(function () {
     view = getView();
   });
 
   describe("#willInsertElement()", function () {
 
-    beforeEach(function() {
+    beforeEach(function () {
       sinon.stub(view, 'setAlertMessage');
     });
 
-    afterEach(function() {
+    afterEach(function () {
       view.setAlertMessage.restore();
     });
 
-    it("setAlertMessage should be called", function() {
+    it("setAlertMessage should be called", function () {
       view.willInsertElement();
       expect(view.setAlertMessage.calledOnce).to.be.true;
     });
@@ -51,32 +51,32 @@ describe('App.AssignMasterOnStep7View', function() {
 
   describe("#getDependentComponents()", function () {
 
-    beforeEach(function() {
+    beforeEach(function () {
       sinon.stub(App.StackServiceComponent, 'find').returns(Em.Object.create({
         dependencies: [{
           scope: 'host',
           componentName: 'C1'
         }]
       }));
-      sinon.stub(App.format, 'role', function(arg) {
+      sinon.stub(App.format, 'role', function (arg) {
         return arg;
       });
     });
 
-    afterEach(function() {
+    afterEach(function () {
       App.StackServiceComponent.find.restore();
       App.format.role.restore();
     });
 
-    it("should return dependent components", function() {
+    it("should return dependent components", function () {
       expect(view.getDependentComponents([{}])).to.be.eql(['C1']);
     });
   });
 
   describe("#setAlertMessage()", function () {
 
-    beforeEach(function() {
-      sinon.stub(App.format, 'role', function(arg) {
+    beforeEach(function () {
+      sinon.stub(App.format, 'role', function (arg) {
         return arg;
       });
       sinon.stub(view, 'getDependentComponents').returns(['c1']);
@@ -84,17 +84,20 @@ describe('App.AssignMasterOnStep7View', function() {
       this.mock = sinon.stub(App, 'get');
     });
 
-    afterEach(function() {
+    afterEach(function () {
       App.format.role.restore();
       view.getDependentComponents.restore();
       stringUtils.getFormattedStringFromArray.restore();
       this.mock.restore();
     });
 
-    it("isManualKerberos false, single master", function() {
-      var expected = Em.I18n.t('installer.step7.assign.master.body')
-        .format('c1', Em.I18n.t('common.host').toLowerCase(), Em.I18n.t('it')) +
-        '<br/>' + Em.I18n.t('installer.step7.assign.master.dependent.component.body').format('');
+    it("isManualKerberos false, single master", function () {
+
+      var expected = [
+        Em.I18n.t('installer.step7.assign.master.body').format('c1', Em.I18n.t('common.host').toLowerCase(),
Em.I18n.t('it')),
+        Em.I18n.t('installer.step7.assign.master.dependent.component.body').format('')
+      ].join('<br/>');
+
       view.set('controller.mastersToCreate', ['c1']);
       this.mock.returns(false);
 
@@ -102,10 +105,13 @@ describe('App.AssignMasterOnStep7View', function() {
       expect(view.get('alertMessage')).to.be.equal(expected);
     });
 
-    it("isManualKerberos false, multiple masters", function() {
-      var expected = Em.I18n.t('installer.step7.assign.master.body')
-          .format('c1,c2', Em.I18n.t('common.hosts').toLowerCase(), Em.I18n.t('then')) +
-        '<br/>' + Em.I18n.t('installer.step7.assign.master.dependent.component.body').format('');
+    it("isManualKerberos false, multiple masters", function () {
+
+      var expected = [
+        Em.I18n.t('installer.step7.assign.master.body').format('c1,c2', Em.I18n.t('common.hosts').toLowerCase(),
Em.I18n.t('then')),
+        Em.I18n.t('installer.step7.assign.master.dependent.component.body').format('')
+      ].join('<br/>');
+
       view.set('controller.mastersToCreate', ['c1', 'c2']);
       this.mock.returns(false);
 
@@ -113,11 +119,13 @@ describe('App.AssignMasterOnStep7View', function() {
       expect(view.get('alertMessage')).to.be.equal(expected);
     });
 
-    it("isManualKerberos true, single master", function() {
-      var expected = Em.I18n.t('installer.step7.assign.master.body')
-          .format('c1', Em.I18n.t('common.host').toLowerCase(), Em.I18n.t('it')) +
-        '<br/>' + Em.I18n.t('installer.step7.assign.master.dependent.component.body').format('')
+
-        '<br/>' + Em.I18n.t('common.warn.message').format(Em.I18n.t('common.important')
+ ': ' + Em.I18n.t('installer.step8.kerberors.warning'));
+    it("isManualKerberos true, single master", function () {
+
+      var expected = [
+        Em.I18n.t('installer.step7.assign.master.body').format('c1', Em.I18n.t('common.host').toLowerCase(),
Em.I18n.t('it')),
+        Em.I18n.t('installer.step7.assign.master.dependent.component.body').format(''),
+        Em.I18n.t('common.warn.message').format(Em.I18n.t('common.important') + ': ' + Em.I18n.t('installer.step8.kerberors.warning'))
+      ].join('<br/>');
 
       view.set('controller.mastersToCreate', ['c1']);
       this.mock.returns(true);


Mime
View raw message