incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject svn commit: r1435458 - in /incubator/ambari/trunk: ./ ambari-web/app/ ambari-web/app/controllers/wizard/ ambari-web/app/models/ ambari-web/app/routes/
Date Sat, 19 Jan 2013 01:55:53 GMT
Author: yusaku
Date: Sat Jan 19 01:55:53 2013
New Revision: 1435458

URL: http://svn.apache.org/viewvc?rev=1435458&view=rev
Log:
AMBARI-1212. After successful install with Ambari, the user is taken to the welcome page of
the Install Wizard upon browser relaunch if the HTTP session is expired. (yusaku)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
    incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js
    incubator/ambari/trunk/ambari-web/app/models/cluster_states.js
    incubator/ambari/trunk/ambari-web/app/router.js
    incubator/ambari/trunk/ambari-web/app/routes/add_host_routes.js
    incubator/ambari/trunk/ambari-web/app/routes/installer.js
    incubator/ambari/trunk/ambari-web/app/routes/main.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1435458&r1=1435457&r2=1435458&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Sat Jan 19 01:55:53 2013
@@ -78,6 +78,10 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1212. After successful install with Ambari, the user is taken to the
+ welcome page of the Install Wizard upon browser relaunch if the HTTP session
+ is expired. (yusaku)
+
  AMBARI-1227. Host-level task popup is not showing the display name for
  components. (yusaku)
 

Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js?rev=1435458&r1=1435457&r2=1435458&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js Sat Jan 19
01:55:53 2013
@@ -760,7 +760,7 @@ App.WizardStep8Controller = Em.Controlle
       // We need to do recovery based on whether we are in Add Host or Installer wizard
       switch (this.get('content.controllerName')) {
         case 'installerController' :
-          App.clusterStatus.set('value', {
+          App.clusterStatus.setClusterStatus({
             clusterName: this.get('clusterName'),
             clusterState: 'CLUSTER_DEPLOY_PREP_2',
             wizardControllerName: this.get('content.controllerName'),
@@ -769,7 +769,7 @@ App.WizardStep8Controller = Em.Controlle
           break;
 
         case 'addHostController' :
-          App.clusterStatus.set('value', {
+          App.clusterStatus.setClusterStatus({
             clusterName: this.get('clusterName'),
             clusterState: 'ADD_HOSTS_DEPLOY_PREP_2',
             wizardControllerName: this.get('content.controllerName'),

Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js?rev=1435458&r1=1435457&r2=1435458&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js Sat Jan 19
01:55:53 2013
@@ -283,7 +283,7 @@ App.WizardStep9Controller = Em.Controlle
         App.router.get(self.get('content.controllerName')).saveClusterStatus(clusterStatus);
 
         // We need to do recovery if there is a browser crash
-        App.clusterStatus.set('value', {
+        App.clusterStatus.setClusterStatus({
           clusterState: 'SERVICE_STARTING_3',
           localdb: App.db.data
         });

Modified: incubator/ambari/trunk/ambari-web/app/models/cluster_states.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/cluster_states.js?rev=1435458&r1=1435457&r2=1435458&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/cluster_states.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/cluster_states.js Sat Jan 19 01:55:53 2013
@@ -23,55 +23,53 @@ App.clusterStatus = Ember.Object.create(
   clusterState: 'CLUSTER_NOT_CREATED_1',
   wizardControllerName: null,
   localdb: null,
-  key: function () {
-    return 'CLUSTER_CURRENT_STATUS';
-  }.property(),
-  value: function (key, newValue) {
-    // getter
-    if (arguments.length == 1) {
-
-      var url = App.apiPrefix + '/persist/' + this.get('key');
-      jQuery.ajax(
-        {
-          url: url,
-          context: this,
-          async: false,
-          success: function (response) {
-            if (response) {
-              var newValue = jQuery.parseJSON(response);
-              if (newValue.clusterState) {
-                this.set('clusterState', newValue.clusterState);
-              }
-              if (newValue.clusterName) {
-                this.set('clusterName', newValue.clusterName);
-              }
-              if (newValue.wizardControllerName) {
-                this.set('wizardControllerName', newValue.wizardControllerName);
-              }
-              if (newValue.localdb) {
-                this.set('localdb', newValue.localdb);
-              }
-            } else {
-              // default status already set
+  key: 'CLUSTER_CURRENT_STATUS',
+  /**
+   * get cluster data from server and update cluster status
+   */
+  updateFromServer: function(){
+    var url = App.apiPrefix + '/persist/' + this.get('key');
+    jQuery.ajax(
+      {
+        url: url,
+        context: this,
+        async: false,
+        success: function (response) {
+          if (response) {
+            var newValue = jQuery.parseJSON(response);
+            if (newValue.clusterState) {
+              this.set('clusterState', newValue.clusterState);
             }
-          },
-          error: function (xhr) {
-            if (xhr.status == 404) {
-              // default status already set
-              console.log('Persist API did NOT find the key CLUSTER_CURRENT_STATUS');
+            if (newValue.clusterName) {
+              this.set('clusterName', newValue.clusterName);
             }
+            if (newValue.wizardControllerName) {
+              this.set('wizardControllerName', newValue.wizardControllerName);
+            }
+            if (newValue.localdb) {
+              this.set('localdb', newValue.localdb);
+            }
+          } else {
+            // default status already set
           }
-        }
-      );
-
-      return {
-        clusterName: this.get('clusterName'),
-        clusterState: this.get('clusterState'),
-        wizardControllerName: this.get('wizardControllerName'),
-        localdb: this.get('localdb')
-      };
-
-    } else if (newValue) {
+        },
+        error: function (xhr) {
+          if (xhr.status == 404) {
+            // default status already set
+            console.log('Persist API did NOT find the key CLUSTER_CURRENT_STATUS');
+          }
+        },
+        statusCode: require('data/statusCodes')
+      }
+    );
+  },
+  /**
+   * update cluster status and post it on server
+   * @param newValue
+   * @return {*}
+   */
+  setClusterStatus: function(newValue){
+    if (newValue) {
       //setter
       if (newValue.clusterState) {
         this.set('clusterState', newValue.clusterState);
@@ -107,11 +105,19 @@ App.clusterStatus = Ember.Object.create(
           console.log('BeforeSend: persistKeyValues', keyValuePair);
         }
       });
-
       return newValue;
-
     }
-
-  }.property('clusterName', 'clusterState', 'localdb')
+  },
+  /**
+   * general info about cluster
+   */
+  value: function () {
+      return {
+        clusterName: this.get('clusterName'),
+        clusterState: this.get('clusterState'),
+        wizardControllerName: this.get('wizardControllerName'),
+        localdb: this.get('localdb')
+      };
+  }.property('clusterName', 'clusterState', 'localdb', 'wizardControllerName')
 
 });
\ No newline at end of file

Modified: incubator/ambari/trunk/ambari-web/app/router.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/router.js?rev=1435458&r1=1435457&r2=1435458&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/router.js (original)
+++ incubator/ambari/trunk/ambari-web/app/router.js Sat Jan 19 01:55:53 2013
@@ -251,6 +251,7 @@ App.Router = Em.Router.extend({
     if (App.alwaysGoToInstaller) {
       return 'installer';
     }
+    App.clusterStatus.updateFromServer();
     var clusterStatusOnServer = App.clusterStatus.get('value');
     if (clusterStatusOnServer && (clusterStatusOnServer.clusterState === 'CLUSTER_STARTED_5'
|| clusterStatusOnServer.clusterState === 'ADD_HOSTS_COMPLETED_5' )) {
       return 'main.index';

Modified: incubator/ambari/trunk/ambari-web/app/routes/add_host_routes.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/add_host_routes.js?rev=1435458&r1=1435457&r2=1435458&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/add_host_routes.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/add_host_routes.js Sat Jan 19 01:55:53 2013
@@ -49,7 +49,7 @@ module.exports = Em.Route.extend({
           this.fitHeight();
         }
       });
-
+      App.clusterStatus.updateFromServer();
       var currentClusterStatus = App.clusterStatus.get('value');
 
       if (currentClusterStatus) {
@@ -206,7 +206,7 @@ module.exports = Em.Route.extend({
       addHostController.setInfoForStep9();
 
       // We need to do recovery based on whether we are in Add Host or Installer wizard
-      App.clusterStatus.set('value', {
+      App.clusterStatus.setClusterStatus({
         clusterName: this.get('clusterName'),
         clusterState: 'ADD_HOSTS_INSTALLING_3',
         wizardControllerName: App.router.get('addHostController.name'),
@@ -240,7 +240,7 @@ module.exports = Em.Route.extend({
           addHostController.installServices(isRetry);
           addHostController.setInfoForStep9();
           // We need to do recovery based on whether we are in Add Host or Installer wizard
-          App.clusterStatus.set('value', {
+          App.clusterStatus.setClusterStatus({
             clusterName: this.get('clusterName'),
             clusterState: 'ADD_HOSTS_INSTALLING_3',
             wizardControllerName: App.router.get('addHostController.name'),
@@ -259,7 +259,7 @@ module.exports = Em.Route.extend({
       addHostController.saveInstalledHosts(wizardStep9Controller);
 
       // We need to do recovery based on whether we are in Add Host or Installer wizard
-      App.clusterStatus.set('value', {
+      App.clusterStatus.setClusterStatus({
         clusterName: this.get('clusterName'),
         clusterState: 'ADD_HOSTS_INSTALLED_4',
         wizardControllerName: App.router.get('addHostController.name'),
@@ -291,7 +291,7 @@ module.exports = Em.Route.extend({
 
 
         // We need to do recovery based on whether we are in Add Host or Installer wizard
-        App.clusterStatus.set('value', {
+        App.clusterStatus.setClusterStatus({
           clusterName: this.get('clusterName'),
           clusterState: 'ADD_HOSTS_COMPLETED_5',
           wizardControllerName: App.router.get('addHostController.name'),

Modified: incubator/ambari/trunk/ambari-web/app/routes/installer.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/installer.js?rev=1435458&r1=1435457&r2=1435458&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/installer.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/installer.js Sat Jan 19 01:55:53 2013
@@ -38,6 +38,7 @@ module.exports = Em.Route.extend({
         Ember.run.next(function () {
           var installerController = router.get('installerController');
 
+            App.clusterStatus.updateFromServer();
             var currentClusterStatus = App.clusterStatus.get('value');
 
             if (currentClusterStatus) {
@@ -287,7 +288,7 @@ module.exports = Em.Route.extend({
       installerController.installServices();
       installerController.setInfoForStep9();
       // We need to do recovery based on whether we are in Add Host or Installer wizard
-      App.clusterStatus.set('value', {
+      App.clusterStatus.setClusterStatus({
         clusterName: this.get('clusterName'),
         clusterState: 'CLUSTER_INSTALLING_3',
         wizardControllerName: App.router.get('installerController.name'),
@@ -319,7 +320,7 @@ module.exports = Em.Route.extend({
           installerController.installServices(isRetry);
           installerController.setInfoForStep9();
           // We need to do recovery based on whether we are in Add Host or Installer wizard
-          App.clusterStatus.set('value', {
+          App.clusterStatus.setClusterStatus({
             clusterName: this.get('clusterName'),
             clusterState: 'CLUSTER_INSTALLING_3',
             wizardControllerName: App.router.get('installerController.name'),
@@ -337,7 +338,7 @@ module.exports = Em.Route.extend({
       var wizardStep9Controller = router.get('wizardStep9Controller');
       installerController.saveInstalledHosts(wizardStep9Controller);
 
-      App.clusterStatus.set('value', {
+      App.clusterStatus.setClusterStatus({
         clusterName: this.get('clusterName'),
         clusterState: 'CLUSTER_INSTALLED_4',
         wizardControllerName: App.router.get('installerController.name'),
@@ -366,7 +367,7 @@ module.exports = Em.Route.extend({
         controller.finish();
 
         // We need to do recovery based on whether we are in Add Host or Installer wizard
-        App.clusterStatus.set('value', {
+        App.clusterStatus.setClusterStatus({
           clusterName: this.get('clusterName'),
           clusterState: 'CLUSTER_STARTED_5',
           wizardControllerName: App.router.get('installerController.name'),

Modified: incubator/ambari/trunk/ambari-web/app/routes/main.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/main.js?rev=1435458&r1=1435457&r2=1435458&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/main.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/main.js Sat Jan 19 01:55:53 2013
@@ -149,6 +149,7 @@ module.exports = Em.Route.extend({
 
     addHost:function (router) {
       if(App.clusterStatus){
+        App.clusterStatus.updateFromServer();
         var currentClusterStatus = App.clusterStatus.get('value');
         if(currentClusterStatus && currentClusterStatus.clusterState=="ADD_HOSTS_COMPLETED_5"){
           // The last time add hosts ran, it left the status



Mime
View raw message