Repository: ambari
Updated Branches:
  refs/heads/trunk c97c276ae -> 0aebe0191


AMBARI-4923. Exiting Add Hosts Wizard during deploy causes Hosts table to break 
- then the wizard got stuck trying to add already-added host (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 5aa5d90da173281c7e11873726f7c63bff176a99
Parents: c97c276
Author: Alex Antonenko <[email protected]>
Authored: Mon Mar 3 20:05:58 2014 +0200
Committer: Alex Antonenko <[email protected]>
Committed: Mon Mar 3 20:05:58 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/messages.js               |  2 ++
 ambari-web/app/routes/add_host_routes.js | 38 ++++++++++++++++++++-------
 2 files changed, 31 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5aa5d90d/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 6388d27..8fdb400 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1512,6 +1512,8 @@ Em.I18n.translations = {
   'hosts.cant.do.popup.runningList.body.end':'To delete this host, you must 
first stop all the running components listed above. ' +
     'If this host has a DataNode, it should be decommissioned first to prevent 
data loss.',
   'hosts.add.header':'Add Host Wizard',
+  'hosts.add.exit.header':'Exit',
+  'hosts.add.exit.body':'Do you really want to exit Add Host Wizard?',
   'hosts.assignRack':'Assign Rack',
   'hosts.passiveMode.popup':'Are you sure you want to <b>Turn {0} Maintenance 
Mode</b> for {1}?',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/5aa5d90d/ambari-web/app/routes/add_host_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_host_routes.js 
b/ambari-web/app/routes/add_host_routes.js
index 43253ff..32d6c57 100644
--- a/ambari-web/app/routes/add_host_routes.js
+++ b/ambari-web/app/routes/add_host_routes.js
@@ -21,9 +21,22 @@ var App = require('app');
 module.exports = App.WizardRoute.extend({
   route: '/host/add',
 
+  clearData: function (router) {
+    App.router.get('updateController').set('isWorking', true);
+    App.clusterStatus.setClusterStatus({
+      clusterName: App.router.get('content.cluster.name'),
+      clusterState: 'DEFAULT',
+      wizardControllerName: App.router.get('addHostController.name'),
+      localdb: App.db.data
+    });
+    router.transitionTo('hosts.index');
+  },
+
   enter: function (router) {
     console.log('in /host/add:enter');
 
+    var self = this;
+
     Ember.run.next(function () {
       var addHostController = router.get('addHostController');
       App.router.get('updateController').set('isWorking', false);
@@ -43,15 +56,22 @@ module.exports = App.WizardRoute.extend({
           router.transitionTo('hosts.index');
         },
         onClose: function() {
-          this.hide();
-          App.router.get('updateController').set('isWorking', true);
-          App.clusterStatus.setClusterStatus({
-            clusterName: App.router.get('content.cluster.name'),
-            clusterState: 'DEFAULT',
-            wizardControllerName: App.router.get('addHostController.name'),
-            localdb: App.db.data
-          });
-          router.transitionTo('hosts.index');
+          if (addHostController.get('currentStep') == '6') {
+            App.ModalPopup.show({
+              header: Em.I18n.t('hosts.add.exit.header'),
+              body: Em.I18n.t('hosts.add.exit.body'),
+              onPrimary: function () {
+                this.hide();
+                addHostController.finish();
+                App.router.get('updateController').set('isWorking', true);
+                self.clearData(router);
+                location.reload();
+              }
+            });
+          } else {
+            this.hide();
+            self.clearData(router);
+          }
         },
         didInsertElement: function(){
           this.fitHeight();

Reply via email to