Procházet zdrojové kódy

AMBARI-6738. Add hosts / Enable HA / Enable Security wizards appears instead dashboard after re-login. (jaimin)

Jaimin Jetly před 10 roky
rodič
revize
f67cd91db8

+ 0 - 41
ambari-server/src/main/resources/stacks/HDP/1.3/services/HUE/metainfo.xml

@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-<!--
-   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.
--->
-<metainfo>
-  <schemaVersion>2.0</schemaVersion>
-  <services>
-    <service>
-      <name>HUE</name>
-      <comment>Hue is a graphical user interface to operate and develop
-        applications for Apache Hadoop.</comment>
-      <version>2.2.0.1.3</version>
-
-      <components>
-          <component>
-              <name>HUE_SERVER</name>
-              <category>MASTER</category>
-              <cardinality>1</cardinality>
-          </component>
-      </components>
-
-      <configuration-dependencies>
-        <config-type>global</config-type>
-        <config-type>hue-site</config-type>
-      </configuration-dependencies>
-    </service>
-  </services>
-</metainfo>

+ 1 - 1
ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js

@@ -250,8 +250,8 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
    * Clear all temporary data
    */
   finish: function () {
-    App.db.data.HighAvailabilityWizard = {};
     App.db.data.Installer = {};
+    this.resetDbNamespace();
     App.router.get('updateController').updateAll();
   }
 });

+ 1 - 2
ambari-web/app/controllers/main/admin/highAvailability/resourceManager/wizard_controller.js

@@ -139,8 +139,7 @@ App.RMHighAvailabilityWizardController = App.WizardController.extend({
    * Clear all temporary data
    */
   finish: function () {
-    this.setCurrentStep(1);
-    App.db.data.RMHighAvailabilityWizard = {};
+    this.resetDbNamespace();
     App.router.get('updateController').updateAll();
   }
 });

+ 7 - 0
ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js

@@ -143,6 +143,13 @@ App.AddSecurityController = App.WizardController.extend({
    */
   loadServiceConfigs: function () {
     this.set('content.serviceConfigProperties', App.db.getSecureConfigProperties());
+  },
+
+  /**
+   * Clear all local storage data for Add security wizard namespace
+   */
+  finish: function () {
+    this.resetDbNamespace();
   }
 });
 

+ 2 - 18
ambari-web/app/controllers/main/host/add_controller.js

