Browse Source

AMBARI-3529. Yarn+MapReduce installing. (onechiporenko)

Oleg Nechiporenko 11 years ago
parent
commit
ecf65d2319

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

@@ -25,7 +25,7 @@ App.MainServiceController = Em.ArrayController.extend({
       return [];
     }
     return App.Service.find();
-  }.property('App.router.clusterController.isLoaded'),
+  }.property('App.router.clusterController.isLoaded').volatile(),
 
   cluster: function () {
     if (!App.router.get('clusterController.isLoaded')) {

+ 1 - 1
ambari-web/app/router.js

@@ -272,7 +272,7 @@ App.Router = Em.Router.extend({
     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 === 'HIGH_AVAILABILITY_DISABLED' || clusterStatusOnServer.clusterState === 'ADD_SERVICES_COMPLETED_5')) {
       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

+ 11 - 13
ambari-web/app/routes/add_service_routes.js

@@ -31,7 +31,7 @@ module.exports = Em.Route.extend({
         router.get('clusterController').requestHosts(hostsUrl, function () {
           console.log('Request for hosts, with disk_info parameter');
         });
-        App.ModalPopup.show({
+        var popup = App.ModalPopup.show({
           classNames: ['full-width-modal'],
           header:Em.I18n.t('services.add.header'),
           bodyClass:  App.AddServiceView.extend({
@@ -43,19 +43,21 @@ module.exports = Em.Route.extend({
 
           onPrimary:function () {
             this.hide();
-            App.router.get('updateController').set('isWorking', true);
             App.router.transitionTo('main.services.index');
           },
           onClose: function() {
-            this.hide();
             App.router.get('updateController').set('isWorking', true);
+            var self = this;
+            App.router.get('updateController').updateServiceMetric(function(){
+              self.hide();
+            });
             App.router.transitionTo('main.services.index');
           },
           didInsertElement: function(){
             this.fitHeight();
           }
         });
-
+        addServiceController.set('popup',popup);
         App.clusterStatus.updateFromServer();
         var currentClusterStatus = App.clusterStatus.get('value');
 
@@ -286,15 +288,11 @@ module.exports = Em.Route.extend({
     },
     back: Em.Router.transitionTo('step6'),
     complete: function (router, context) {
-      if (true) {   // this function will be moved to installerController where it will validate
-        var addServiceController = router.get('addServiceController');
-        App.router.get('updateController').updateAll();
-        addServiceController.finish();
-        $(context.currentTarget).parents("#modal").find(".close").trigger('click');
-
-        // We need to do recovery based on whether we are in Add Host or Installer wizard
-        addServiceController.saveClusterState('ADD_SERVICES_COMPLETED_5');
-      }
+      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('ADD_SERVICES_COMPLETED_5');
     }
   }),
 

+ 31 - 2
ambari-web/app/views/main/service/menu.js

@@ -26,9 +26,38 @@ App.MainServiceMenuView = Em.CollectionView.extend({
       }
       return true;
     });
-    return items;
-  }.property('App.router.mainServiceController.content'),
+    return this.sortByOrder(this.get('servicesSortOrder'), items);
+  }.property('App.router.mainServiceController.content', 'App.router.mainServiceController.content.length'),
 
+  servicesSortOrder: [
+    'HDFS',
+    'YARN',
+    'MAPREDUCE',
+    'MAPREDUCE2',
+    'TEZ',
+    'HBASE',
+    'HIVE',
+    'HCATALOG',
+    'WEBHCAT',
+    'FLUME',
+    'OOZIE',
+    'GANGLIA',
+    'NAGIOS',
+    'ZOOKEEPER',
+    'PIG',
+    'SQOOP',
+    'HUE'
+  ],
+  sortByOrder: function (sortOrder, array) {
+    var sorted = [];
+    for (var i = 0; i < sortOrder.length; i++)
+      for (var j = 0; j < array.length; j++) {
+        if (sortOrder[i] == array[j].get('id')) {
+          sorted.push(array[j]);
+        }
+      }
+    return sorted;
+  },
 
   didInsertElement:function () {
     App.router.location.addObserver('lastSetURL', this, 'renderOnRoute');