ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [2/2] ambari git commit: AMBARI-9260 Kerberos Wizard: no warning before closing the wizard. (ababiichuk)
Date Thu, 22 Jan 2015 14:00:31 GMT
AMBARI-9260 Kerberos Wizard: no warning before closing the wizard. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 5f4adaa6cd57755a39ffdd6891bbac11a459931e
Parents: 752a52b
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Thu Jan 22 14:05:21 2015 +0200
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Thu Jan 22 15:59:56 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |  1 +
 .../main/admin/kerberos/wizard_controller.js    | 10 ++-
 ambari-web/app/messages.js                      |  3 +
 ambari-web/app/routes/add_kerberos_routes.js    | 68 ++++++++++++--------
 .../kerberos/kerberos_wizard_controler_tets.js  | 40 ++++++++++++
 5 files changed, 94 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5f4adaa6/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 827ccb8..33abd6e 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -50,6 +50,7 @@ var files = ['test/init_model_test',
   'test/controllers/main/alerts/add_alert_definition/step1_controller_test',
   'test/controllers/main/alerts/manage_alert_notifications_controller_test',
   'test/controllers/main/admin/kerberos_test',
+  'test/controllers/main/admin/kerberos/kerberos_wizard_controler_tets',
   'test/controllers/main/admin/kerberos/step4_controller_test',
   'test/controllers/main/admin/stack_and_upgrade_controller_test',
   'test/controllers/main/admin/serviceAccounts_controller_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f4adaa6/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
index ef7a351..18d5a03 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
@@ -264,7 +264,15 @@ App.KerberosWizardController = App.WizardController.extend({
     this.saveRequestIds(undefined);
     this.saveTasksRequestIds(undefined);
   },
-
+  /**
+   * shows popup with to warn user
+   * @param primary
+   */
+  warnBeforeExitPopup: function(primary) {
+    var primaryText = Em.I18n.t('common.exitAnyway');
+    var msg = Em.I18n.t('admin.kerberos.wizard.exit.msg');
+    return App.showConfirmationPopup(primary, msg, null, null, primaryText)
+  },
   /**
    * Clear all temporary data
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f4adaa6/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 8c00958..d8026a6 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -976,6 +976,9 @@ Em.I18n.translations = {
   'admin.kerberos.wizard.header':'Enable Kerberos Wizard',
   'admin.kerberos.button.enable': 'Enable Kerberos',
   'admin.kerberos.button.disable': 'Disable Kerberos',
+  'admin.kerberos.wizard.exit.msg': 'Enable Security 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 activate or disable security
as documented in the Ambari User Guide. ' +
+    'Do you really want to exit Kerberos Security Wizard?',
   'admin.kerberos.wizard.step1.header': 'Get Started',
   'admin.kerberos.wizard.step2.header': 'Configure Kerberos',
   'admin.kerberos.wizard.step3.header': 'Install and Test Kerberos',

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f4adaa6/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 a70cd31..90ce279 100644
--- a/ambari-web/app/routes/add_kerberos_routes.js
+++ b/ambari-web/app/routes/add_kerberos_routes.js
@@ -34,39 +34,53 @@ module.exports = App.WizardRoute.extend({
         secondary: null,
 
         onClose: function () {
-          var step2Controller = router.get('kerberosWizardStep2Controller');
-          if (step2Controller.get('testConnectionInProgress')) {
-            step2Controller.showConnectionInProgressPopup(this.exitWizard);
-          } else {
-            this.exitWizard();
+          var self = this;
+          switch(kerberosWizardController.get('currentStep')) {
+            case "1":
+              self.exitWizard();
+              break;
+            case "2":
+              var step2Controller = router.get('kerberosWizardStep2Controller');
+              if (step2Controller.get('testConnectionInProgress')) {
+                step2Controller.showConnectionInProgressPopup(function() {
+                  self.exitWizard();
+                });
+              } else {
+                self.exitWizard();
+              }
+              break;
+            default:
+              kerberosWizardController.warnBeforeExitPopup(function() {
+                self.exitWizard();
+              });
           }
         },
         didInsertElement: function () {
           this.fitHeight();
         },
 
-       exitWizard: function() {
-         var self = this;
-         var kerberosProgressPageController = App.router.get('kerberosProgressPageController');
-         var controller = App.router.get('kerberosWizardController');
-         controller.clearTasksData();
-         controller.finish();
-         App.router.get('updateController').set('isWorking', true);
-         if (App.get('testMode')) {
-           App.router.transitionTo('adminKerberos.index');
-           location.reload();
-         }
-         App.clusterStatus.setClusterStatus({
-           clusterName: App.router.getClusterName(),
-           clusterState: 'DEFAULT',
-           localdb: App.db.data
-         }, {
-           alwaysCallback: function () {
-             self.hide();
-             App.router.transitionTo('adminKerberos.index');
-           }
-         });
-       }
+        exitWizard: function () {
+          var self = this;
+          var kerberosProgressPageController = App.router.get('kerberosProgressPageController');
+          var controller = App.router.get('kerberosWizardController');
+          controller.clearTasksData();
+          controller.finish();
+          App.router.get('updateController').set('isWorking', true);
+          if (App.get('testMode')) {
+            App.router.transitionTo('adminKerberos.index');
+            location.reload();
+          }
+          App.clusterStatus.setClusterStatus({
+            clusterName: App.router.getClusterName(),
+            clusterState: 'DEFAULT',
+            localdb: App.db.data
+          }, {
+            alwaysCallback: function () {
+              self.hide();
+              App.router.transitionTo('adminKerberos.index');
+            }
+          });
+        }
       });
       kerberosWizardController.set('popup', popup);
       var currentClusterStatus = App.clusterStatus.get('value');

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f4adaa6/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_tets.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_tets.js
b/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_tets.js
new file mode 100644
index 0000000..4db54cb
--- /dev/null
+++ b/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_tets.js
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+describe('App.KerberosWizardController', function() {
+  var controller = App.KerberosWizardController.create({});
+
+  describe('#warnBeforeExitPopup()', function () {
+    beforeEach(function () {
+      sinon.stub(App, "showConfirmationPopup", Em.K);
+    });
+    afterEach(function () {
+      App.showConfirmationPopup.restore();
+    });
+    it('should open confirmation popup', function () {
+      var f = Em.K;
+      var popup = controller.warnBeforeExitPopup(f);
+      expect(App.showConfirmationPopup.calledWith(f, Em.I18n.t('admin.kerberos.wizard.exit.msg'),
null, null, Em.I18n.t('common.exitAnyway'))).to.be.true;
+    });
+  });
+
+});
+
+


Mime
View raw message