You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2014/09/18 16:44:15 UTC

[26/34] git commit: AMBARI-7382. Move Wizard: Review step doesn't show source and targer hosts. (akovalenko)

AMBARI-7382. Move Wizard: Review step doesn't show source and targer hosts. (akovalenko)


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

Branch: refs/heads/branch-alerts-dev
Commit: 38a18126ff070847d26f8fe913de93ea00f72bd9
Parents: 731d7b4
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu Sep 18 15:18:25 2014 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Thu Sep 18 15:18:25 2014 +0300

----------------------------------------------------------------------
 .../main/service/reassign/step2_controller.js   |   1 +
 .../app/controllers/wizard/step5_controller.js  |  10 +-
 ambari-web/app/routes/reassign_master_routes.js | 124 +++++++++++--------
 3 files changed, 78 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/38a18126/ambari-web/app/controllers/main/service/reassign/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step2_controller.js b/ambari-web/app/controllers/main/service/reassign/step2_controller.js
index f837408..7e4513a 100644
--- a/ambari-web/app/controllers/main/service/reassign/step2_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step2_controller.js
@@ -22,6 +22,7 @@ App.ReassignMasterWizardStep2Controller = App.WizardStep5Controller.extend({
 
   currentHostId: null,
   showCurrentHost: true,
+  useServerValidation: false,
 
   loadStep: function() {
     // If High Availability is enabled NameNode became a multiple component

http://git-wip-us.apache.org/repos/asf/ambari/blob/38a18126/ambari-web/app/controllers/wizard/step5_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step5_controller.js b/ambari-web/app/controllers/wizard/step5_controller.js
index 68342c7..6fb9ab1 100644
--- a/ambari-web/app/controllers/wizard/step5_controller.js
+++ b/ambari-web/app/controllers/wizard/step5_controller.js
@@ -98,6 +98,12 @@ App.WizardStep5Controller = Em.Controller.extend(App.BlueprintMixin, {
   submitButtonClicked: false,
 
   /**
+   * Either use or not use server validation in this controller
+   * @type {bool}
+   */
+  useServerValidation: true,
+
+  /**
    * Trigger for executing host names check for components
    * Should de "triggered" when host changed for some component and when new multiple component is added/removed
    * @type {bool}
@@ -243,7 +249,7 @@ App.WizardStep5Controller = Em.Controller.extend(App.BlueprintMixin, {
       return false;
     }
 
-    if (App.get('supports.serverRecommendValidate')) {
+    if (App.get('supports.serverRecommendValidate') && this.get('useServerValidation')) {
       self.set('submitDisabled', true);
 
       // reset previous recommendations
@@ -1095,7 +1101,7 @@ App.WizardStep5Controller = Em.Controller.extend(App.BlueprintMixin, {
         self.set('submitButtonClicked', false);
       };
 
-      if (App.get('supports.serverRecommendValidate')) {
+      if (App.get('supports.serverRecommendValidate')  && this.get('useServerValidation')) {
         self.recommendAndValidate(function () {
           self.showValidationIssuesAcceptBox(goNextStepIfValid);
         });

http://git-wip-us.apache.org/repos/asf/ambari/blob/38a18126/ambari-web/app/routes/reassign_master_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/reassign_master_routes.js b/ambari-web/app/routes/reassign_master_routes.js
index f28083a..e6ef5ca 100644
--- a/ambari-web/app/routes/reassign_master_routes.js
+++ b/ambari-web/app/routes/reassign_master_routes.js
@@ -21,7 +21,7 @@ var App = require('app');
 module.exports = App.WizardRoute.extend({
   route: '/service/reassign',
 
-  leaveWizard: function (router,context) {
+  leaveWizard: function (router, context) {
     var reassignMasterController = router.get('reassignMasterController');
     App.router.get('updateController').set('isWorking', true);
     reassignMasterController.finish();
@@ -29,67 +29,73 @@ module.exports = App.WizardRoute.extend({
       clusterName: App.router.get('content.cluster.name'),
       clusterState: 'DEFAULT',
       localdb: App.db.data
-    }, {alwaysCallback: function() {context.hide(); router.transitionTo('main.index');location.reload();}});
+    }, {alwaysCallback: function () {
+      context.hide();
+      router.transitionTo('main.index');
+      location.reload();
+    }});
   },
 
   enter: function (router) {
     console.log('in /service/reassign:enter');
-    if (App.router.get('mainHostController.hostsCountMap.TOTAL') > 1) {
-      var context = this;
-      Em.run.next(function () {
-        var reassignMasterController = router.get('reassignMasterController');
-        App.router.get('updateController').set('isWorking', false);
-        var popup = App.ModalPopup.show({
-          classNames: ['full-width-modal'],
-          header: Em.I18n.t('services.reassign.header'),
-          bodyClass: App.ReassignMasterView.extend({
-            controller: reassignMasterController
-          }),
-          primary: Em.I18n.t('form.cancel'),
-          showFooter: false,
-          secondary: null,
+    var context = this;
+    var reassignMasterController = router.get('reassignMasterController');
+    reassignMasterController.dataLoading().done(function () {
+      if (App.router.get('mainHostController.hostsCountMap.TOTAL') > 1) {
+        Em.run.next(function () {
+          App.router.get('updateController').set('isWorking', false);
+          var popup = App.ModalPopup.show({
+            classNames: ['full-width-modal'],
+            header: Em.I18n.t('services.reassign.header'),
+            bodyClass: App.ReassignMasterView.extend({
+              controller: reassignMasterController
+            }),
+            primary: Em.I18n.t('form.cancel'),
+            showFooter: false,
+            secondary: null,
 
-          onPrimary: function () {
-            this.hide();
-            App.router.get('updateController').set('isWorking', true);
-            App.router.transitionTo('main.services.index');
-          },
-          onClose: function () {
-            var reassignMasterController = router.get('reassignMasterController');
-            var currStep = reassignMasterController.get('currentStep');
+            onPrimary: function () {
+              this.hide();
+              App.router.get('updateController').set('isWorking', true);
+              App.router.transitionTo('main.services.index');
+            },
+            onClose: function () {
+              var reassignMasterController = router.get('reassignMasterController');
+              var currStep = reassignMasterController.get('currentStep');
 
-            if (parseInt(currStep) > 3) {
-              var self = this;
-              App.showConfirmationPopup(function () {
-                router.get('reassignMasterWizardStep' + currStep + 'Controller').removeObserver('tasks.@each.status', this, 'onTaskStatusChange');
-                context.leaveWizard(router, self);
-              }, Em.I18n.t('services.reassign.closePopup').format(reassignMasterController.get('content.reassign.display_name')));
-            } else {
-              context.leaveWizard(router, this);
+              if (parseInt(currStep) > 3) {
+                var self = this;
+                App.showConfirmationPopup(function () {
+                  router.get('reassignMasterWizardStep' + currStep + 'Controller').removeObserver('tasks.@each.status', this, 'onTaskStatusChange');
+                  context.leaveWizard(router, self);
+                }, Em.I18n.t('services.reassign.closePopup').format(reassignMasterController.get('content.reassign.display_name')));
+              } else {
+                context.leaveWizard(router, this);
+              }
+            },
+            didInsertElement: function () {
+              this.fitHeight();
+            }
+          });
+          reassignMasterController.set('popup', popup);
+          reassignMasterController.loadSecurityEnabled();
+          reassignMasterController.loadComponentToReassign();
+          var currentClusterStatus = App.clusterStatus.get('value');
+          if (currentClusterStatus) {
+            switch (currentClusterStatus.clusterState) {
+              case 'REASSIGN_MASTER_INSTALLING' :
+                reassignMasterController.setCurrentStep(currentClusterStatus.localdb.ReassignMaster.currentStep);
+                break;
             }
-          },
-          didInsertElement: function () {
-            this.fitHeight();
           }
+          router.transitionTo('step' + reassignMasterController.get('currentStep'));
         });
-        reassignMasterController.set('popup', popup);
-        reassignMasterController.loadSecurityEnabled();
-        reassignMasterController.loadComponentToReassign();
-        var currentClusterStatus = App.clusterStatus.get('value');
-        if (currentClusterStatus) {
-          switch (currentClusterStatus.clusterState) {
-            case 'REASSIGN_MASTER_INSTALLING' :
-              reassignMasterController.setCurrentStep(currentClusterStatus.localdb.ReassignMaster.currentStep);
-              break;
-          }
-        }
-        router.transitionTo('step' + reassignMasterController.get('currentStep'));
-      });
-    } else {
-      App.showAlertPopup(Em.I18n.t('common.error'), Em.I18n.t('services.reassign.error.fewHosts'), function () {
-        router.transitionTo('main.services.index');
-      })
-    }
+      } else {
+        App.showAlertPopup(Em.I18n.t('common.error'), Em.I18n.t('services.reassign.error.fewHosts'), function () {
+          router.transitionTo('main.services.index');
+        })
+      }
+    });
   },
 
   step1: Em.Route.extend({
@@ -215,7 +221,11 @@ module.exports = App.WizardRoute.extend({
           clusterName: router.get('reassignMasterController.content.cluster.name'),
           clusterState: 'DEFAULT',
           localdb: App.db.data
-        },{alwaysCallback: function() {controller.get('popup').hide();router.transitionTo('main.index');location.reload();}});
+        }, {alwaysCallback: function () {
+          controller.get('popup').hide();
+          router.transitionTo('main.index');
+          location.reload();
+        }});
       }
     },
 
@@ -276,7 +286,11 @@ module.exports = App.WizardRoute.extend({
           clusterName: router.get('reassignMasterController.content.cluster.name'),
           clusterState: 'DEFAULT',
           localdb: App.db.data
-        },{alwaysCallback: function() {controller.get('popup').hide();router.transitionTo('main.index');location.reload();}});
+        }, {alwaysCallback: function () {
+          controller.get('popup').hide();
+          router.transitionTo('main.index');
+          location.reload();
+        }});
       }
     },