ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-17610. Installer and Add Host wizard: clicking next button on "Confirm Hosts" page shows spinner without disabling next button (alexantonenko)
Date Thu, 07 Jul 2016 16:22:45 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 f10dc33a6 -> bc0d8491e


AMBARI-17610. Installer and Add Host wizard: clicking next button on "Confirm Hosts" page
shows spinner without disabling next button (alexantonenko)


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

Branch: refs/heads/branch-2.4
Commit: bc0d8491e965be31a781de64af1c46261d2063af
Parents: f10dc33
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Thu Jul 7 19:18:20 2016 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Thu Jul 7 19:22:39 2016 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step3_controller.js  |   4 +
 .../app/controllers/wizard/step9_controller.js  |   2 +
 ambari-web/app/templates/wizard/step3.hbs       |   4 +-
 ambari-web/app/templates/wizard/step9.hbs       |   2 +-
 .../test/controllers/wizard/step3_test.js       | 118 +++++++++++++++++++
 .../test/controllers/wizard/step9_test.js       |  60 ++++++++++
 6 files changed, 187 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0d8491/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index 03912ed..0ccf2ed 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -205,6 +205,10 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin,
{
     return (App.get('testMode')) ? true : !this.get('isRegistrationInProgress');
   }.property('isRegistrationInProgress'),
 
