You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2013/10/29 17:24:16 UTC

git commit: AMBARI-3614. Remove unnecessary or unused cluster statuses. (alexantonenko)

Updated Branches:
  refs/heads/trunk 6f104fb59 -> 1f26f6d3d


AMBARI-3614. Remove unnecessary or unused cluster statuses. (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 1f26f6d3d64db09f14a1232c7fb9c4810343dbd2
Parents: 6f104fb
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Oct 29 18:21:42 2013 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue Oct 29 18:21:42 2013 +0200

----------------------------------------------------------------------
 .../highAvailability/progress_controller.js     |  2 +-
 .../wizard/stack_upgrade/step3_controller.js    |  2 +-
 ambari-web/app/models/cluster_states.js         | 30 ++++++++++++++++----
 ambari-web/app/router.js                        |  5 +---
 ambari-web/app/routes/add_host_routes.js        |  2 +-
 ambari-web/app/routes/add_security.js           |  2 +-
 ambari-web/app/routes/add_service_routes.js     |  2 +-
 ambari-web/app/routes/installer.js              |  4 +--
 ambari-web/app/routes/main.js                   | 12 +-------
 ambari-web/app/routes/reassign_master_routes.js |  4 +--
 ambari-web/app/routes/rollbackHA_routes.js      |  2 +-
 ambari-web/app/routes/stack_upgrade.js          |  2 +-
 12 files changed, 37 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
index 7baab66..a610ee8 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
@@ -149,7 +149,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
         App.router.get('updateController').set('isWorking', true);
         App.clusterStatus.setClusterStatus({
           clusterName: App.router.get('content.cluster.name'),
-          clusterState: 'HIGH_AVAILABILITY_DISABLED',
+          clusterState: 'DEFAULT',
           wizardControllerName: App.router.get('highAvailabilityRollbackController.name'),
           localdb: App.db.data
         });

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/ambari-web/app/controllers/wizard/stack_upgrade/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/stack_upgrade/step3_controller.js b/ambari-web/app/controllers/wizard/stack_upgrade/step3_controller.js
index 168b271..e05bee2 100644
--- a/ambari-web/app/controllers/wizard/stack_upgrade/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/stack_upgrade/step3_controller.js
@@ -74,7 +74,7 @@ App.StackUpgradeStep3Controller = Em.Controller.extend({
    * - STACK_UPGRADING,
    * - STACK_UPGRADE_FAILED,
    * - STACK_UPGRADED,
-   * - STACK_UPGRADE_COMPLETED
+   * - DEFAULT = STACK UPGRADE COMPLETED
    */
   saveClusterStatus: function(clusterStatus){
     var oldStatus = this.get('content.cluster');

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/ambari-web/app/models/cluster_states.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/cluster_states.js b/ambari-web/app/models/cluster_states.js
index 62d8cca..806518d 100644
--- a/ambari-web/app/models/cluster_states.js
+++ b/ambari-web/app/models/cluster_states.js
@@ -19,12 +19,30 @@ var App = require('app');
 
 App.clusterStatus = Ember.Object.create({
   clusterName: '',
-  validStates: ['CLUSTER_NOT_CREATED_1', 'CLUSTER_DEPLOY_PREP_2', 'CLUSTER_INSTALLING_3', 'SERVICE_STARTING_3', 'CLUSTER_INSTALLED_4',  'CLUSTER_STARTED_5',
-    'ADD_HOSTS_DEPLOY_PREP_2', 'ADD_HOSTS_INSTALLING_3', 'ADD_HOSTS_INSTALLED_4', 'ADD_HOSTS_COMPLETED_5',
-    'ADD_SERVICES_DEPLOY_PREP_2', 'ADD_SERVICES_INSTALLING_3', 'ADD_SERVICES_INSTALLED_4', 'ADD_SERVICES_COMPLETED_5',
-    'STOPPING_SERVICES', 'STACK_UPGRADING', 'STACK_UPGRADE_FAILED', 'STACK_UPGRADED', 'STACK_UPGRADE_COMPLETED', 'ADD_SECURITY_STEP_1',
-    'ADD_SECURITY_STEP_2', 'ADD_SECURITY_STEP_3', 'ADD_SECURITY_STEP_4', 'DISABLE_SECURITY', 'SECURITY_COMPLETED', 'HIGH_AVAILABILITY_DEPLOY',
-    'HIGH_AVAILABILITY_DISABLED', 'ROLLBACK_HIGH_AVAILABILITY'],
+  validStates: [
+    'DEFAULT',
+    'CLUSTER_NOT_CREATED_1',
+    'CLUSTER_DEPLOY_PREP_2',
+    'CLUSTER_INSTALLING_3',
+    'SERVICE_STARTING_3',
+    'CLUSTER_INSTALLED_4',
+    'ADD_HOSTS_DEPLOY_PREP_2',
+    'ADD_HOSTS_INSTALLING_3',
+    'ADD_HOSTS_INSTALLED_4',
+    'ADD_SERVICES_DEPLOY_PREP_2',
+    'ADD_SERVICES_INSTALLING_3',
+    'ADD_SERVICES_INSTALLED_4',
+    'STOPPING_SERVICES',
+    'STACK_UPGRADING',
+    'STACK_UPGRADE_FAILED',
+    'STACK_UPGRADED',
+    'ADD_SECURITY_STEP_1',
+    'ADD_SECURITY_STEP_2',
+    'ADD_SECURITY_STEP_3',
+    'ADD_SECURITY_STEP_4',
+    'DISABLE_SECURITY',
+    'HIGH_AVAILABILITY_DEPLOY',
+    'ROLLBACK_HIGH_AVAILABILITY'],
   clusterState: 'CLUSTER_NOT_CREATED_1',
   wizardControllerName: null,
   localdb: null,

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 41b0145..fe82b35 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -269,10 +269,7 @@ App.Router = Em.Router.extend({
     }
     App.clusterStatus.updateFromServer();
     var clusterStatusOnServer = App.clusterStatus.get('value');
-    if (!localStorage.getObject('ambari').app.user.admin || clusterStatusOnServer && (clusterStatusOnServer.clusterState === 'CLUSTER_STARTED_5' ||
-      clusterStatusOnServer.clusterState === 'ADD_HOSTS_COMPLETED_5' || clusterStatusOnServer.clusterState === 'STACK_UPGRADE_COMPLETED' ||
-      clusterStatusOnServer.clusterState === 'REASSIGN_MASTER_COMPLETED' || clusterStatusOnServer.clusterState === 'SECURITY_COMPLETED' || clusterStatusOnServer.clusterState === 'HIGH_AVAILABILITY_COMPLETED'
-      || clusterStatusOnServer.clusterState === 'HIGH_AVAILABILITY_DISABLED' || clusterStatusOnServer.clusterState === 'ADD_SERVICES_COMPLETED_5')) {
+    if (!localStorage.getObject('ambari').app.user.admin || clusterStatusOnServer && clusterStatusOnServer.clusterState === 'DEFAULT') {
       return 'main.index';
     } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('addHostController.name')) {
       // if wizardControllerName == "addHostController", then it means someone closed the browser or the browser was crashed when we were last in Add Hosts wizard

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/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 bbc6c93..8a8e00d 100644
--- a/ambari-web/app/routes/add_host_routes.js
+++ b/ambari-web/app/routes/add_host_routes.js
@@ -306,7 +306,7 @@ module.exports = Em.Route.extend({
       $(context.currentTarget).parents("#modal").find(".close").trigger('click');
 
       // We need to do recovery based on whether we are in Add Host or Installer wizard
-      addHostController.saveClusterState('ADD_HOSTS_COMPLETED_5');
+      addHostController.saveClusterState('DEFAULT');
 
       router.transitionTo('main.index');
     }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/ambari-web/app/routes/add_security.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_security.js b/ambari-web/app/routes/add_security.js
index 1f0930c..b7e9236 100644
--- a/ambari-web/app/routes/add_security.js
+++ b/ambari-web/app/routes/add_security.js
@@ -83,7 +83,7 @@ module.exports = Em.Route.extend({
               router.get('addSecurityController').setCurrentStep(1);
               App.clusterStatus.setClusterStatus({
                 clusterName: router.get('content.cluster.name'),
-                clusterState: 'SECURITY_COMPLETED',
+                clusterState: 'DEFAULT',
                 wizardControllerName: router.get('addSecurityController.name'),
                 localdb: App.db.data.AddSecurity
               });

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/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 648fe89..16b113e 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -317,7 +317,7 @@ module.exports = Em.Route.extend({
       addServiceController.get('popup').onClose();
       addServiceController.finish();
       // We need to do recovery based on whether we are in Add Host or Installer wizard
-      addServiceController.saveClusterState('ADD_SERVICES_COMPLETED_5');
+      addServiceController.saveClusterState('DEFAULT');
     }
   }),
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/ambari-web/app/routes/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js
index dd76d45..bf00c44 100644
--- a/ambari-web/app/routes/installer.js
+++ b/ambari-web/app/routes/installer.js
@@ -66,7 +66,7 @@ module.exports = Em.Route.extend({
                 App.db.data = currentClusterStatus.localdb;
                 router.transitionTo('step' + installerController.get('currentStep'));
                 break;
-              case 'CLUSTER_STARTED_5' :
+              case 'DEFAULT' :
               default:
                 router.transitionTo('main.index');
                 break;
@@ -400,7 +400,7 @@ module.exports = Em.Route.extend({
         controller.finish();
 
         // We need to do recovery based on whether we are in Add Host or Installer wizard
-        controller.saveClusterState('CLUSTER_STARTED_5');
+        controller.saveClusterState('DEFAULT');
 
         router.transitionTo('main.index');
       } else {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index fcbfc80..f0e1670 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -531,16 +531,6 @@ 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
-          // in this state. We need to clear any previous status
-          // so that the hosts page starts from fresh.
-          currentClusterStatus.clusterState = 'CLUSTER_STARTED_5';
-        }
-      }
       router.transitionTo('hostAdd');
     }
 
@@ -757,7 +747,7 @@ module.exports = Em.Route.extend({
                   router.get('mainAdminSecurityController').setDisableSecurityStatus(undefined);
                   App.clusterStatus.setClusterStatus({
                     clusterName: router.get('content.cluster.name'),
-                    clusterState: 'SECURITY_COMPLETED',
+                    clusterState: 'DEFAULT',
                     wizardControllerName: router.get('mainAdminSecurityDisableController.name'),
                     localdb: App.db.data.AddSecurity
                   });

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/ambari-web/app/routes/reassign_master_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/reassign_master_routes.js b/ambari-web/app/routes/reassign_master_routes.js
index 0079d92..69c6f2b 100644
--- a/ambari-web/app/routes/reassign_master_routes.js
+++ b/ambari-web/app/routes/reassign_master_routes.js
@@ -189,7 +189,7 @@ module.exports = Em.Route.extend({
         controller.get('popup').hide();
         App.clusterStatus.setClusterStatus({
           clusterName: router.get('reassignMasterController.content.cluster.name'),
-          clusterState: 'REASSIGN_MASTER_COMPLETED',
+          clusterState: 'DEFAULT',
           wizardControllerName: 'reassignMasterController',
           localdb: App.db.data
         });
@@ -253,7 +253,7 @@ module.exports = Em.Route.extend({
         controller.get('popup').hide();
         App.clusterStatus.setClusterStatus({
           clusterName: router.get('reassignMasterController.content.cluster.name'),
-          clusterState: 'REASSIGN_MASTER_COMPLETED',
+          clusterState: 'DEFAULT',
           wizardControllerName: 'reassignMasterController',
           localdb: App.db.data
         });

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/ambari-web/app/routes/rollbackHA_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/rollbackHA_routes.js b/ambari-web/app/routes/rollbackHA_routes.js
index 1203c33..823681b 100644
--- a/ambari-web/app/routes/rollbackHA_routes.js
+++ b/ambari-web/app/routes/rollbackHA_routes.js
@@ -145,7 +145,7 @@ module.exports = Em.Route.extend({
       App.router.get('updateController').set('isWorking', true);
       App.clusterStatus.setClusterStatus({
         clusterName: router.get('content.cluster.name'),
-        clusterState: 'HIGH_AVAILABILITY_DISABLED',
+        clusterState: 'DEFAULT',
         wizardControllerName: 'rollbackHighAvailabilityWizardController',
         localdb: App.db.data
       });

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1f26f6d3/ambari-web/app/routes/stack_upgrade.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/stack_upgrade.js b/ambari-web/app/routes/stack_upgrade.js
index 278993d..f5d0205 100644
--- a/ambari-web/app/routes/stack_upgrade.js
+++ b/ambari-web/app/routes/stack_upgrade.js
@@ -104,7 +104,7 @@ module.exports = Em.Route.extend({
       $(context.currentTarget).parents("#modal").find(".close").trigger('click');
       App.clusterStatus.setClusterStatus({
         clusterName: controller.get('content.cluster.name'),
-        clusterState: 'STACK_UPGRADE_COMPLETED',
+        clusterState: 'DEFAULT',
         wizardControllerName: 'stackUpgradeController',
         localdb: App.db.data
       });