ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-9900. Incorrect navigation when closing Add Service wizard on Stack And Versions page (alexantonenko)
Date Tue, 03 Mar 2015 17:42:07 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.0 cb8672ef9 -> 2a2458d6e


AMBARI-9900. Incorrect navigation when closing Add Service wizard on Stack And Versions page
(alexantonenko)


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

Branch: refs/heads/branch-2.0.0
Commit: 2a2458d6ec308e10468fefd7e66d417269ef4e5a
Parents: cb8672e
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Tue Mar 3 20:25:40 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Tue Mar 3 21:42:01 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/admin/kerberos.js           | 1 +
 ambari-web/app/controllers/main/service.js                  | 1 +
 ambari-web/app/routes/add_kerberos_routes.js                | 3 ++-
 ambari-web/app/routes/add_service_routes.js                 | 3 ++-
 .../app/views/main/admin/stack_upgrade/services_view.js     | 2 ++
 .../views/main/admin/stack_upgrade/services_view_test.js    | 9 ++++++---
 6 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2a2458d6/ambari-web/app/controllers/main/admin/kerberos.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos.js b/ambari-web/app/controllers/main/admin/kerberos.js
index 70e2051..fd4c3b2 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -161,6 +161,7 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
 
   startKerberosWizard: function () {
     this.setAddSecurityWizardStatus('RUNNING');
+    App.router.get('kerberosWizardController').setDBProperty('onClosePath', 'main.admin.adminKerberos.index');
     App.router.transitionTo('adminKerberos.adminAddKerberos');
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a2458d6/ambari-web/app/controllers/main/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service.js b/ambari-web/app/controllers/main/service.js
index c487931..bc3c2fb 100644
--- a/ambari-web/app/controllers/main/service.js
+++ b/ambari-web/app/controllers/main/service.js
@@ -191,6 +191,7 @@ App.MainServiceController = Em.ArrayController.extend({
     if (this.get('isAllServicesInstalled')) {
       return;
     }
+    App.router.get('addServiceController').setDBProperty('onClosePath', 'main.services.index');
     App.router.transitionTo('main.serviceAdd');
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a2458d6/ambari-web/app/routes/add_kerberos_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_kerberos_routes.js b/ambari-web/app/routes/add_kerberos_routes.js
index 2cd87ea..52c6958 100644
--- a/ambari-web/app/routes/add_kerberos_routes.js
+++ b/ambari-web/app/routes/add_kerberos_routes.js
@@ -70,6 +70,7 @@ module.exports = App.WizardRoute.extend({
           var self = this;
           var kerberosProgressPageController = App.router.get('kerberosProgressPageController');
           var controller = App.router.get('kerberosWizardController');
+          var exitPath = controller.getDBProperty('onClosePath') || 'adminKerberos.index';
           controller.clearTasksData();
           controller.finish();
           App.get('router.updateController').set('isWorking', true);
@@ -84,7 +85,7 @@ module.exports = App.WizardRoute.extend({
           }, {
             alwaysCallback: function () {
               self.hide();
-              App.get('router').transitionTo('adminKerberos.index');
+              App.get('router').transitionTo(exitPath);
               location.reload();
             }
           });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a2458d6/ambari-web/app/routes/add_service_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js
index 568b6cb..48a553d 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -49,12 +49,13 @@ module.exports = App.WizardRoute.extend({
             App.router.get('updateController').updateServices(function(){
               App.router.get('updateController').updateServiceMetric();
             });
+            var exitPath = addServiceController.getDBProperty('onClosePath') || 'main.services.index';
             addServiceController.finish();
             // We need to do recovery based on whether we are in Add Host or Installer wizard
             App.clusterStatus.setClusterStatus({
               clusterName: App.router.get('content.cluster.name'),
               clusterState: 'DEFAULT'
-            }, {alwaysCallback: function() {self.hide();App.router.transitionTo('main.services.index');location.reload();}});
+            }, {alwaysCallback: function() {self.hide();App.router.transitionTo(exitPath);location.reload();}});
 
           },
           didInsertElement: function(){

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a2458d6/ambari-web/app/views/main/admin/stack_upgrade/services_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/services_view.js b/ambari-web/app/views/main/admin/stack_upgrade/services_view.js
index b36e5f3..db38a4c 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/services_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/services_view.js
@@ -46,8 +46,10 @@ App.MainAdminStackServicesView = Em.View.extend({
   goToAddService: function (event) {
     if (event.context == "KERBEROS") {
       App.router.get('mainAdminKerberosController').checkAndStartKerberosWizard();
+      App.router.get('kerberosWizardController').setDBProperty('onClosePath', 'main.admin.stackAndUpgrade.services');
     } else {
       App.router.get('addServiceController').set('serviceToInstall', event.context);
+      App.router.get('addServiceController').setDBProperty('onClosePath', 'main.admin.stackAndUpgrade.services');
       App.get('router').transitionTo('main.serviceAdd');
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a2458d6/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
index 153d5c7..8e1f116 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js
@@ -42,13 +42,14 @@ describe('App.MainAdminStackServicesView', function () {
       expect(view.get('services')).to.eql([
         Em.Object.create({serviceName: 'S1', isInstalled: true}),
         Em.Object.create({serviceName: 'S2', isInstalled: false})
-      ])
+      ]);
     });
   });
 
   describe("#goToAddService()" , function() {
     var mock = Em.Object.create({
-      checkAndStartKerberosWizard: Em.K
+      checkAndStartKerberosWizard: Em.K,
+      setDBProperty: sinon.spy()
     });
     beforeEach(function() {
       sinon.stub(App.get('router'), 'transitionTo', Em.K);
@@ -60,13 +61,15 @@ describe('App.MainAdminStackServicesView', function () {
       App.router.get.restore();
       mock.checkAndStartKerberosWizard.restore();
     });
-    it("routes to Add Service Wizard", function() {
+    it("routes to Add Service Wizard and set redirect path on wizard close", function() {
       view.goToAddService({context: "serviceName"});
+      expect(App.router.get.calledWith('addServiceController') && mock.setDBProperty.calledWith('onClosePath',
'main.admin.stackAndUpgrade.services')).to.be.true;
       expect(App.get('router').transitionTo.calledWith('main.serviceAdd')).to.be.true;
       expect(mock.get('serviceToInstall')).to.be.equal("serviceName");
     });
     it("routes to Security Wizard", function() {
       view.goToAddService({context: "KERBEROS"});
+      expect(App.router.get.calledWith('kerberosWizardController') && mock.setDBProperty.calledWith('onClosePath',
'main.admin.stackAndUpgrade.services')).to.be.true;
       expect(mock.checkAndStartKerberosWizard.calledOnce).to.be.true;
     });
   });


Mime
View raw message