Переглянути джерело

AMBARI-992. Logout does not clean application state properly. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1418906 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 роки тому
батько
коміт
476db5916e
3 змінених файлів з 11 додано та 15 видалено
  1. 2 0
      AMBARI-666-CHANGES.txt
  2. 8 14
      ambari-web/app/router.js
  3. 1 1
      ambari-web/app/routes/installer.js

+ 2 - 0
AMBARI-666-CHANGES.txt

@@ -442,6 +442,8 @@ AMBARI-666 branch (unreleased changes)
 
   BUG FIXES
 
+  AMBARI-992. Logout does not clean application state properly. (yusaku)
+
   AMBARI-957. Adding a host whose hostname is the same as the one the user 
   is accessing Ambari Web with breaks the Installer. (yusaku)
 

+ 8 - 14
ambari-web/app/router.js

@@ -32,20 +32,11 @@ App.Router = Em.Router.extend({
     var previousStep = parseInt(this.getInstallerCurrentStep());
     this.set('isFwdNavigation', newStep >= previousStep);
   },
+
   clearAllSteps: function() {
-    this.get('installerController.content').set('cluster',null);
-    this.get('wizardStep2Controller').set('hasSubmitted',false);
-    /*this.get('installerController.content').set({
-      cluster: null,
-      hosts: null,
-      services: null,
-      hostsInfo: null,
-      slaveComponentHosts: null,
-      hostSlaveComponents: null,
-      masterComponentHosts: null,
-      hostToMasterComponent : null,
-      serviceConfigProperties: null
-    });*/
+    this.set('installerController.content', []);
+    this.set('installerController.currentStep', 0);
+    this.set('wizardStep2Controller.hasSubmitted', false);
   },
 
   /**
@@ -234,8 +225,11 @@ App.Router = Em.Router.extend({
 
     logoff: function (router, context) {
       console.log('logging off');
-      router.clearAllSteps();
+      // App.db.cleanUp() must be called before router.clearAllSteps().
+      // otherwise, this.set('installerController.currentStep, 0) would have no effect
+      // since it's a computed property but we are not setting it as a dependent of App.db.
       App.db.cleanUp();
+      router.clearAllSteps();
       console.log("Log off: " + App.db.getClusterName());
       router.set('loginController.loginName', '');
       router.set('loginController.password', '');

+ 1 - 1
ambari-web/app/routes/installer.js

@@ -28,7 +28,7 @@ module.exports = Em.Route.extend({
     if (router.getAuthenticated()) {
       router.get('mainController').stopLoadOperationsPeriodically();
       console.log('In installer with successful authenticated');
-
+      console.log('current step=' + router.get('installerController.currentStep'));
       Ember.run.next(function () {
         var installerController = router.get('installerController');
         router.transitionTo('step' + installerController.get('currentStep'));