ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject git commit: AMBARI-7359. Move Wizard should be disabled for single node cluster. (akovalenko)
Date Wed, 17 Sep 2014 12:20:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0fb11d23e -> 24f0b47e5


AMBARI-7359. Move Wizard should be disabled for single node cluster. (akovalenko)


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

Branch: refs/heads/trunk
Commit: 24f0b47e5220a8e696233658fd99a08b8cdc399c
Parents: 0fb11d2
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Wed Sep 17 15:19:08 2014 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Wed Sep 17 15:19:08 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/messages.js                      |  1 +
 ambari-web/app/routes/reassign_master_routes.js | 96 +++++++++++---------
 2 files changed, 52 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/24f0b47e/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index f158f8d..7379220 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1459,6 +1459,7 @@ Em.I18n.translations = {
   'services.service.config_groups.switchGroupTextFull':'Switch to \'{0}\' host config group',
   'services.service.config_groups.switchGroupTextShort':'Switch to \'{0}\'',
   'services.reassign.closePopup':'Move {0} wizard is in progress. You must allow the wizard
to complete for Ambari to be in usable state. If you choose to quit, you must follow manual
instructions to complete or revert move {0} wizard as documented in the Ambari User Guide.
Are you sure you want to exit the wizard?',
+  'services.reassign.error.fewHosts':'You must have at least 2 hosts in your cluster to run
Move Wizard.',
 
   'services.reassign.step1.header':'Get Started',
   'services.reassign.step1.message1': 'This wizard will walk you through moving {0}.<br/>',

http://git-wip-us.apache.org/repos/asf/ambari/blob/24f0b47e/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 85f91aa..f28083a 100644
--- a/ambari-web/app/routes/reassign_master_routes.js
+++ b/ambari-web/app/routes/reassign_master_routes.js
@@ -34,56 +34,62 @@ module.exports = App.WizardRoute.extend({
 
   enter: function (router) {
     console.log('in /service/reassign:enter');
-    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,
+    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,
 
-        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');
+      })
+    }
   },
 
   step1: Em.Route.extend({


Mime
View raw message