@@ -367,23 +367,7 @@ App.AddHostController = App.WizardController.extend({
 
   clearStorageData: function () {
     this._super();
-    App.db.cleanAddHost();
-  },
-
-  /**
-   * save the local db data stored on the server as value to the key api/v1/persist/CLUSTER_CURRENT_STATUS
-   */
-  saveClusterState: function () {
-    App.clusterStatus.setClusterStatus({
-      clusterName: App.router.getClusterName(),
-      clusterState: 'DEFAULT'
-    });
-  },
-
-  clearData: function () {
-    // Clear Add Host namespace in Browser Local storage and save it to server persist data
-    this.clearStorageData();
-    this.saveClusterState();
+    this.resetDbNamespace();
   },
 
   /**
@@ -392,7 +376,7 @@ App.AddHostController = App.WizardController.extend({
   finish: function () {
     this.setCurrentStep('1');
     this.clearAllSteps();
-    this.clearData();
+    this.clearStorageData();
     App.router.get('updateController').updateAll();
     App.updater.immediateRun('updateHost');
   },

+ 1 - 1
ambari-web/app/controllers/main/service/add_controller.js

@@ -363,9 +363,9 @@ App.AddServiceController = App.WizardController.extend({
    * Clear all temporary data
    */
   finish: function () {
-    this.setCurrentStep('1');
     this.clearAllSteps();
     this.clearStorageData();
+    this.resetDbNamespace();
     App.router.get('updateController').updateAll();
   },
 

+ 1 - 0
ambari-web/app/controllers/main/service/reassign_controller.js

@@ -306,6 +306,7 @@ App.ReassignMasterController = App.WizardController.extend({
     this.setCurrentStep('1');
     this.clearAllSteps();
     this.clearStorageData();
+    this.resetDbNamespace();
     App.router.get('updateController').updateAll();
   }
 

+ 9 - 0
ambari-web/app/mixins/common/localStorage.js

@@ -53,6 +53,15 @@ App.LocalStorage = Em.Mixin.create({
    */
   setDBProperty: function(key, value){
     App.db.set(this.get('dbNamespace'), key, value);
+  },
+
+  /**
+   * Delete the dbNamespace from the localStorage
+   * Usually this function is called on quiting/completing the wizard
+   */
+  resetDbNamespace: function() {
+    App.db.data[this.get('dbNamespace')] =  {};
+    localStorage.setObject('ambari', App.db.data);
   }
 
 });

+ 9 - 8
ambari-web/app/routes/add_host_routes.js

@@ -21,11 +21,15 @@ var App = require('app');
 module.exports = App.WizardRoute.extend({
   route: '/host/add',
 
-  clearData: function (router) {
+  leaveWizard: function (router,context) {
     var addHostController = router.get('addHostController');
     App.router.get('updateController').set('isWorking', true);
     addHostController.finish();
-    router.transitionTo('hosts.index');
+    App.clusterStatus.setClusterStatus({
+      clusterName: App.router.get('content.cluster.name'),
+      clusterState: 'DEFAULT',
+      localdb: App.db.data
+    }, {alwaysCallback: function() {context.hide();App.router.transitionTo('hosts.index');location.reload();}});
   },
 
   enter: function (router) {
@@ -52,19 +56,17 @@ module.exports = App.WizardRoute.extend({
           router.transitionTo('hosts.index');
         },
         onClose: function() {
+          var popupContext = this;
           if (addHostController.get('currentStep') == '6') {
             App.ModalPopup.show({
               header: Em.I18n.t('hosts.add.exit.header'),
               body: Em.I18n.t('hosts.add.exit.body'),
               onPrimary: function () {
-                this.hide();
-                self.clearData(router);
-                location.reload();
+                self.leaveWizard(router,popupContext);
               }
             });
           } else {
-            this.hide();
-            self.clearData(router);
+            self.leaveWizard(router,this);
           }
         },
         didInsertElement: function(){
@@ -346,7 +348,6 @@ module.exports = App.WizardRoute.extend({
       });
       router.get('updateController').updateAll();
       $(context.currentTarget).parents("#modal").find(".close").trigger('click');
-      location.reload();
     }
   }),
 

+ 5 - 4
ambari-web/app/routes/add_security.js

@@ -73,18 +73,19 @@ module.exports = App.WizardRoute.extend({
               self.proceedOnClose();
             },
             proceedOnClose: function () {
-              this.hide();
+              var self = this;
               router.get('mainAdminSecurityAddStep4Controller').clearStep();
               router.get('addSecurityController.content.services').clear();
               router.set('addSecurityController.content.serviceConfigProperties', null);
               App.router.get('updateController').set('isWorking', true);
               mainAdminSecurityController.setAddSecurityWizardStatus(null);
               App.db.setSecurityDeployCommands(undefined);
-              router.get('addSecurityController').setCurrentStep(1);
+              addSecurityController.finish();
               App.clusterStatus.setClusterStatus({
                 clusterName: router.get('content.cluster.name'),
-                clusterState: 'DEFAULT'
-              },{alwaysCallback: function() {router.transitionTo('adminSecurity.index');location.reload();}});
+                clusterState: 'DEFAULT',
+                localdb: App.db.data
+              },{alwaysCallback: function() {self.hide();router.transitionTo('adminSecurity.index');location.reload();}});
             },
             didInsertElement: function () {
               this.fitHeight();

+ 3 - 6
ambari-web/app/routes/add_service_routes.js

@@ -48,11 +48,11 @@ module.exports = App.WizardRoute.extend({
             App.router.get('updateController').updateServices(function(){
               App.router.get('updateController').updateServiceMetric();
             });
+            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',
-              wizardControllerName: App.router.get('addServiceController.name'),
-              localdb: App.db.data
+              clusterState: 'DEFAULT'
             }, {alwaysCallback: function() {self.hide();App.router.transitionTo('main.services.index');location.reload();}});
 
           },
@@ -324,9 +324,6 @@ module.exports = App.WizardRoute.extend({
     complete: function (router, context) {
       var addServiceController = router.get('addServiceController');
       addServiceController.get('popup').onClose();
-      addServiceController.finish();
-      // We need to do recovery based on whether we are in Add Host or Installer wizard
-      addServiceController.saveClusterState('DEFAULT');
     }
   }),
 

+ 6 - 10
ambari-web/app/routes/high_availability_routes.js

@@ -52,6 +52,7 @@ module.exports = App.WizardRoute.extend({
         }.observes('App.router.highAvailabilityWizardController.currentStep'),
 
         onClose: function () {
+          var self = this;
           var currStep = App.router.get('highAvailabilityWizardController.currentStep');
           var highAvailabilityProgressPageController = App.router.get('highAvailabilityProgressPageController');
 
@@ -63,21 +64,17 @@ module.exports = App.WizardRoute.extend({
               App.router.get('highAvailabilityWizardController').setCurrentStep('1');
               App.router.transitionTo('rollbackHighAvailability');
             }
-          }else {
+          } else {
             var controller = App.router.get('highAvailabilityWizardController');
-            controller.clearStorageData();
-            controller.setCurrentStep('1');
+            controller.clearTasksData();
+            controller.finish();
             App.router.get('updateController').set('isWorking', true);
             App.clusterStatus.setClusterStatus({
-              clusterName: App.router.get('content.cluster.name'),
+              clusterName: controller.get('content.cluster.name'),
               clusterState: 'DEFAULT',
-              wizardControllerName: App.router.get('highAvailabilityWizardController.name'),
               localdb: App.db.data
-            });
-            this.hide();
-            App.router.transitionTo('main.admin.adminHighAvailability');
+            },{alwaysCallback: function() {self.hide();App.router.transitionTo('main.admin.adminHighAvailability');location.reload();}});
           }
-
         },
         didInsertElement: function () {
           this.fitHeight();
@@ -314,7 +311,6 @@ module.exports = App.WizardRoute.extend({
       App.clusterStatus.setClusterStatus({
         clusterName: controller.get('content.cluster.name'),
         clusterState: 'DEFAULT',
-        wizardControllerName: 'highAvailabilityWizardController',
         localdb: App.db.data
       },{alwaysCallback: function() {controller.get('popup').hide();router.transitionTo('main.index');location.reload();}});
     }

+ 1 - 0
ambari-web/app/routes/main.js

@@ -560,6 +560,7 @@ module.exports = Em.Route.extend({
                   App.db.setSecurityDeployCommands(undefined);
                   App.router.get('updateController').set('isWorking', true);
                   router.get('mainAdminSecurityController').setDisableSecurityStatus(undefined);
+                  router.get('addServiceController').finish();
                   App.clusterStatus.setClusterStatus({
                     clusterName: router.get('content.cluster.name'),
                     clusterState: 'DEFAULT'

+ 16 - 22
ambari-web/app/routes/reassign_master_routes.js

@@ -21,8 +21,20 @@ var App = require('app');
 module.exports = App.WizardRoute.extend({
   route: '/service/reassign',
 
+  leaveWizard: function (router,context) {
+    var reassignMasterController = router.get('reassignMasterController');
+    App.router.get('updateController').set('isWorking', true);
+    reassignMasterController.finish();
+    App.clusterStatus.setClusterStatus({
+      clusterName: App.router.get('content.cluster.name'),
+      clusterState: 'DEFAULT',
+      localdb: App.db.data
+    }, {alwaysCallback: function() {context.hide(); router.transitionTo('main.index');location.reload();}});
+  },
+
   enter: function (router) {
     console.log('in /service/reassign:enter');
+    var context = this;
     Em.run.next(function () {
       var reassignMasterController = router.get('reassignMasterController');
       App.router.get('updateController').set('isWorking', false);
@@ -48,23 +60,11 @@ module.exports = App.WizardRoute.extend({
           if (parseInt(currStep) > 3) {
             var self = this;
             App.showConfirmationPopup(function(){
-              self.hide();
-              reassignMasterController.setCurrentStep('1');
               router.get('reassignMasterWizardStep' + currStep + 'Controller').removeObserver('tasks.@each.status', this, 'onTaskStatusChange');
-              App.clusterStatus.setClusterStatus({
-                clusterName: router.get('reassignMasterController.content.cluster.name'),
-                clusterState: 'DEFAULT',
-                wizardControllerName: 'reassignMasterController',
-                localdb: App.db.data
-              });
-              router.get('updateController').set('isWorking', true);
-              router.transitionTo('main.services.index')
+              context.leaveWizard(router,self);
             }, Em.I18n.t('services.reassign.closePopup').format(reassignMasterController.get('content.reassign.display_name')));
           } else {
-            this.hide();
-            reassignMasterController.setCurrentStep('1');
-            router.get('updateController').set('isWorking', true);
-            router.transitionTo('main.services.index')
+            context.leaveWizard(router,this);
           }
         },
         didInsertElement: function () {
@@ -208,11 +208,8 @@ module.exports = App.WizardRoute.extend({
         App.clusterStatus.setClusterStatus({
           clusterName: router.get('reassignMasterController.content.cluster.name'),
           clusterState: 'DEFAULT',
-          wizardControllerName: 'reassignMasterController',
           localdb: App.db.data
-        });
-        router.transitionTo('main.index');
-        location.reload();
+        },{alwaysCallback: function() {controller.get('popup').hide();router.transitionTo('main.index');location.reload();}});
       }
     },
 
@@ -272,11 +269,8 @@ module.exports = App.WizardRoute.extend({
         App.clusterStatus.setClusterStatus({
           clusterName: router.get('reassignMasterController.content.cluster.name'),
           clusterState: 'DEFAULT',
-          wizardControllerName: 'reassignMasterController',
           localdb: App.db.data
-        });
-        router.transitionTo('main.index');
-        location.reload();
+        },{alwaysCallback: function() {controller.get('popup').hide();router.transitionTo('main.index');location.reload();}});
       }
     },
 

+ 13 - 14
ambari-web/app/routes/rm_high_availability_routes.js

@@ -42,17 +42,16 @@ module.exports = App.WizardRoute.extend({
           if (parseInt(currStep) === 4) {
             var self = this;
             App.showConfirmationPopup(function () {
-              self.hide();
-              rMHighAvailabilityWizardController.setCurrentStep('1');
+              router.get('updateController').set('isWorking', true);
               App.clusterStatus.setClusterStatus({
                 clusterName: App.router.getClusterName(),
                 clusterState: 'DEFAULT',
-                wizardControllerName: rMHighAvailabilityWizardController.get('name'),
                 localdb: App.db.data
-              });
-              router.get('updateController').set('isWorking', true);
-              router.transitionTo('main.admin.adminHighAvailability.index');
-              location.reload();
+              }, {alwaysCallback: function () {
+                self.hide();
+                router.transitionTo('main.admin.adminHighAvailability.index');
+                location.reload();
+              }});
             }, Em.I18n.t('admin.rm_highAvailability.closePopup'));
           } else {
             this.hide();
@@ -136,7 +135,7 @@ module.exports = App.WizardRoute.extend({
       controller.setCurrentStep('3');
       controller.dataLoading().done(function () {
         controller.loadAllPriorSteps();
-        controller.connectOutlet('rMHighAvailabilityWizardStep3',  controller.get('content'));
+        controller.connectOutlet('rMHighAvailabilityWizardStep3', controller.get('content'));
       })
     },
     unroutePath: function () {
@@ -160,7 +159,7 @@ module.exports = App.WizardRoute.extend({
       controller.setLowerStepsDisable(4);
       controller.dataLoading().done(function () {
         controller.loadAllPriorSteps();
-        controller.connectOutlet('rMHighAvailabilityWizardStep4',  controller.get('content'));
+        controller.connectOutlet('rMHighAvailabilityWizardStep4', controller.get('content'));
       })
     },
     unroutePath: function () {
@@ -169,15 +168,15 @@ module.exports = App.WizardRoute.extend({
     next: function (router) {
       var controller = router.get('rMHighAvailabilityWizardController');
       controller.finish();
-      controller.get('popup').hide();
       App.clusterStatus.setClusterStatus({
         clusterName: controller.get('content.cluster.name'),
         clusterState: 'DEFAULT',
-        wizardControllerName: 'rMHighAvailabilityWizardController',
         localdb: App.db.data
-      });
-      router.transitionTo('main.admin.adminHighAvailability.index');
-      location.reload();
+      }, {alwaysCallback: function () {
+        controller.get('popup').hide();
+        router.transitionTo('main.admin.adminHighAvailability.index');
+        location.reload();
+      }});
     }
   }),