ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [13/22] ambari git commit: AMBARI-20711 Post-install host check: 'Rerun Checks' button is never disabled. (ababiichuk)
Date Tue, 11 Apr 2017 11:14:35 GMT
AMBARI-20711 Post-install host check: 'Rerun Checks' button is never disabled. (ababiichuk)


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

Branch: refs/heads/branch-3.0-perf
Commit: 827cc03b5c8c85d6e33491ce73e0bbfda2d4b436
Parents: 9ca337c
Author: ababiichuk <ababiichuk@hortonworks.com>
Authored: Fri Apr 7 19:15:34 2017 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 14 ++++++++----
 .../app/controllers/wizard/step3_controller.js  | 10 +++-----
 .../main/host/details/actions/check_host.js     | 24 +++++++++++++++++---
 .../wizard/step3/hostWarningPopupFooter_view.js |  4 ++--
 .../step3/hostWarningPopupFooter_view_test.js   | 14 ++++++++----
 5 files changed, 46 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/827cc03b/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 6e85190..def75d6 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -2426,8 +2426,11 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
   runHostCheck: function () {
     var dataForCheckHostRequest = this.getDataForHostCheck();
 
-    this.set('stopChecking', false);
-    this.set('checkHostFinished', false);
+    this.setProperties({
+      stopChecking: false,
+      checkHostFinished: false,
+      isRerun: false
+    });
     this.setBootHostsProp();
     this.showHostWarningsPopup();
     this.requestToPerformHostCheck(dataForCheckHostRequest);
@@ -2486,14 +2489,17 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
       },
 
       footerClass: App.WizardStep3HostWarningPopupFooter.reopen({
-        footerControllerBinding: 'App.router.mainHostDetailsController'
+        footerControllerBinding: 'App.router.mainHostDetailsController',
+        checkHostFinished: function () {
+          return this.get('footerController.checkHostFinished');
+        }.property('footerController.checkHostFinished')
       }),
 
       bodyClass: App.WizardStep3HostWarningPopupBody.reopen({
         bodyControllerBinding: 'App.router.mainHostDetailsController',
         checkHostFinished: function () {
           return this.get('bodyController.checkHostFinished');
-        }.property('bodyController.checkHostFinished'),
+        }.property('bodyController.checkHostFinished')
       })
     });
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/827cc03b/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 c282451..29393e3 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -121,12 +121,6 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin,
App.Check
   }.property('content.hosts'),
 
   /**
-   * Timeout for "warning"-requests
-   * @type {number}
-   */
-  warningsTimeInterval: 60000,
-
-  /**
    * Are hosts warnings loaded
    * @type {bool}
    */
@@ -909,7 +903,9 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin,
App.Check
         this.fitHeight();
       },
 