+  isNextButtonDisabled: Em.computed.or('App.router.btnClickInProgress', 'isSubmitDisabled'),
+
+  isBackButtonDisabled: Em.computed.or('App.router.btnClickInProgress', 'isBackDisabled'),
+
   /**
    * Progress value for "update hosts status" process
    * @type {number}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0d8491/ambari-web/app/controllers/wizard/step9_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js
index 41ae920..46a21ac 100644
--- a/ambari-web/app/controllers/wizard/step9_controller.js
+++ b/ambari-web/app/controllers/wizard/step9_controller.js
@@ -114,6 +114,8 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin,
{
     return !validStates.contains(this.get('content.cluster.status')) || App.get('router.btnClickInProgress');
   }.property('content.cluster.status'),
 
+  isNextButtonDisabled: Em.computed.or('App.router.nextBtnClickInProgress', 'isSubmitDisabled'),
+
   /**
    * Observer function: Enables previous steps link if install task failed in installer wizard.
    * @method togglePreviousSteps

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0d8491/ambari-web/app/templates/wizard/step3.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step3.hbs b/ambari-web/app/templates/wizard/step3.hbs
index f4108cd..f5648e1 100644
--- a/ambari-web/app/templates/wizard/step3.hbs
+++ b/ambari-web/app/templates/wizard/step3.hbs
@@ -148,13 +148,13 @@
     {{/unless}}
   </div>
   <div class="btn-area">
-    <button type="button" class="btn pull-left installer-back-btn" {{bindAttr disabled="isBackDisabled"}}
{{action back}}>
+    <button type="button" class="btn pull-left installer-back-btn" {{bindAttr disabled="isBackButtonDisabled"}}
{{action back}}>
       &larr; {{t common.back}}
       {{#if App.router.backBtnClickInProgress}}
         {{view App.SpinnerView tagName="span" classNames="service-button-spinner"}}
       {{/if}}
     </button>
-    <button type="button" class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
{{action submit target="controller"}}>
+    <button type="button" class="btn btn-success pull-right" {{bindAttr disabled="isNextButtonDisabled"}}
{{action submit target="controller"}}>
       {{#if App.router.nextBtnClickInProgress}}
         {{view App.SpinnerView tagName="span" classNames="service-button-spinner"}}
       {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0d8491/ambari-web/app/templates/wizard/step9.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step9.hbs b/ambari-web/app/templates/wizard/step9.hbs
index 9385df7..c45c3b1 100644
--- a/ambari-web/app/templates/wizard/step9.hbs
+++ b/ambari-web/app/templates/wizard/step9.hbs
@@ -136,7 +136,7 @@
       </p>
     {{/if}}
     <div class="btn-area">
-      <button class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
{{action submit target="controller"}}>
+      <button class="btn btn-success pull-right" {{bindAttr disabled="isNextButtonDisabled"}}
{{action submit target="controller"}}>
         {{#if App.router.nextBtnClickInProgress}}
           {{view App.SpinnerView tagName="span" classNames="service-button-spinner"}}
         {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0d8491/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index 92b607d..1e1b3bd 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -3174,4 +3174,122 @@ describe('App.WizardStep3Controller', function () {
 
   });
 
+  describe('#isNextButtonDisabled', function () {
+
+    var cases = [
+      {
+        btnClickInProgress: true,
+        isSubmitDisabled: true,
+        isNextButtonDisabled: true,
+        description: 'button clicked, submit disabled',
+        title: 'next button disabled'
+      },
+      {
+        btnClickInProgress: true,
+        isSubmitDisabled: false,
+        isNextButtonDisabled: true,
+        description: 'button clicked, submit not disabled',
+        title: 'next button disabled'
+      },
+      {
+        btnClickInProgress: false,
+        isSubmitDisabled: true,
+        isNextButtonDisabled: true,
+        description: 'no button clicked, submit disabled',
+        title: 'next button disabled'
+      },
+      {
+        btnClickInProgress: false,
+        isSubmitDisabled: false,
+        isNextButtonDisabled: false,
+        description: 'no button clicked, submit not disabled',
+        title: 'next button enabled'
+      }
+    ];
+
+    cases.forEach(function (item) {
+
+      describe(item.description, function () {
+
+        beforeEach(function () {
+          c.set('isSubmitDisabled', item.isSubmitDisabled);
+          sinon.stub(App, 'get').withArgs('router.btnClickInProgress').returns(item.btnClickInProgress);
+          c.propertyDidChange('isSubmitDisabled');
+          c.propertyDidChange('App.router.btnClickInProgress');
+        });
+
+        afterEach(function () {
+          App.get.restore();
+        });
+
+        it(item.title, function () {
+          expect(c.get('isNextButtonDisabled')).to.equal(item.isNextButtonDisabled);
+        });
+
+      });
+
+    });
+
+  });
+
+  describe('#isBackButtonDisabled', function () {
+
+    var cases = [
+      {
+        btnClickInProgress: true,
+        isBackDisabled: true,
+        isBackButtonDisabled: true,
+        description: 'button clicked, stepping back disabled',
+        title: 'back button disabled'
+      },
+      {
+        btnClickInProgress: true,
+        isBackDisabled: false,
+        isBackButtonDisabled: true,
+        description: 'button clicked, stepping back not disabled',
+        title: 'back button disabled'
+      },
+      {
+        btnClickInProgress: false,
+        isBackDisabled: true,
+        isBackButtonDisabled: true,
+        description: 'no button clicked, stepping back disabled',
+        title: 'back button disabled'
+      },
+      {
+        btnClickInProgress: false,
+        isBackDisabled: false,
+        isBackButtonDisabled: false,
+        description: 'no button clicked, stepping back not disabled',
+        title: 'back button enabled'
+      }
+    ];
+
+    cases.forEach(function (item) {
+
+      describe(item.description, function () {
+
+        beforeEach(function () {
+          c.reopen({
+            isBackDisabled: item.isBackDisabled
+          });
+          sinon.stub(App, 'get').withArgs('router.btnClickInProgress').returns(item.btnClickInProgress);
+          c.propertyDidChange('isBackDisabled');
+          c.propertyDidChange('App.router.btnClickInProgress');
+        });
+
+        afterEach(function () {
+          App.get.restore();
+        });
+
+        it(item.title, function () {
+          expect(c.get('isBackButtonDisabled')).to.equal(item.isBackButtonDisabled);
+        });
+
+      });
+
+    });
+
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0d8491/ambari-web/test/controllers/wizard/step9_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step9_test.js b/ambari-web/test/controllers/wizard/step9_test.js
index dfc1d65..4421b92 100644
--- a/ambari-web/test/controllers/wizard/step9_test.js
+++ b/ambari-web/test/controllers/wizard/step9_test.js
@@ -1853,4 +1853,64 @@ describe('App.InstallerStep9Controller', function () {
 
   });
 
+  describe('#isNextButtonDisabled', function () {
+
+    var cases = [
+      {
+        nextBtnClickInProgress: true,
+        isSubmitDisabled: true,
+        isNextButtonDisabled: true,
+        description: 'button clicked, submit disabled',
+        title: 'next button disabled'
+      },
+      {
+        nextBtnClickInProgress: true,
+        isSubmitDisabled: false,
+        isNextButtonDisabled: true,
+        description: 'button clicked, submit not disabled',
+        title: 'next button disabled'
+      },
+      {
+        nextBtnClickInProgress: false,
+        isSubmitDisabled: true,
+        isNextButtonDisabled: true,
+        description: 'no button clicked, submit disabled',
+        title: 'next button disabled'
+      },
+      {
+        nextBtnClickInProgress: false,
+        isSubmitDisabled: false,
+        isNextButtonDisabled: false,
+        description: 'no button clicked, submit not disabled',
+        title: 'next button enabled'
+      }
+    ];
+
+    cases.forEach(function (item) {
+
+      describe(item.description, function () {
+
+        beforeEach(function () {
+          c.reopen({
+            isSubmitDisabled: item.isSubmitDisabled
+          });
+          sinon.stub(App, 'get').withArgs('router.nextBtnClickInProgress').returns(item.nextBtnClickInProgress);
+          c.propertyDidChange('isSubmitDisabled');
+          c.propertyDidChange('App.router.nextBtnClickInProgress');
+        });
+
+        afterEach(function () {
+          App.get.restore();
+        });
+
+        it(item.title, function () {
+          expect(c.get('isNextButtonDisabled')).to.equal(item.isNextButtonDisabled);
+        });
+
+      });
+
+    });
+
+  });
+
 });


Mime
View raw message