AMBARI-10279. Perf-cluster: Disable controls while call in pending 
(alexantonenko)


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

Branch: refs/heads/trunk
Commit: 1beb7d1afc687935e5f4b4f0a3acab4938cb959f
Parents: 3cedb02
Author: Alex Antonenko <[email protected]>
Authored: Tue Mar 31 20:42:57 2015 +0300
Committer: Alex Antonenko <[email protected]>
Committed: Tue Mar 31 21:46:14 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/installer.js         |  5 +++++
 ambari-web/app/controllers/login_controller.js  |  7 ++++---
 ambari-web/app/controllers/wizard.js            |  5 +++++
 ambari-web/app/templates/login.hbs              |  6 +++---
 ambari-web/app/views/wizard/step1_view.js       |  4 ++--
 ambari-web/test/views/wizard/step1_view_test.js | 20 +++++++++++++++++++-
 6 files changed, 38 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1beb7d1a/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js 
b/ambari-web/app/controllers/installer.js
index f1a0720..523963a 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -23,6 +23,8 @@ App.InstallerController = App.WizardController.extend({
 
   name: 'installerController',
 
+  isCheckInProgress: false,
+
   totalSteps: 11,
 
   content: Em.Object.create({
@@ -513,6 +515,7 @@ App.InstallerController = App.WizardController.extend({
             repo.set('errorTitle', '');
             repo.set('errorContent', '');
             repo.set('validation', App.Repository.validation['INPROGRESS']);
+            this.set('content.isCheckInProgress', true);
             App.ajax.send({
               name: 'wizard.advanced_repositories.valid_url',
               sender: this,
@@ -554,6 +557,7 @@ App.InstallerController = App.WizardController.extend({
     }
     this.set('validationCnt', this.get('validationCnt') - 1);
     if (!this.get('validationCnt')) {
+      this.set('content.isCheckInProgress', false);
       data.dfd.resolve();
     }
   },
@@ -573,6 +577,7 @@ App.InstallerController = App.WizardController.extend({
         repo.set('errorContent', $.parseJSON(request.responseText) ? 
$.parseJSON(request.responseText).message : "");
       }
     }
+    this.set('content.isCheckInProgress', false);
     params.dfd.reject();
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1beb7d1a/ambari-web/app/controllers/login_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/login_controller.js 
b/ambari-web/app/controllers/login_controller.js
index 46160ee..4f5ccf5 100644
--- a/ambari-web/app/controllers/login_controller.js
+++ b/ambari-web/app/controllers/login_controller.js
@@ -27,11 +27,11 @@ App.LoginController = Em.Object.extend({
 
   errorMessage: '',
 
+  isSubmitDisabled: false,
+
   submit: function (e) {
     this.set('errorMessage', '');
-
-    var self = this;
-
+    this.set('isSubmitDisabled', true);
     App.get('router').login();
   },
 
@@ -49,6 +49,7 @@ App.LoginController = Em.Object.extend({
       }
       this.set('errorMessage', errorMessage);
     }
+    this.set('isSubmitDisabled', false);
   }
 
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/1beb7d1a/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js 
b/ambari-web/app/controllers/wizard.js
index dd1ea41..b5ebafd 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -345,6 +345,11 @@ App.WizardController = 
Em.Controller.extend(App.LocalStorage, {
       }
     }
 
+    var clusterStatus = {
+      status: 'PENDING'
+    };
+    this.saveClusterStatus(clusterStatus);
+
     App.ajax.send({
       name: isRetry ? 'common.host_components.update' : 
'common.services.update',
       sender: this,

http://git-wip-us.apache.org/repos/asf/ambari/blob/1beb7d1a/ambari-web/app/templates/login.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/login.hbs 
b/ambari-web/app/templates/login.hbs
index 7e910bb..ceb56c0 100644
--- a/ambari-web/app/templates/login.hbs
+++ b/ambari-web/app/templates/login.hbs
@@ -25,9 +25,9 @@
   </div>
   {{/if}}
   <label>{{t login.username}}</label>
-  {{view view.loginTextField valueBinding="loginName" class="span4"}}
+  {{view view.loginTextField valueBinding="loginName" class="span4" 
disabledBinding="isSubmitDisabled"}}
   <label>{{t common.password}}</label>
-  {{view view.passTextField type="password" valueBinding="password" 
class="span4"}}
-    <button class="btn btn-success login-btn" {{action "submit" 
target="controller"}}>{{t login.loginButton}}</button>
+  {{view view.passTextField type="password" valueBinding="password" 
class="span4" disabledBinding="isSubmitDisabled"}}
+    <button class="btn btn-success login-btn" {{bindAttr 
disabled="isSubmitDisabled"}} {{action "submit" target="controller"}}>{{t 
login.loginButton}}</button>
 </div>
 {{/unless}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/1beb7d1a/ambari-web/app/views/wizard/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step1_view.js 
b/ambari-web/app/views/wizard/step1_view.js
index c88fe68..6ae4823 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -84,8 +84,8 @@ App.WizardStep1View = Em.View.extend({
    * @type {bool}
    */
   isSubmitDisabled: function () {
-    return this.get('invalidFormatUrlExist') || this.get('isNoOsChecked') || 
this.get('invalidUrlExist');
-  }.property('invalidFormatUrlExist', 'isNoOsChecked', 'invalidUrlExist'),
+    return this.get('invalidFormatUrlExist') || this.get('isNoOsChecked') || 
this.get('invalidUrlExist') || this.get('controller.content.isCheckInProgress');
+  }.property('invalidFormatUrlExist', 'isNoOsChecked', 'invalidUrlExist', 
'controller.content.isCheckInProgress'),
 
   /**
    * Verify if some invalid repo-urls exist

http://git-wip-us.apache.org/repos/asf/ambari/blob/1beb7d1a/ambari-web/test/views/wizard/step1_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step1_view_test.js 
b/ambari-web/test/views/wizard/step1_view_test.js
index d868115..4d827bd 100644
--- a/ambari-web/test/views/wizard/step1_view_test.js
+++ b/ambari-web/test/views/wizard/step1_view_test.js
@@ -283,60 +283,78 @@ describe('App.WizardStep1View', function () {
         invalidFormatUrlExist: false,
         isNoOsChecked: false,
         invalidUrlExist: false,
+        checkInProgress: false,
         e: false
       },
       {
         invalidFormatUrlExist: true,
         isNoOsChecked: false,
         invalidUrlExist: false,
+        checkInProgress: false,
         e: true
       },
       {
         invalidFormatUrlExist: false,
         isNoOsChecked: true,
         invalidUrlExist: false,
+        checkInProgress: false,
         e: true
       },
       {
         invalidFormatUrlExist: false,
         isNoOsChecked: false,
         invalidUrlExist: true,
+        checkInProgress: false,
         e: true
       },
       {
         invalidFormatUrlExist: true,
         isNoOsChecked: false,
         invalidUrlExist: true,
+        checkInProgress: false,
         e: true
       },
       {
         invalidFormatUrlExist: true,
         isNoOsChecked: true,
         invalidUrlExist: false,
+        checkInProgress: false,
         e: true
       },
       {
         invalidFormatUrlExist: false,
         isNoOsChecked: true,
         invalidUrlExist: true,
+        checkInProgress: false,
         e: true
       },
       {
         invalidFormatUrlExist: true,
         isNoOsChecked: true,
         invalidUrlExist: true,
+        checkInProgress: false,
+        e: true
+      },
+      {
+        invalidFormatUrlExist: true,
+        isNoOsChecked: false,
+        invalidUrlExist: false,
+        checkInProgress: true,
         e: true
       }
     ]);
 
     tests.forEach(function (test) {
-      it(test.invalidFormatUrlExist.toString() + ' ' + 
test.isNoOsChecked.toString() + ' ' + test.invalidUrlExist.toString(), function 
() {
+      it(test.invalidFormatUrlExist.toString() + ' ' + 
test.isNoOsChecked.toString() + ' ' + test.invalidUrlExist.toString()+ ' ' + 
test.checkInProgress.toString(), function () {
         view = App.WizardStep1View.create();
         view.reopen({
           invalidFormatUrlExist: test.invalidFormatUrlExist,
           isNoOsChecked: test.isNoOsChecked,
           invalidUrlExist: test.invalidUrlExist
         });
+        view.set('controller', {});
+        view.set('controller.content', {});
+        view.set('controller.content.isCheckInProgress', test.checkInProgress);
         expect(view.get('isSubmitDisabled')).to.equal(test.e);
       });
     });

Reply via email to