-      footerClass: App.WizardStep3HostWarningPopupFooter,
+      footerClass: App.WizardStep3HostWarningPopupFooter.reopen({
+        checkHostFinished: true
+      }),
 
       bodyClass: App.WizardStep3HostWarningPopupBody.reopen({
         checkHostFinished: true

http://git-wip-us.apache.org/repos/asf/ambari/blob/827cc03b/ambari-web/app/mixins/main/host/details/actions/check_host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/host/details/actions/check_host.js b/ambari-web/app/mixins/main/host/details/actions/check_host.js
index c0ebf02..80f4f03 100644
--- a/ambari-web/app/mixins/main/host/details/actions/check_host.js
+++ b/ambari-web/app/mixins/main/host/details/actions/check_host.js
@@ -99,6 +99,17 @@ App.CheckHostMixin = Em.Mixin.create({
    */
   isAddHostWizard: false,
 
+  /**
+   * True if user triggered host checks rerun
+   * @type {boolean}
+   */
+  isRerun: false,
+
+  /**
+   * Timeout for "warning"-requests
+   * @type {number}
+   */
+  warningsTimeInterval: 60000,
 
   /**
    * disables host check on Add host wizard as per the experimental flag
@@ -334,7 +345,7 @@ App.CheckHostMixin = Em.Mixin.create({
     this.set('diskCategoryWarnings', diskWarnings);
     this.set('thpCategoryWarnings', thpWarnings);
     this.stopRegistration();
-    this.get('name') === 'mainHostDetailsController' && this.set('checkHostFinished',
true);
+    this.get('name') === 'mainHostDetailsController' && !this.get('isRerun') &&
this.set('checkHostFinished', true);
   },
 
   /**
@@ -415,7 +426,10 @@ App.CheckHostMixin = Em.Mixin.create({
     var self = this;
     var currentProgress = 0;
     this.get('name') === 'wizardStep3Controller' ? this.getHostNameResolution() : this.getHostNameResolution(this.getDataForHostCheck());
-    this.set('stopChecking', false);
+    this.setProperties({
+      stopChecking: false,
+      isRerun: true
+    });
     this.get('name') === 'wizardStep3Controller' ? this.getGeneralHostCheck() : this.getGeneralHostCheck(this.getDataForHostCheck());
     this.get('name') === 'wizardStep3Controller' && this.checkHostJDK();
     var interval = setInterval(function () {
@@ -428,7 +442,11 @@ App.CheckHostMixin = Em.Mixin.create({
           name: 'wizard.step3.rerun_checks',
           sender: self,
           success: 'rerunChecksSuccessCallback',
-          error: 'rerunChecksErrorCallback'
+          error: 'rerunChecksErrorCallback',
+          callback: function () {
+            self.set('isRerun', false);
+            self.get('name') === 'mainHostDetailsController' && self.set('checkHostFinished',
true);
+          }
         });
       }
     }, 1000);

http://git-wip-us.apache.org/repos/asf/ambari/blob/827cc03b/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js b/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
index fb2019c..9461074 100644
--- a/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
+++ b/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
@@ -29,9 +29,9 @@ App.WizardStep3HostWarningPopupFooter = Em.View.extend({
   progressWidth: Em.computed.format('width:{0}%', 'footerController.checksUpdateProgress'),
 
   isUpdateInProgress: function () {
-    return (this.get('footerController.checksUpdateProgress') > 0) &&
+    return !this.get('checkHostFinished') || (this.get('footerController.checksUpdateProgress')
> 0) &&
       (this.get('footerController.checksUpdateProgress') < 100);
-  }.property('footerController.checksUpdateProgress'),
+  }.property('checkHostFinished', 'footerController.checksUpdateProgress'),
 
   updateStatusClass: function () {
     var status = this.get('footerController.checksUpdateStatus');

http://git-wip-us.apache.org/repos/asf/ambari/blob/827cc03b/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js b/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
index d1fbc24..a366fe7 100644
--- a/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
+++ b/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
@@ -36,13 +36,19 @@ describe('App.WizardStep3HostWarningPopupFooter', function() {
 
   describe('#isUpdateInProgress', function() {
     var tests = Em.A([
-      {checksUpdateProgress: 0, e: false},
-      {checksUpdateProgress: 100, e: false},
-      {checksUpdateProgress: 50, e: true}
+      {checksUpdateProgress: 0, checkHostFinished: true, e: false},
+      {checksUpdateProgress: 100, checkHostFinished: true, e: false},
+      {checksUpdateProgress: 50, checkHostFinished: true, e: true},
+      {checksUpdateProgress: 0, checkHostFinished: false, e: true},
+      {checksUpdateProgress: 100, checkHostFinished: false, e: true},
+      {checksUpdateProgress: 50, checkHostFinished: false, e: true}
     ]);
     tests.forEach(function(test) {
       it(test.checksUpdateProgress, function() {
-        view.set('footerController.checksUpdateProgress', test.checksUpdateProgress);
+        view.setProperties({
+          'checkHostFinished': test.checkHostFinished,
+          'footerController.checksUpdateProgress': test.checksUpdateProgress
+        });
         expect(view.get('isUpdateInProgress')).to.equal(test.e);
       });
     });


Mime
View raw message