Browse Source

AMBARI-6051 Fixing Add Host and Add Service Wizard issues. (atkach)

atkach 11 năm trước cách đây
mục cha
commit
0eac2f2ad1

+ 1 - 0
ambari-web/app/controllers/installer.js

@@ -36,6 +36,7 @@ App.InstallerController = App.WizardController.extend({
     advancedServiceConfig: null,
     configGroups: [],
     slaveGroupProperties: null,
+    installedHosts: [],
     stacks: null,
     controllerName: 'installerController'
   }),

+ 27 - 51
ambari-web/app/controllers/main/host/add_controller.js

@@ -18,7 +18,6 @@
 
 
 var App = require('app');
-var lazyLoading = require('utils/lazy_loading');
 
 App.AddHostController = App.WizardController.extend({
 
@@ -55,7 +54,8 @@ App.AddHostController = App.WizardController.extend({
     advancedServiceConfig: null,
     controllerName: 'addHostController',
     serviceConfigGroups: null,
-    configGroups: null
+    configGroups: null,
+    installedHosts: null
   }),
 
   /**
@@ -129,6 +129,15 @@ App.AddHostController = App.WizardController.extend({
     console.log('selected services ', serviceNames);
   },
 
+  /**
+   * return slaveComponents bound to hosts
+   * @return {Array}
+   */
+  getSlaveComponentHosts: function () {
+    return this._super().filter(function (component) {
+      return component.isInstalled;
+    });
+  },
 
   /**
    * Load master component hosts data for using in required step controllers
@@ -136,67 +145,41 @@ App.AddHostController = App.WizardController.extend({
    */
   loadSlaveComponentHosts: function () {
     var slaveComponentHosts = this.getDBProperty('slaveComponentHosts');
-    var message = 'AddHostController.loadSlaveComponentHosts: loaded hosts ';
-    var filterFunction = function (component) {
-      return component.isInstalled;
-    };
     if (!slaveComponentHosts) {
-      this.getSlaveComponentHosts(this, 'content.slaveComponentHosts', message, filterFunction);
-    } else {
-      this.set('content.slaveComponentHosts', []);
-      lazyLoading.run({
-        initSize: 20,
-        chunkSize: 50,
-        delay: 50,
-        destination: this.get('content.slaveComponentHosts'),
-        source: slaveComponentHosts,
-        context: this
-      });
-      console.log(message, slaveComponentHosts);
+      slaveComponentHosts = this.getSlaveComponentHosts();
     }
+    this.set("content.slaveComponentHosts", slaveComponentHosts);
+    console.log("AddHostController.loadSlaveComponentHosts: loaded hosts ", slaveComponentHosts);
   },
 
   /**
    * Generate clients list for selected services and save it to model
    */
   saveClients: function () {
-
-    App.ajax.send({
-      name: 'host_components.all',
-      sender: this,
-      data: {
-        clusterName: App.get('clusterName')
-      },
-      success: 'saveClientsSuccessCallBack'
-    });
-
-  },
-
-  saveClientsSuccessCallBack: function (response) {
     var clients = [];
     var serviceComponents = App.StackServiceComponent.find();
+    var clientComponents = [];
+    var dbHosts = this.get('content.hosts');
+
+    for (var hostName in dbHosts) {
+      dbHosts[hostName].hostComponents.forEach(function (componentName) {
+        clientComponents[componentName] = true;
+      }, this);
+    }
+
     this.get('content.services').filterProperty('isSelected').forEach(function (_service) {
       var client = serviceComponents.filterProperty('serviceName', _service.serviceName).findProperty('isClient');
       if (client) {
         clients.push({
           component_name: client.get('componentName'),
           display_name: client.get('displayName'),
-          isInstalled: response.items.filterProperty('HostRoles.component_name', client.get('componentName')).length > 0
+          isInstalled: !!clientComponents[client.get('componentName')]
         });
       }
     }, this);
 
     this.setDBProperty('clientInfo', clients);
-    this.set('content.clients', []);
-    lazyLoading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('content.clients'),
-      source: clients,
-      context: this
-    });
-
+    this.set('content.clients', clients);
     console.log("AddHostController.saveClients: saved list ", clients);
   },
 
@@ -314,15 +297,7 @@ App.AddHostController = App.WizardController.extend({
         var service = componentServiceMap[client.component_name];
         var serviceMatch = selectedServices.findProperty('serviceId', service);
         if (serviceMatch) {
-          lazyLoading.run({
-            initSize: 20,
-            chunkSize: 50,
-            delay: 50,
-            destination: serviceMatch.hosts,
-            source: selectedClientHosts,
-            context: Em.Object.create()
-          });
-          serviceMatch.hosts = serviceMatch.hosts.uniq();
+          serviceMatch.hosts = serviceMatch.hosts.concat(selectedClientHosts).uniq();
         } else {
           var configGroups = this.get('content.configGroups').filterProperty('ConfigGroup.tag', service);
           var configGroupsNames = configGroups.mapProperty('ConfigGroup.group_name').sort();
@@ -372,6 +347,7 @@ App.AddHostController = App.WizardController.extend({
       case '2':
         this.loadServices();
       case '1':
+        this.load('installedHosts');
         this.load('hosts');
         this.load('installOptions');
         this.load('cluster');

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

@@ -18,7 +18,6 @@
 
 
 var App = require('app');
-var lazyLoading = require('utils/lazy_loading');
 App.AddServiceController = App.WizardController.extend({
 
   name: 'addServiceController',
@@ -77,10 +76,12 @@ App.AddServiceController = App.WizardController.extend({
    * Load confirmed hosts.
    * Will be used at <code>Assign Masters(step5)</code> step
    */
-  loadConfirmedHosts: function(){
+  loadConfirmedHosts: function () {
     var hosts = this.getDBProperty('hosts');
 
-    this.set('content.hosts', hosts);
+    if (hosts) {
+      this.set('content.hosts', hosts);
+    }
     console.log('AddServiceController.loadConfirmedHosts: loaded hosts', hosts);
   },
 
@@ -147,48 +148,37 @@ App.AddServiceController = App.WizardController.extend({
    * @param stepController App.WizardStep5Controller
    */
   saveMasterComponentHosts: function (stepController) {
-
-    App.ajax.send({
-      name: 'host_components.all',
-      sender: this,
-      data: {
-        clusterName: App.get('clusterName'),
-        stepController: stepController
-      },
-      success: 'saveMasterComponentHostsSuccessCallback'
-    });
-
-  },
-
-  saveMasterComponentHostsSuccessCallback: function (response, request, data) {
-    var obj = data.stepController.get('selectedServicesMasters');
+    var obj = stepController.get('selectedServicesMasters');
     var masterComponentHosts = [];
+    var installedComponents = App.HostComponent.find();
+
     obj.forEach(function (_component) {
-      masterComponentHosts.push({
-        display_name: _component.display_name,
-        component: _component.component_name,
-        hostName: _component.selectedHost,
-        serviceId: _component.serviceId,
-        isInstalled: response.items.someProperty('HostRoles.component_name', _component.component_name)
-      });
+        masterComponentHosts.push({
+          display_name: _component.display_name,
+          component: _component.component_name,
+          hostName: _component.selectedHost,
+          serviceId: _component.serviceId,
+          isInstalled: installedComponents.someProperty('componentName', _component.component_name)
+        });
     });
 
     console.log("AddServiceController.saveMasterComponentHosts: saved hosts ", masterComponentHosts);
     this.setDBProperty('masterComponentHosts', masterComponentHosts);
-    this.set('content.masterComponentHosts', []);
-    lazyLoading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('content.masterComponentHosts'),
-      source: masterComponentHosts,
-      context: this
-    });
+    this.set('content.masterComponentHosts', masterComponentHosts);
 
     this.set('content.skipMasterStep', this.get('content.masterComponentHosts').everyProperty('isInstalled', true));
     this.get('isStepDisabled').findProperty('step', 2).set('value', this.get('content.skipMasterStep'));
   },
 
+  /**
+   * Load master component hosts data for using in required step controllers
+   */
+  loadMasterComponentHosts: function () {
+    this._super();
+    this.set('content.skipMasterStep', this.get('content.masterComponentHosts').everyProperty('isInstalled', true));
+    this.get('isStepDisabled').findProperty('step', 2).set('value', this.get('content.skipMasterStep'));
+  },
+
   /**
    * Does service have any configs
    * @param {string} serviceName
@@ -235,66 +225,104 @@ App.AddServiceController = App.WizardController.extend({
    */
   loadSlaveComponentHosts: function () {
     var slaveComponentHosts = this.getDBProperty('slaveComponentHosts');
-    var message = 'AddServiceController.loadSlaveComponentHosts: loaded hosts ';
-    this.set('content.slaveComponentHosts', []);
     if(!slaveComponentHosts){
-      this.getSlaveComponentHosts(this, 'content.slaveComponentHosts', message);
-    } else {
-      this.set('content.slaveComponentHosts', []);
-      lazyLoading.run({
-        initSize: 20,
-        chunkSize: 50,
-        delay: 50,
-        destination: this.get('content.slaveComponentHosts'),
-        source: slaveComponentHosts,
-        context: this
-      });
-      console.log(message, slaveComponentHosts);
+      slaveComponentHosts = this.getSlaveComponentHosts();
     }
+    this.set("content.slaveComponentHosts", slaveComponentHosts);
+    console.log("AddServiceController.loadSlaveComponentHosts: loaded hosts ", slaveComponentHosts);
   },
 
   /**
-   * Generate clients list for selected services and save it to model
-   * @param stepController step4WizardController
+   * return slaveComponents bound to hosts
+   * @return {Array}
    */
-  saveClients: function(stepController){
+  getSlaveComponentHosts: function () {
+    var components = this.get('slaveComponents');
+    var result = [];
+    var installedServices = App.Service.find().mapProperty('serviceName');
+    var selectedServices = this.get('content.services').filterProperty('isSelected', true).mapProperty('serviceName');
+    var installedComponentsMap = {};
+    var uninstalledComponents = [];
+    var installedHosts = this.get('content.hosts');
+
+    components.forEach(function (component) {
+      if (installedServices.contains(component.get('serviceName'))) {
+        installedComponentsMap[component.get('componentName')] = [];
+      } else if (selectedServices.contains(component.get('serviceName'))) {
+        uninstalledComponents.push(component);
+      }
+    }, this);
+    installedComponentsMap['HDFS_CLIENT'] = [];
 
-    App.ajax.send({
-      name: 'host_components.all',
-      sender: this,
-      data: {
-        clusterName: App.get('clusterName'),
-        stepController: stepController
-      },
-      success: 'saveClientsSuccessCallback'
+    for (var hostName in installedHosts) {
+      installedHosts[hostName].hostComponents.forEach(function (componentName) {
+        if (installedComponentsMap[componentName]) {
+          installedComponentsMap[componentName].push(hostName);
+        }
+      });
+    }
+
+    for (var componentName in installedComponentsMap) {
+      var name = (componentName === 'HDFS_CLIENT') ? 'CLIENT' : componentName;
+      var component = {
+        componentName: name,
+        displayName: App.format.role(name),
+        hosts: [],
+        isInstalled: true
+      };
+      installedComponentsMap[componentName].forEach(function (hostName) {
+        component.hosts.push({
+          group: "Default",
+          hostName: hostName,
+          isInstalled: true
+        });
+      }, this);
+      result.push(component);
+    }
+
+    uninstalledComponents.forEach(function (component) {
+      var hosts = jQuery.extend(true, [], result.findProperty('componentName', 'DATANODE').hosts);
+      hosts.setEach('isInstalled', false);
+      result.push({
+        componentName: component.get('componentName'),
+        displayName: App.format.role(component.get('componentName')),
+        hosts: hosts,
+        isInstalled: false
+      })
     });
 
+    return result;
   },
 
-  saveClientsSuccessCallback: function (response, request, data) {
+  /**
+   * Generate clients list for selected services and save it to model
+   * @param stepController step4WizardController
+   */
+  saveClients: function(stepController){
     var clients = [];
     var serviceComponents = App.StackServiceComponent.find();
-    data.stepController.get('content').filterProperty('isSelected',true).forEach(function (_service) {
-      var client = serviceComponents.filterProperty('serviceName', _service.serviceName).findProperty('isClient', true);
+    var clientComponents = [];
+    var dbHosts = this.get('content.hosts');
+
+    for (var hostName in dbHosts) {
+      dbHosts[hostName].hostComponents.forEach(function (componentName) {
+        clientComponents[componentName] = true;
+      }, this);
+    }
+
+    this.get('content.services').filterProperty('isSelected').forEach(function (_service) {
+      var client = serviceComponents.filterProperty('serviceName', _service.serviceName).findProperty('isClient');
       if (client) {
-        clients.pushObject({
+        clients.push({
           component_name: client.get('componentName'),
           display_name: client.get('displayName'),
-          isInstalled: response.items.filterProperty('HostRoles.component_name', client.get('componentName')).length > 0
+          isInstalled: !!clientComponents[client.get('componentName')]
         });
       }
     }, this);
 
     this.setDBProperty('clientInfo', clients);
-    this.set('content.clients', []);
-    lazyLoading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('content.clients'),
-      source: clients,
-      context: this
-    });
+    this.set('content.clients', clients);
     console.log("AddServiceController.saveClients: saved list ", clients);
   },
 

+ 38 - 76
ambari-web/app/controllers/wizard.js

@@ -18,7 +18,6 @@
 
 
 var App = require('app');
-var lazyLoading = require('utils/lazy_loading');
 require('models/host');
 
 App.WizardController = Em.Controller.extend(App.LocalStorage, {
@@ -59,6 +58,31 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
     return App.StackServiceComponent.find().filterProperty('isSlave',true);
   }.property('App.router.clusterController.isLoaded'),
 
+  allHosts: function () {
+    var dbHosts = this.get('content.hosts');
+    var hosts = [];
+    var hostComponents = [];
+
+    for (var hostName in dbHosts) {
+      hostComponents = [];
+      dbHosts[hostName].hostComponents.forEach(function (componentName) {
+        hostComponents.push(Em.Object.create({
+          componentName: componentName,
+          displayName: App.format.role(componentName)
+        }));
+      });
+
+      hosts.push(Em.Object.create({
+        hostName: hostName,
+        diskInfo: dbHosts[hostName].disk_info,
+        cpu: dbHosts[hostName].cpu,
+        memory: dbHosts[hostName].memory,
+        hostComponents: hostComponents
+      }))
+    }
+    return hosts;
+  }.property('content.hosts'),
+
   setStepsEnable: function () {
     for (var i = 1; i <= this.totalSteps; i++) {
       var step = this.get('isStepDisabled').findProperty('step', i);
@@ -797,40 +821,18 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
         });
         // if modified configs detected push all service's configs for update
         if (configs.length)
-         lazyLoading.run({
-            initSize: 20,
-            chunkSize: 50,
-            delay: 50,
-            destination: updateServiceConfigProperties,
-            source: serviceConfigProperties.filterProperty('serviceName',_content.get('serviceName')),
-            context: this
-          });
+          updateServiceConfigProperties = updateServiceConfigProperties.concat(serviceConfigProperties.filterProperty('serviceName',_content.get('serviceName')));
         // watch for properties that are not modified but have to be updated
         if (_content.get('configs').someProperty('forceUpdate')) {
           // check for already added modified properties
           if (!updateServiceConfigProperties.findProperty('serviceName', _content.get('serviceName'))) {
-            lazyLoading.run({
-              initSize: 20,
-              chunkSize: 50,
-              delay: 50,
-              destination: updateServiceConfigProperties,
-              source: serviceConfigProperties.filterProperty('serviceName',_content.get('serviceName')),
-              context: this
-            });
+            updateServiceConfigProperties = updateServiceConfigProperties.concat(serviceConfigProperties.filterProperty('serviceName',_content.get('serviceName')));
           }
         }
       }
     }, this);
     this.setDBProperty('serviceConfigProperties', serviceConfigProperties);
-    this.set('content.serviceConfigProperties', []);
-    lazyLoading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('content.serviceConfigProperties'),
-      source: serviceConfigProperties,
-      context: this
-    });
+    this.set('content.serviceConfigProperties', serviceConfigProperties);
     this.setDBProperty('configsToUpdate', updateServiceConfigProperties);
   },
   /**
@@ -873,8 +875,9 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
    * return slaveComponents bound to hosts
    * @return {Array}
    */
-  getSlaveComponentHosts: function (context, property, message, filterFunction) {
+  getSlaveComponentHosts: function () {
     var components = this.get('slaveComponents');
+    var result = [];
     var installedServices = App.Service.find().mapProperty('serviceName');
     var selectedServices = this.get('content.services').filterProperty('isSelected', true).mapProperty('serviceName');
     var installedComponentsMap = {};
@@ -889,33 +892,13 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
     }, this);
     installedComponentsMap['HDFS_CLIENT'] = [];
 
-    App.ajax.send({
-      name: 'host_components.all',
-      sender: this,
-      data: {
-        clusterName: App.get('clusterName'),
-        installedComponentsMap: installedComponentsMap,
-        uninstalledComponents: uninstalledComponents,
-        context: context,
-        property: property,
-        message: message,
-        filterFunction: filterFunction
-      },
-      success: 'getSlaveComponentHostsSuccessCallback'
-    });
-
-  },
-
-  getSlaveComponentHostsSuccessCallback: function (response, request, data) {
-    var result = [];
-
-    response.items.mapProperty('HostRoles').forEach(function (hostComponent) {
-      if (data.installedComponentsMap[hostComponent.component_name]) {
-        data.installedComponentsMap[hostComponent.component_name].push(hostComponent.host_name);
+    App.HostComponent.find().forEach(function (hostComponent) {
+      if (installedComponentsMap[hostComponent.get('componentName')]) {
+        installedComponentsMap[hostComponent.get('componentName')].push(hostComponent.get('host.id'));
       }
     }, this);
 
-    for (var componentName in data.installedComponentsMap) {
+    for (var componentName in installedComponentsMap) {
       var name = (componentName === 'HDFS_CLIENT') ? 'CLIENT' : componentName;
       var component = {
         componentName: name,
@@ -923,7 +906,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
         hosts: [],
         isInstalled: true
       };
-      data.installedComponentsMap[componentName].forEach(function (hostName) {
+      installedComponentsMap[componentName].forEach(function (hostName) {
         component.hosts.push({
           group: "Default",
           hostName: hostName,
@@ -933,7 +916,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
       result.push(component);
     }
 
-    data.uninstalledComponents.forEach(function (component) {
+    uninstalledComponents.forEach(function (component) {
       var hosts = jQuery.extend(true, [], result.findProperty('componentName', 'DATANODE').hosts);
       hosts.setEach('isInstalled', false);
       result.push({
@@ -944,20 +927,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
       })
     });
 
-    if (data.filterFunction) {
-      result = result.filter(data.filterFunction);
-    }
-
-    data.context.set(data.property, []);
-    lazyLoading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: data.context.get(data.property),
-      source: result,
-      context: this
-    });
-    console.log(data.message, result);
+    return result;
   },
   /**
    * Load master component hosts data for using in required step controllers
@@ -984,15 +954,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
    */
   loadClients: function () {
     var clients = this.getDBProperty('clientInfo');
-    this.set('content.clients', []);
-    lazyLoading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('content.clients'),
-      source: clients,
-      context: this
-    });
+    this.set('content.clients', clients);
     console.log(this.get('content.controllerName') + ".loadClients: loaded list ", clients);
   }
 });

+ 14 - 43
ambari-web/app/controllers/wizard/step10_controller.js

@@ -17,7 +17,6 @@
  */
 
 var App = require('app');
-var lazyLoading = require('utils/lazy_loading');
 
 App.WizardStep10Controller = Em.Controller.extend({
 
@@ -57,7 +56,16 @@ App.WizardStep10Controller = Em.Controller.extend({
   loadStep: function () {
     console.log("TRACE: Loading step10: Summary Page");
     this.clearStep();
-    this.loadRegisteredHosts();
+    this.loadInstalledHosts(this.loadRegisteredHosts());
+    var installFlag = true;
+    var startFlag = true;
+    if (this.get('content.controllerName') == 'installerController') {
+      installFlag = this.loadMasterComponents();
+      startFlag = this.loadStartedServices();
+    }
+    if (installFlag && startFlag) {
+      this.loadInstallTime();
+    }
   },
 
   /**
@@ -66,41 +74,14 @@ App.WizardStep10Controller = Em.Controller.extend({
    * @method loadRegisteredHosts
    */
   loadRegisteredHosts: function () {
-    var clusterName = (this.get('content.controllerName') === 'installerController') ? this.get('content.cluster.name') : App.get('clusterName')
-    App.ajax.send({
-      name: 'hosts.all',
-      sender: this,
-      data: {
-        clusterName: clusterName
-      },
-      success: 'loadRegisteredHostsSuccessCallback'
-    });
-  },
-
-  loadRegisteredHostsSuccessCallback: function (response) {
     var masterHosts = this.get('content.masterComponentHosts').mapProperty('hostName').uniq();
-    var slaveHosts = [];
-    lazyLoading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: slaveHosts,
-      source: this.get('content.slaveComponentHosts'),
-      context: Em.Object.create()
-    });
+    var slaveHosts = this.get('content.slaveComponentHosts');
     var hostObj = [];
     slaveHosts.forEach(function (_hosts) {
-      lazyLoading.run({
-        initSize: 20,
-        chunkSize: 50,
-        delay: 50,
-        destination: hostObj,
-        source: _hosts.hosts,
-        context: Em.Object.create()
-      });
+      hostObj = hostObj.concat(_hosts.hosts);
     }, this);
     slaveHosts = hostObj.mapProperty('hostName').uniq();
-    var registeredHosts = response.items.mapProperty('Hosts.host_name').concat(masterHosts.concat(slaveHosts)).uniq();
+    var registeredHosts = App.Host.find().mapProperty('hostName').concat(masterHosts.concat(slaveHosts)).uniq();
     var registerHostsStatement = Em.I18n.t('installer.step10.hostsSummary').format(registeredHosts.length);
     var registerHostsObj = Em.Object.create({
       id: 1,
@@ -110,17 +91,7 @@ App.WizardStep10Controller = Em.Controller.extend({
     });
     this.get('clusterInfo').pushObject(registerHostsObj);
 
-    this.loadInstalledHosts();
-    var installFlag = true;
-    var startFlag = true;
-    if (this.get('content.controllerName') == 'installerController') {
-      installFlag = this.loadMasterComponents();
-      startFlag = this.loadStartedServices();
-    }
-    if (installFlag && startFlag) {
-      this.loadInstallTime();
-    }
-    this.set('isLoaded', true);
+    return registerHostsObj;
   },
 
   /**

+ 14 - 42
ambari-web/app/controllers/wizard/step2_controller.js

@@ -143,53 +143,33 @@ App.WizardStep2Controller = Em.Controller.extend({
     return (this.get('hostsError') || this.get('sshKeyError') || this.get('sshUserError'));
   }.property('hostsError', 'sshKeyError', 'sshUserError'),
 
+  installedHostNames: function () {
+    if (this.get('content.controllerName') === 'addHostController') {
+      return this.get('content.installedHosts').mapProperty('hostName');
+    } else {
+      return [];
+    }
+  }.property('content.controllerName'),
+
   /**
    * Set not installed hosts to the hostNameArr
    * @method updateHostNameArr
    */
   updateHostNameArr: function () {
-    this.set('hostNameArr', []);
-    lazyloading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('hostNameArr'),
-      source: this.get('hostNames').trim().split(new RegExp("\\s+", "g")),
-      context: this
-    });
+    this.set('hostNameArr', this.get('hostNames').trim().split(new RegExp("\\s+", "g")));
     this.parseHostNamesAsPatternExpression();
     this.get('inputtedAgainHostNames').clear();
-    var requestName = (this.get('content.controllerName') == 'installerController') ? 'hosts.all.install' : 'hosts.all';
-    App.ajax.send({
-      name: requestName,
-      sender: this,
-      data: {
-        clusterName: App.get('clusterName')
-      },
-      success: 'updateHostNameArrSuccessCallback'
-    });
-  },
-
-  updateHostNameArrSuccessCallback: function (response) {
-    var installedHostNames = response.items.mapProperty('Hosts.host_name'),
-      tempArr = [],
-      hostNameArr = this.get('hostNameArr');
+    var tempArr = [],
+        hostNameArr = this.get('hostNameArr');
     for (var i = 0; i < hostNameArr.length; i++) {
-      if (!installedHostNames.contains(hostNameArr[i])) {
+      if (!this.get('installedHostNames').contains(hostNameArr[i])) {
         tempArr.push(hostNameArr[i]);
       }
       else {
         this.get('inputtedAgainHostNames').push(hostNameArr[i]);
       }
     }
-    lazyloading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('hostNameArr'),
-      source: tempArr,
-      context: this
-    });
+    this.set('hostNameArr', tempArr);
   },
 
   /**
@@ -338,15 +318,7 @@ App.WizardStep2Controller = Em.Controller.extend({
         hostNames.push(a);
       }
     });
-    this.set('hostNameArr', []);
-    lazyloading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('hostNameArr'),
-      source: hostNames,
-      context: this
-    });
+    this.set('hostNameArr', hostNames);
   },
 
   /**

+ 13 - 89
ambari-web/app/controllers/wizard/step3_controller.js

@@ -95,7 +95,9 @@ App.WizardStep3Controller = Em.Controller.extend({
    * List of installed hostnames
    * @type {string[]}
    */
-  hostsInCluster: [],
+  hostsInCluster: function () {
+    return this.get('content.installedHosts').getEach('hostName');
+  }.property('content.installedHosts'),
 
   /**
    * All hosts warnings
@@ -151,14 +153,6 @@ App.WizardStep3Controller = Em.Controller.extend({
    */
   checksUpdateStatus: null,
 
-  /**
-   * Message about other registered hosts (not included in current registration)
-   * @type {string}
-   */
-  registeredHostsMessage: '',
-
-  /**
-
   /**
    *
    * @method navigateStep
@@ -170,15 +164,7 @@ App.WizardStep3Controller = Em.Controller.extend({
           this.startBootstrap();
         }
       } else {
-        this.set('bootHosts', []);
-        lazyloading.run({
-          initSize: 20,
-          chunkSize: 50,
-          delay: 200,
-          destination: this.get('bootHosts'),
-          source: this.get('hosts'),
-          context: Em.Object.create()
-        });
+        this.set('bootHosts', this.get('hosts'));
         if (App.get('testMode')) {
           this.startHostcheck();
           this.get('bootHosts').setEach('cpu', '2');
@@ -240,15 +226,8 @@ App.WizardStep3Controller = Em.Controller.extend({
         }));
       }
     }
-    this.set('hosts', []);
-    lazyloading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('hosts'),
-      source: hosts,
-      context: this
-    });
+    this.set('hosts', hosts);
+    this.set('isLoaded', true);
   },
 
   /**
@@ -662,59 +641,20 @@ App.WizardStep3Controller = Em.Controller.extend({
    * @method getAllRegisteredHostsCallback
    */
   getAllRegisteredHostsCallback: function (hosts) {
-    App.ajax.send({
-      name: 'hosts.all.install',
-      sender: this,
-      data: {
-        hosts: hosts
-      },
-      success: 'hostsInClusterSuccessCallback',
-      error: ''
-    });
-  },
-
-  hostsInClusterSuccessCallback: function (response, request, data) {
-    this.set('hostsInCluster', []);
-    lazyloading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('hostsInCluster'),
-      source: response.items.getEach('Hosts.host_name'),
-      context: Em.Object.create()
-    });
-    var registeredHosts = [],
-      hostsInCluster = [],
-      addedHosts = [];
-    lazyloading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: addedHosts,
-      source: this.get('bootHosts').getEach('name'),
-      context: Em.Object.create()
-    });
-    data.hosts.items.forEach(function (host) {
+    var registeredHosts = [];
+    var hostsInCluster = this.get('hostsInCluster');
+    var addedHosts = this.get('bootHosts').getEach('name');
+    hosts.items.forEach(function (host) {
       if (!hostsInCluster.contains(host.Hosts.host_name) && !addedHosts.contains(host.Hosts.host_name)) {
         registeredHosts.push(host.Hosts.host_name);
       }
     });
     if (registeredHosts.length) {
       this.set('hasMoreRegisteredHosts', true);
-      this.set('registeredHosts', []);
-      lazyloading.run({
-        initSize: 20,
-        chunkSize: 50,
-        delay: 50,
-        destination: this.get('registeredHosts'),
-        source: registeredHosts,
-        context: this
-      });
-      this.set('registeredHostsMessage', Em.I18n.t('installer.step3.warning.registeredHosts').format(this.get('registeredHosts').length))
+      this.set('registeredHosts', registeredHosts);
     } else {
       this.set('hasMoreRegisteredHosts', false);
       this.set('registeredHosts', '');
-      this.set('isLoaded', true);
     }
   },
 
@@ -1212,29 +1152,13 @@ App.WizardStep3Controller = Em.Controller.extend({
       var self = this;
       return App.showConfirmationPopup(
         function () {
-          self.set('content.hosts', []);
-          lazyloading.run({
-            initSize: 20,
-            chunkSize: 50,
-            delay: 50,
-            destination: self.get('content.hosts'),
-            source: self.get('bootHosts'),
-            context: Em.Object.create()
-          });
+          self.set('content.hosts', self.get('bootHosts'));
           App.router.send('next');
         },
         Em.I18n.t('installer.step3.hostWarningsPopup.hostHasWarnings'));
     }
     else {
-      this.set('content.hosts', []);
-      lazyloading.run({
-        initSize: 20,
-        chunkSize: 50,
-        delay: 50,
-        destination: this.get('content.hosts'),
-        source: this.get('bootHosts'),
-        context: Em.Object.create()
-      });
+      this.set('content.hosts', this.get('bootHosts'));
       App.router.send('next');
     }
     return null;

+ 6 - 25
ambari-web/app/controllers/wizard/step6_controller.js

@@ -342,13 +342,17 @@ App.WizardStep6Controller = Em.Controller.extend({
     return hostNames;
   },
 
-  renderHostNames: function (array) {
+  /**
+   * Load all data needed for this module. Then it automatically renders in template
+   * @method render
+   */
+  render: function () {
     var hostsObj = [],
       masterHosts = [],
       headers = this.get('headers'),
       masterHostNames = this.get('content.masterComponentHosts').mapProperty('hostName').uniq();
 
-    array.forEach(function (_hostName) {
+    this.getHostNames().forEach(function (_hostName) {
       var hasMaster = masterHostNames.contains(_hostName);
 
       var obj = Em.Object.create({
@@ -388,29 +392,6 @@ App.WizardStep6Controller = Em.Controller.extend({
     this.set('isLoaded', true);
   },
 
-  /**
-   * Load all data needed for this module. Then it automatically renders in template
-   * @method render
-   */
-  render: function () {
-    if (this.get('isInstallerWizard') || this.get('isAddHostWizard')) {
-      this.renderHostNames(this.getHostNames());
-    } else {
-      App.ajax.send({
-        name: 'hosts.all',
-        sender: this,
-        data: {
-          clusterName: App.get('clusterName')
-        },
-        success: 'getHostNamesSuccessCallback'
-      });
-    }
-  },
-
-  getHostNamesSuccessCallback: function (response) {
-    this.renderHostNames(response.items.mapProperty('Hosts.host_name'));
-  },
-
   /**
    * Set checked values for slaves checkboxes
    * @param {Array} hostsObj

+ 5 - 39
ambari-web/app/controllers/wizard/step7_controller.js

@@ -18,8 +18,6 @@
 
 var App = require('app');
 var numberUtils = require('utils/number_utils');
-var lazyLoading = require('utils/lazy_loading');
-
 /**
  * By Step 7, we have the following information stored in App.db and set on this
  * controller by the router.
@@ -205,8 +203,7 @@ App.WizardStep7Controller = Em.Controller.extend({
         sender: this,
         data: {
           serviceName: serviceName,
-          serviceConfigsDef: App.config.get('preDefinedServiceConfigs').findProperty('serviceName', serviceName),
-          urlParams: ',hosts'
+          serviceConfigsDef: App.config.get('preDefinedServiceConfigs').findProperty('serviceName', serviceName)
         },
         success: 'loadServiceTagsSuccess'
       });
@@ -293,7 +290,7 @@ App.WizardStep7Controller = Em.Controller.extend({
       name: App.Service.DisplayNames[serviceName] + " Default",
       description: "Default cluster level " + serviceName + " configuration",
       isDefault: true,
-      hosts: [],
+      hosts: defaultConfigGroupHosts,
       parentConfigGroup: null,
       service: Em.Object.create({
         id: serviceName
@@ -303,25 +300,9 @@ App.WizardStep7Controller = Em.Controller.extend({
     });
     if (!selectedConfigGroup) {
       selectedConfigGroup = defaultConfigGroup;
-      lazyLoading.run({
-        initSize: 20,
-        chunkSize: 50,
-        delay: 200,
-        destination: selectedConfigGroup.get('hosts'),
-        source: defaultConfigGroupHosts,
-        context: Em.Object.create()
-      });
     }
     configGroups = configGroups.sortProperty('name');
     configGroups.unshift(defaultConfigGroup);
-    lazyLoading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 200,
-      destination: configGroups.objectAt(0).get('hosts'),
-      source: defaultConfigGroupHosts,
-      context: Em.Object.create()
-    });
     if (App.get('supports.hostOverrides')) {
       service.set('configGroups', configGroups);
       var loadedGroupToOverrideSiteToTagMap = {};
@@ -715,14 +696,7 @@ App.WizardStep7Controller = Em.Controller.extend({
     var installedServiceSites = [];
     this.get('serviceConfigsData').filter(function (service) {
       if (this.get('installedServiceNames').contains(service.serviceName)) {
-        lazyLoading.run({
-          initSize: 20,
-          chunkSize: 50,
-          delay: 50,
-          destination: installedServiceSites,
-          source: service.sites,
-          context: Em.Object.create()
-        });
+        installedServiceSites = installedServiceSites.concat(service.sites);
       }
     }, this);
     installedServiceSites = installedServiceSites.uniq();
@@ -807,7 +781,7 @@ App.WizardStep7Controller = Em.Controller.extend({
    */
   loadConfigGroups: function (serviceConfigGroups) {
     var services = this.get('stepConfigs');
-    var hosts = Em.keys(this.get('wizardController').getDBProperty('hosts'));
+    var hosts = this.get('wizardController.allHosts').mapProperty('hostName');
     services.forEach(function (service) {
       if (service.get('serviceName') === 'MISC') return;
       var serviceRawGroups = serviceConfigGroups.filterProperty('service.id', service.serviceName);
@@ -817,21 +791,13 @@ App.WizardStep7Controller = Em.Controller.extend({
             name: App.Service.DisplayNames[service.serviceName] + " Default",
             description: "Default cluster level " + service.serviceName + " configuration",
             isDefault: true,
-            hosts: [],
+            hosts: Em.copy(hosts),
             service: Em.Object.create({
               id: service.serviceName
             }),
             serviceName: service.serviceName
           })
         ]);
-        lazyLoading.run({
-          initSize: 20,
-          chunkSize: 50,
-          delay: 50,
-          destination: service.get('configGroups').objectAt(0).get('hosts'),
-          source: hosts,
-          context: Em.Object.create()
-        });
       }
       else {
         var defaultGroup = App.ConfigGroup.create(serviceRawGroups.findProperty('isDefault'));

+ 7 - 3
ambari-web/app/templates/main/host/add.hbs

@@ -40,9 +40,13 @@
             </ul>
           </div>
         </div>
-        <div class="wizard-content well span9">
-          {{outlet}}
-        </div>
+          <div class="wizard-content well span9">
+            {{#if view.isLoaded}}
+              {{outlet}}
+            {{else}}
+                <div class="spinner"></div>
+            {{/if}}
+          </div>
       </div>
     </div>
   </div>

+ 23 - 27
ambari-web/app/templates/wizard/step10.hbs

@@ -25,33 +25,29 @@
 <div class="alert alert-info">
   {{t installer.step10.body}}
 </div>
-{{#if controller.isLoaded}}
-  <div id="step10-content" class="well pre-scrollable">
-    <ul>
-      {{#each item in clusterInfo}}
-        <li>
-          <span {{bindAttr class="item.color"}}>{{item.displayStatement}}</span>
-          <ul>
-            {{#each status in item.status}}
-              <li>
-                <span {{bindAttr class="status.color"}}>{{status.displayStatement}}</span>
-                <ul>
-                  {{#each statement in status.statements}}
-                    <li>
-                      <span {{bindAttr class="status.color"}}>{{statement.displayStatement}}</span>
-                    </li>
-                  {{/each}}
-                </ul>
-              </li>
-            {{/each}}
-          </ul>
-        </li>
-      {{/each}}
-    </ul>
-  </div>
-{{else}}
-  <div class="spinner"></div>
-{{/if}}
+<div id="step10-content" class="well pre-scrollable">
+  <ul>
+    {{#each item in clusterInfo}}
+      <li>
+        <span {{bindAttr class="item.color"}}>{{item.displayStatement}}</span>
+        <ul>
+          {{#each status in item.status}}
+            <li>
+              <span {{bindAttr class="status.color"}}>{{status.displayStatement}}</span>
+              <ul>
+                {{#each statement in status.statements}}
+                  <li>
+                    <span {{bindAttr class="status.color"}}>{{statement.displayStatement}}</span>
+                  </li>
+                {{/each}}
+              </ul>
+            </li>
+          {{/each}}
+        </ul>
+      </li>
+    {{/each}}
+  </ul>
+</div>
 <div class="btn-area">
   <a class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}} {{action complete}}>{{t common.complete}} &rarr;</a>
 </div>

+ 117 - 133
ambari-web/app/templates/wizard/step3.hbs

@@ -21,149 +21,133 @@
 
   <p class="alert alert-info">{{t installer.step3.body}}</p>
 
-  {{#if view.isLoaded}}
-    {{#if controller.isLoaded}}
-
-      <div class="box">
-        <div class="box-header">
-          <div class="button-section">
-            <button class="btn btn-primary" {{bindAttr disabled="view.noHostsSelected"}}
-              {{action removeSelectedHosts target="controller" }}><i class="icon-trash icon-white"></i>
-              {{t installer.step3.removeSelected}}
-            </button>
-            {{#unless isRetryDisabled}}
-              <a class="btn btn-primary decommission"
-                 href="#" {{action retrySelectedHosts target="view"}}><i class="icon-repeat icon-white"></i>
-                {{t installer.step3.retryFailed}}
-              </a>
-            {{/unless}}
+  <div class="box">
+    <div class="box-header">
+      <div class="button-section">
+        <button class="btn btn-primary" {{bindAttr disabled="view.noHostsSelected"}}
+          {{action removeSelectedHosts target="controller" }}><i class="icon-trash icon-white"></i>
+          {{t installer.step3.removeSelected}}
+        </button>
+        {{#unless isRetryDisabled}}
+          <a class="btn btn-primary decommission"
+             href="#" {{action retrySelectedHosts target="view"}}><i class="icon-repeat icon-white"></i>
+            {{t installer.step3.retryFailed}}
+          </a>
+        {{/unless}}
 
-            <div id="host-filter" class="pull-right">
-              <ul class="clearfix">
-                <li class="first">{{t common.show}}:</li>
-                {{#each category in view.categories}}
-                  <li {{bindAttr class=":filter-status category.itemClass"}}>
-                    <a {{action selectCategory category target="view"}} href="#">
-                      {{category.label}}
-                    </a>
-                  </li>
-                  {{#unless category.last}}
-                    <li class="divider">|</li>
-                  {{/unless}}
-                {{/each}}
-              </ul>
-            </div>
-          </div>
+        <div id="host-filter" class="pull-right">
+          <ul class="clearfix">
+            <li class="first">{{t common.show}}:</li>
+            {{#each category in view.categories}}
+              <li {{bindAttr class=":filter-status category.itemClass"}}>
+                <a {{action selectCategory category target="view"}} href="#">
+                  {{category.label}}
+                </a>
+              </li>
+              {{#unless category.last}}
+                <li class="divider">|</li>
+              {{/unless}}
+            {{/each}}
+          </ul>
         </div>
+      </div>
+    </div>
 
-        <div class="pre-scrollable" style="max-height: 440px;">
-          <table class="table table-bordered table-striped">
-            <thead>
-            <tr>
-              <th class="tinyspan">
-                {{view Ember.Checkbox checkedBinding="view.pageChecked"}}
-              </th>
-              <th class="span5">{{t common.host}}</th>
-              <!-- retrieved from local storage initially -->
-              <th class="span2">{{t common.progress}}</th>
-              <th class="span2">{{t common.status}}</th>
-              <!-- given by the parsing function that parses data from bootstrap call, dynamically assign the color -->
-              <th class="span2">{{t common.action}}</th>
-              <!-- trash icon -->
-              <!-- retry icon -->
-            </tr>
-            </thead>
-            <tbody>
-            {{#if view.pageContent}}
-              {{#each host in view.pageContent}}
-                {{#view App.WizardHostView categoryBinding="controller.category" hostInfoBinding="host"}}
-                  <td>
-                    {{view Ember.Checkbox checkedBinding="host.isChecked"}}
-                  </td>
-                  <td>
-                    {{host.name}}
-                  </td>
-                  <td>
-                    <div {{bindAttr class="host.bootBarColor host.isBootDone::progress-striped host.isBootDone::active :progress"}}>
-                      <div class="bar" style="width:100%">
-                      </div>
-                    </div>
-                  </td>
-                  <td>
-                    <a href="javascript:void(null)"
-                       data-toggle="modal" {{action hostLogPopup host target="controller"}}><span {{bindAttr class="host.bootStatusColor"}}>{{host.bootStatusForDisplay}}</span></a>
-                  </td>
-                  <td>
-                    <a class="btn btn-mini" {{action remove target="view"}}><i class="icon-trash"></i>
-                      {{t common.remove}}</a>
-                    {{#if view.isRetryable}}<a class="btn btn-mini" {{action retry target="view"}}><i
-                      class="icon-repeat"></i>
-                      {{t common.retry}}</a>{{/if}}
-                  </td>
-                {{/view}}
-              {{/each}}
-            {{else}}
-              <tr>
-                <td colspan="5">
-                  {{t hosts.table.noHosts}}
-                </td>
-              </tr>
-            {{/if}}
-            </tbody>
-          </table>
+    <div class="pre-scrollable" style="max-height: 440px;">
+      <table class="table table-bordered table-striped">
+        <thead>
+        <tr>
+          <th class="tinyspan">
+            {{view Ember.Checkbox checkedBinding="view.pageChecked"}}
+          </th>
+          <th class="span5">{{t common.host}}</th>
+          <!-- retrieved from local storage initially -->
+          <th class="span2">{{t common.progress}}</th>
+          <th class="span2">{{t common.status}}</th>
+          <!-- given by the parsing function that parses data from bootstrap call, dynamically assign the color -->
+          <th class="span2">{{t common.action}}</th>
+          <!-- trash icon -->
+          <!-- retry icon -->
+        </tr>
+        </thead>
+        <tbody>
+          {{#if view.pageContent}}
+            {{#each host in view.pageContent}}
+              {{#view App.WizardHostView categoryBinding="controller.category" hostInfoBinding="host"}}
+              <td>
+                {{view Ember.Checkbox checkedBinding="host.isChecked"}}
+              </td>
+              <td>
+                {{host.name}}
+              </td>
+              <td>
+                <div {{bindAttr class="host.bootBarColor host.isBootDone::progress-striped host.isBootDone::active :progress"}}>
+                  <div class="bar" style="width:100%">
+                  </div>
+                </div>
+              </td>
+              <td>
+                <a href="javascript:void(null)"
+                   data-toggle="modal" {{action hostLogPopup host target="controller"}}><span {{bindAttr class="host.bootStatusColor"}}>{{host.bootStatusForDisplay}}</span></a>
+              </td>
+              <td>
+                <a class="btn btn-mini" {{action remove target="view"}}><i class="icon-trash"></i>
+                  {{t common.remove}}</a>
+                {{#if view.isRetryable}}<a class="btn btn-mini" {{action retry target="view"}}><i
+                    class="icon-repeat"></i>
+                  {{t common.retry}}</a>{{/if}}
+              </td>
+              {{/view}}
+            {{/each}}
+          {{else}}
+          <tr>
+            <td colspan="5">
+              {{t hosts.table.noHosts}}
+            </td>
+          </tr>
+          {{/if}}
+        </tbody>
+      </table>
+    </div>
+    <div id="hosts">
+      <div class="page-bar">
+        <div class="selected-hosts-info pull-left">
+          {{#if view.selectedHostsCount}}
+            <a {{action selectedHostsPopup target="controller"}} href="#">
+              {{view.selectedHostsCount}}
+              {{pluralize view.selectedHostsCount singular="t:hosts.filters.selectedHostInfo" plural="t:hosts.filters.selectedHostsInfo"}}
+            </a>
+            -
+            <a {{action unSelectAll target="view"}} href="#">{{t hosts.filters.clearSelection}}</a>
+          {{/if}}
         </div>
-        <div id="hosts">
-          <div class="page-bar">
-            <div class="selected-hosts-info pull-left">
-              {{#if view.selectedHostsCount}}
-                <a {{action selectedHostsPopup target="controller"}} href="#">
-                  {{view.selectedHostsCount}}
-                  {{pluralize view.selectedHostsCount singular="t:hosts.filters.selectedHostInfo" plural="t:hosts.filters.selectedHostsInfo"}}
-                </a>
-                -
-                <a {{action unSelectAll target="view"}} href="#">{{t hosts.filters.clearSelection}}</a>
-              {{/if}}
-            </div>
-            <div class="items-on-page">
-              <label>{{t common.show}}: {{view view.rowsPerPageSelectView selectionBinding="view.displayLength"}}</label>
-            </div>
-            <div class="info">{{view.paginationInfo}}</div>
-            <div class="paging_two_button">
-              {{view view.paginationFirst}}
-              {{view view.paginationLeft}}
-              {{view view.paginationRight}}
-              {{view view.paginationLast}}
-            </div>
-          </div>
+        <div class="items-on-page">
+          <label>{{t common.show}}: {{view view.rowsPerPageSelectView selectionBinding="view.displayLength"}}</label>
         </div>
-      </div>
-      {{#if hasMoreRegisteredHosts}}
-        <div {{bindAttr class=":alert alert-warn"}}>
-          <a href="#" {{action registeredHostsPopup target="controller"}}>{{controller.registeredHostsMessage}}</a>
+        <div class="info">{{view.paginationInfo}}</div>
+        <div class="paging_two_button">
+          {{view view.paginationFirst}}
+          {{view view.paginationLeft}}
+          {{view view.paginationRight}}
+          {{view view.paginationLast}}
         </div>
-      {{/if}}
-      <div {{bindAttr class=":alert view.status isWarningsBoxVisible::hidden"}}>
-        {{view.message}}
-        <a href="#" {{action hostWarningsPopup warnings target="controller"}}>{{view.linkText}}</a>
-        {{#unless isWarningsLoaded}}
-          <div class="spinner"></div>
-        {{/unless}}
       </div>
-
-    {{else}}
-
-      <div class="spinner"></div>
-
-    {{/if}}
-  {{else}}
-
-    <div class="spinner"></div>
-
+    </div>
+  </div>
+  {{#if hasMoreRegisteredHosts}}
+    <div {{bindAttr class=":alert alert-warn"}}>
+      <a href="#" {{action registeredHostsPopup target="controller"}}>{{view.registeredHostsMessage}}</a>
+    </div>
   {{/if}}
-
+  <div {{bindAttr class=":alert view.status isWarningsBoxVisible::hidden"}}>
+    {{view.message}}
+    <a href="#" {{action hostWarningsPopup warnings target="controller"}}>{{view.linkText}}</a>
+    {{#unless isWarningsLoaded}}
+      <div class="spinner"></div>
+    {{/unless}}
+  </div>
   <div class="btn-area">
     <button class="btn pull-left" {{bindAttr disabled="isRegistrationInProgress"}} {{action back}}>&larr; {{t common.back}}</button>
     <button class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}} {{action submit target="controller"}}>{{t common.next}} &rarr;</button>
   </div>
-
 </div>

+ 51 - 58
ambari-web/app/templates/wizard/step6.hbs

@@ -22,69 +22,62 @@
   {{#if errorMessage}}
     <div class="alert alert-error">{{errorMessage}}</div>
   {{/if}}
-  {{#if controller.isLoaded}}
-    {{#if view.isLoaded}}
-      <div class="pre-scrollable">
-        <table class="table table-striped" id="component_assign_table">
-          <thead>
-          <tr>
-            <th>{{t common.host}}</th>
-            {{#each header in controller.headers}}
 
-              <th>
-                <a href="#" {{bindAttr class="header.allChecked:selected:deselected"}}
-                  {{action "selectAllNodes" header target="controller"}}>{{t all}}</a>&nbsp;|&nbsp;<a href="#" {{bindAttr class="header.noChecked:selected:deselected"}}
+  <div class="pre-scrollable">
+    <table class="table table-striped" id="component_assign_table">
+      <thead>
+        <tr>
+          <th>{{t common.host}}</th>
+          {{#each header in controller.headers}}
+
+            <th>
+              <a href="#" {{bindAttr class="header.allChecked:selected:deselected"}}
+                {{action "selectAllNodes" header target="controller"}}>{{t all}}</a>&nbsp;|&nbsp;<a href="#" {{bindAttr class="header.noChecked:selected:deselected"}}
                 {{action "deselectAllNodes" header target="controller"}}>{{t none}}</a>
-              </th>
+            </th>
 
-            {{/each}}
-          </tr>
-          </thead>
-          <tbody>
-          {{#if view.pageContent}}
-            {{#each host in view.pageContent}}
-              <tr>
-                {{#view App.WizardStep6HostView hostBinding="host" }}
-                  {{host.hostName}}
-                  {{#if host.hasMaster}}
-                    <i class=icon-asterisks>&#10037;</i>
-                  {{/if}}
-                {{/view}}
-                {{#each checkbox in host.checkboxes}}
-                  <td>
-                    <label class="checkbox">
-                      {{#view view.checkboxView checkboxBinding="checkbox"}}
-                        {{checkbox.title}}
-                      {{/view}}
-                    </label>
-                  </td>
-                {{/each}}
-              </tr>
-            {{/each}}
-          {{/if}}
-          </tbody>
-        </table>
+          {{/each}}
+        </tr>
+      </thead>
+      <tbody>
+        {{#if view.pageContent}}
+          {{#each host in view.pageContent}}
+            <tr>
+              {{#view App.WizardStep6HostView hostBinding="host" }}
+                {{host.hostName}}
+                {{#if host.hasMaster}}
+                  <i class=icon-asterisks>&#10037;</i>
+                {{/if}}
+              {{/view}}
+              {{#each checkbox in host.checkboxes}}
+                <td>
+                  <label class="checkbox">
+                    {{#view view.checkboxView checkboxBinding="checkbox"}}
+                      {{checkbox.title}}
+                    {{/view}}
+                  </label>
+                </td>
+              {{/each}}
+            </tr>
+          {{/each}}
+        {{/if}}
+      </tbody>
+    </table>
+  </div>
+  <div id="hosts">
+    <div class="page-bar">
+      <div class="items-on-page">
+        <label>{{t common.show}}: {{view view.rowsPerPageSelectView selectionBinding="view.displayLength"}}</label>
       </div>
-      <div id="hosts">
-        <div class="page-bar">
-          <div class="items-on-page">
-            <label>{{t common.show}}: {{view view.rowsPerPageSelectView selectionBinding="view.displayLength"}}</label>
-          </div>
-          <div class="info">{{view.paginationInfo}}</div>
-          <div class="paging_two_button">
-            {{view view.paginationFirst}}
-            {{view view.paginationLeft}}
-            {{view view.paginationRight}}
-            {{view view.paginationLast}}
-          </div>
-        </div>
+      <div class="info">{{view.paginationInfo}}</div>
+      <div class="paging_two_button">
+        {{view view.paginationFirst}}
+        {{view view.paginationLeft}}
+        {{view view.paginationRight}}
+        {{view view.paginationLast}}
       </div>
-    {{else}}
-      <div class="spinner"></div>
-    {{/if}}
-  {{else}}
-    <div class="spinner"></div>
-  {{/if}}
+    </div>
+  </div>
   <div class="btn-area">
     <a class="btn" {{action back}}>&larr; {{t common.back}}</a>
     <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} &rarr;</a>

+ 109 - 117
ambari-web/app/templates/wizard/step9.hbs

@@ -22,131 +22,123 @@
 
   <p class="alert alert-info">{{t installer.step9.body}}</p>
 
-  {{#if view.isLoaded}}
-
-    <div id="overallProgress">
-        <div class="row-fluid">
-            <div class="span10">
-                <div {{bindAttr class="view.isStepCompleted::progress-striped view.isStepCompleted::active view.barColor :progress"}}>
-                    <div class="bar" {{bindAttr style="view.barWidth"}}>
-                    </div>
-                </div>
-            </div>
-            <div class="span2">{{view.progressMessage}}</div>
+  <div id="overallProgress">
+    <div class="row-fluid">
+      <div class="span10">
+        <div {{bindAttr class="view.isStepCompleted::progress-striped view.isStepCompleted::active view.barColor :progress"}}>
+          <div class="bar" {{bindAttr style="view.barWidth"}}>
+          </div>
         </div>
+      </div>
+      <div class="span2">{{view.progressMessage}}</div>
     </div>
+  </div>
 
-    <div class="box">
-        <div class="box-header">
-            <div class="pull-left">
-              {{#if controller.showRetry}}
-                  <a class="btn btn-primary" href="#" {{action retry}}>
-                      <i class="icon-repeat icon-white"></i>
-                    {{t common.retry}}
-                  </a>
-              {{/if}}
-            </div>
-            <!-- filter by host level -->
-            <div id="host-filter" class="pull-right">
-                <ul class="clearfix">
-                    <li class="first">{{t common.show}}:</li>
-                  {{#each category in view.categories}}
-                      <li {{bindAttr class=":filter-status category.itemClass"}}>
-                          <a {{action selectCategory category target="view"}} href="#">
-                            {{category.label}}
-                          </a>
-                      </li>
-                    {{#unless category.last}}
-                        <li class="divider">|</li>
-                    {{/unless}}
-                  {{/each}}
-                </ul>
-            </div>
-        </div>
-        <div class="pre-scrollable">
-            <table id="deploy-status-by-host" class="table table-bordered table-striped">
-                <thead>
-                <tr>
-                    <th class="host">
-                      {{t common.host}}
-                    </th>
-                    <th class="status">{{t common.status}}</th>
-                    <!--  given by the parsing function that parses data from bootstrap call -->
-                    <th class="message">{{t common.message}}</th>
-                    <!-- retrieved from local storage initially -->
-                </tr>
-                </thead>
+  <div class="box">
+    <div class="box-header">
+      <div class="pull-left">
+        {{#if controller.showRetry}}
+          <a class="btn btn-primary" href="#" {{action retry}}>
+            <i class="icon-repeat icon-white"></i>
+            {{t common.retry}}
+          </a>
+        {{/if}}
+      </div>
+      <!-- filter by host level -->
+      <div id="host-filter" class="pull-right">
+        <ul class="clearfix">
+          <li class="first">{{t common.show}}:</li>
+          {{#each category in view.categories}}
+            <li {{bindAttr class=":filter-status category.itemClass"}}>
+              <a {{action selectCategory category target="view"}} href="#">
+                {{category.label}}
+              </a>
+            </li>
+            {{#unless category.last}}
+              <li class="divider">|</li>
+            {{/unless}}
+          {{/each}}
+        </ul>
+      </div>
+    </div>
+    <div class="pre-scrollable">
+      <table id="deploy-status-by-host" class="table table-bordered table-striped">
+        <thead>
+        <tr>
+          <th class="host">
+            {{t common.host}}
+          </th>
+          <th class="status">{{t common.status}}</th>
+          <!--  given by the parsing function that parses data from bootstrap call -->
+          <th class="message">{{t common.message}}</th>
+          <!-- retrieved from local storage initially -->
+        </tr>
+        </thead>
 
-                <tbody>
-                {{#if view.pageContent}}
-                  {{#each host in view.pageContent}}
-                    {{#view App.HostStatusView objBinding="host" controllerBinding="controller"}}
-                        <td>
-                          {{host.name}}
-                        </td>
-                        <td>
-                            <div class="progress-bar pull-left">
-                                <div {{bindAttr class="view.isHostCompleted::progress-striped view.isHostCompleted::active view.barColor :progress"}}>
-                                    <div class="bar" {{bindAttr style="view.barWidth"}}></div>
-                                </div>
-                            </div>
-                            <div class="progress-percentage pull-left">{{host.progress}}%</div>
-                        </td>
-                        <td>
-                            <a {{bindAttr class="view.isFailed:text-error view.isSuccess:text-success view.isWarning:text-warning"}}
-                                    href="javascript:void(null)"
-                                    data-toggle="modal" {{action hostLogPopup target="view"}}>{{host.message}}</a>
-                        </td>
-                    {{/view}}
-                  {{/each}}
-                {{else}}
-                    <tr>
-                        <td colspan="3"><p>{{t installer.step3.hosts.noHosts}}</p></td>
-                    </tr>
-                {{/if}}
-                </tbody>
-            </table>
-        </div>
-        <div id="hosts">
-            <div class="page-bar">
-                <div class="selected-hosts-info pull-left">
-                  {{view.filteredHostsInfo}}
-                    -
-                    <a {{action showAllHosts target="view"}} href="#">{{t tableView.filters.showAll}}</a>
-                </div>
-                <div class="items-on-page">
-                    <label>{{t common.show}}: {{view view.rowsPerPageSelectView selectionBinding="view.displayLength"}}</label>
-                </div>
-                <div class="info">{{view.paginationInfo}}</div>
-                <div class="paging_two_button">
-                  {{view view.paginationFirst}}
-                  {{view view.paginationLeft}}
-                  {{view view.paginationRight}}
-                  {{view view.paginationLast}}
+        <tbody>
+          {{#if view.pageContent}}
+            {{#each host in view.pageContent}}
+              {{#view App.HostStatusView objBinding="host" controllerBinding="controller"}}
+              <td>
+                {{host.name}}
+              </td>
+              <td>
+                <div class="progress-bar pull-left">
+                  <div {{bindAttr class="view.isHostCompleted::progress-striped view.isHostCompleted::active view.barColor :progress"}}>
+                    <div class="bar" {{bindAttr style="view.barWidth"}}></div>
+                  </div>
                 </div>
-            </div>
-        </div>
+                <div class="progress-percentage pull-left">{{host.progress}}%</div>
+              </td>
+              <td>
+                <a {{bindAttr class="view.isFailed:text-error view.isSuccess:text-success view.isWarning:text-warning"}}
+                    href="javascript:void(null)"
+                    data-toggle="modal" {{action hostLogPopup target="view"}}>{{host.message}}</a>
+              </td>
+              {{/view}}
+            {{/each}}
+          {{else}}
+          <tr>
+            <td colspan="3"><p>{{t installer.step3.hosts.noHosts}}</p></td>
+          </tr>
+          {{/if}}
+        </tbody>
+      </table>
     </div>
-
-    <div>
-      {{#if view.resultMsg}}
-          <p {{bindAttr class="view.resultMsgColor :alert"}}>{{view.resultMsg}}
-            {{#if view.isHostHeartbeatLost}}
-                <a href="javascript:void(null)"
-                   data-toggle="modal" {{action hostWithInstallFailed target="view"}}>{{t common.showDetails}}</a>
-            {{/if}}
-          </p>
-      {{/if}}
-        <div class="btn-area">
-            <button
-                    class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}} {{action submit target="controller"}}>{{t common.next}} &rarr;</button>
+    <div id="hosts">
+      <div class="page-bar">
+        <div class="selected-hosts-info pull-left">
+          {{view.filteredHostsInfo}}
+          -
+          <a {{action showAllHosts target="view"}} href="#">{{t tableView.filters.showAll}}</a>
+        </div>
+        <div class="items-on-page">
+          <label>{{t common.show}}: {{view view.rowsPerPageSelectView selectionBinding="view.displayLength"}}</label>
+        </div>
+        <div class="info">{{view.paginationInfo}}</div>
+        <div class="paging_two_button">
+          {{view view.paginationFirst}}
+          {{view view.paginationLeft}}
+          {{view view.paginationRight}}
+          {{view view.paginationLast}}
         </div>
+      </div>
     </div>
+  </div>
 
-  {{else}}
-
-    <div class="spinner"></div>
-
-  {{/if}}
+  <div>
+    {{#if view.resultMsg}}
+      <p {{bindAttr class="view.resultMsgColor :alert"}}>{{view.resultMsg}}
+        {{#if view.isHostHeartbeatLost}}
+          <a href="javascript:void(null)"
+             data-toggle="modal" {{action hostWithInstallFailed target="view"}}>{{t common.showDetails}}</a>
+        {{/if}}
+      </p>
+    {{/if}}
+    <div class="btn-area">
+      <button
+          class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}} {{action submit target="controller"}}>{{t common.next}} &rarr;</button>
+    </div>
+  </div>
 
 </div>

+ 26 - 17
ambari-web/app/views/main/host/add_view.js

@@ -23,6 +23,8 @@ App.AddHostView = Em.View.extend({
 
   templateName: require('templates/main/host/add'),
 
+  isLoaded: false,
+
   isStep1Disabled: function () {
     return this.isStepDisabled(1);
   }.property('controller.isStepDisabled.@each.value').cacheable(),
@@ -51,34 +53,41 @@ App.AddHostView = Em.View.extend({
     return this.isStepDisabled(7);
   }.property('controller.isStepDisabled.@each.value').cacheable(),
 
- isStepDisabled: function (index) {
+  isStepDisabled: function (index) {
     return this.get('controller.isStepDisabled').findProperty('step', index).get('value');
   },
 
-  didInsertElement: function () {
+  willInsertElement: function () {
+    this.loadHosts();
+  },
+
+  loadHosts: function () {
     App.ajax.send({
-      name: 'hosts.confirmed',
+      name: 'hosts.all',
       sender: this,
-      data: {
-        clusterName: App.get('clusterName')
-      },
-      success: 'loadConfirmedHostsSuccessCallback'
+      data: {},
+      success: 'loadHostsSuccessCallback',
+      error: 'loadHostsErrorCallback'
     });
   },
 
-  loadConfirmedHostsSuccessCallback: function (response) {
-    var hosts = {};
-    response.items.mapProperty('Hosts').forEach(function(item){
-      hosts[item.host_name] = {
-        name: item.host_name,
-        cpu: item.cpu_count,
-        memory: item.total_mem,
-        disk_info: item.disk_info,
+  loadHostsSuccessCallback: function (response) {
+    var hosts = [];
+
+    response.items.forEach(function (item) {
+      hosts.push({
+        hostName: item.Hosts.host_name,
         bootStatus: "REGISTERED",
         isInstalled: true
-      };
+      });
     });
-    this.get('controller').setDBProperty('hosts', hosts);
+    this.get('controller').setDBProperty('installedHosts', hosts);
+    this.set('controller.content.installedHosts', hosts);
+    this.set('isLoaded', true);
+  },
+
+  loadHostsErrorCallback: function(){
+    this.set('isLoaded', true);
   }
 
 });

+ 25 - 14
ambari-web/app/views/main/service/add_view.js

@@ -55,30 +55,41 @@ App.AddServiceView = Em.View.extend({
     return this.get('controller.isStepDisabled').findProperty('step', index).get('value');
   },
 
-  didInsertElement: function () {
+
+  willInsertElement: function () {
+    this.loadHosts();
+  },
+
+  loadHosts: function () {
     App.ajax.send({
       name: 'hosts.confirmed',
       sender: this,
-      data: {
-        clusterName: App.get('clusterName')
-      },
-      success: 'loadConfirmedHostsSuccessCallback'
+      data: {},
+      success: 'loadHostsSuccessCallback',
+      error: 'loadHostsErrorCallback'
     });
   },
 
-  loadConfirmedHostsSuccessCallback: function (response) {
+  loadHostsSuccessCallback: function (response) {
     var hosts = {};
-    response.items.mapProperty('Hosts').forEach(function(item){
-      hosts[item.host_name] = {
-        name: item.host_name,
-        cpu: item.cpu_count,
-        memory: item.total_mem,
-        disk_info: item.disk_info,
+
+    response.items.forEach(function (item) {
+      hosts[item.Hosts.host_name] = {
+        name: item.Hosts.host_name,
+        cpu: item.Hosts.cpu_count,
+        memory: item.Hosts.total_mem,
+        disk_info: item.Hosts.disk_info,
         bootStatus: "REGISTERED",
-        isInstalled: true
+        isInstalled: true,
+        hostComponents: item.host_components.mapProperty('HostRoles.component_name')
       };
     });
     this.get('controller').setDBProperty('hosts', hosts);
-  }
+    this.set('controller.content.hosts', hosts);
+    this.set('isLoaded', true);
+  },
 
+  loadHostsErrorCallback: function(){
+    this.set('isLoaded', true);
+  }
 });

+ 17 - 16
ambari-web/app/views/wizard/step3_view.js

@@ -18,7 +18,6 @@
 
 
 var App = require('app');
-var lazyLoading = require('utils/lazy_loading');
 
 App.WizardStep3View = App.TableView.extend({
 
@@ -29,19 +28,9 @@ App.WizardStep3View = App.TableView.extend({
    * Same to <code>controller.hosts</code>
    * @type {Ember.Enumerable}
    */
-  content: [],
-
-  contentObserver: function() {
-    this.set('content', []);
-    lazyLoading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('content'),
-      source: this.get('controller.hosts'),
-      context: this
-    });
-  }.observes('controller.hosts.length'),
+  content:function () {
+    return this.get('controller.hosts');
+  }.property('controller.hosts.length'),
 
   /**
    * Message with info about registration result
@@ -69,6 +58,12 @@ App.WizardStep3View = App.TableView.extend({
     return this.get('categories').findProperty('isActive');
   }.property('categories.@each.isActive'),
 
+  /**
+   * Message about other registered hosts (not included in current registration)
+   * @type {string}
+   */
+  registeredHostsMessage: '',
+
   /**
    * Number of visible hosts on page
    * @type {string}
@@ -81,8 +76,6 @@ App.WizardStep3View = App.TableView.extend({
    */
   pageChecked: false,
 
-  isLoaded: false,
-
   /**
    * bootStatus category object
    * @type {Ember.Object}
@@ -172,6 +165,14 @@ App.WizardStep3View = App.TableView.extend({
     this.set('selectedHostsCount', selectedHostsCount);
   },
 
+  /**
+   * Update <code>registeredHostsMessage</code> according to <code>controller.registeredHots.length</code>
+   * @method setRegisteredHosts
+   */
+  setRegisteredHosts: function(){
+    this.set('registeredHostsMessage',Em.I18n.t('installer.step3.warning.registeredHosts').format(this.get('controller.registeredHosts').length));
+  }.observes('controller.registeredHosts'),
+
   /**
    * Call filters and counters one time
    * @method hostBootStatusObserver

+ 3 - 14
ambari-web/app/views/wizard/step6_view.js

@@ -18,7 +18,6 @@
 
 
 var App = require('app');
-var lazyLoading = require('utils/lazy_loading');
 
 App.WizardStep6View = App.TableView.extend({
 
@@ -36,19 +35,9 @@ App.WizardStep6View = App.TableView.extend({
    * List of hosts
    * @type {object[]}
    */
-  content: [],
-
-  contentObserver: function() {
-    this.set('content', []);
-    lazyLoading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('content'),
-      source: this.get('controller.hosts'),
-      context: this
-    });
-  }.observes('controller.hosts.length'),
+  content: function () {
+    return this.get('controller.hosts');
+  }.property('controller.hosts'),
 
   /**
    * Synonym to <code>content</code> in this <code>App.TableView</code>

+ 3 - 16
ambari-web/app/views/wizard/step9_view.js

@@ -18,7 +18,6 @@
 
 var App = require('app');
 var date = require('utils/date');
-var lazyLoading = require('utils/lazy_loading');
 
 App.WizardStep9View = App.TableView.extend({
 
@@ -56,25 +55,13 @@ App.WizardStep9View = App.TableView.extend({
    */
   displayLength: "25",
 
-  isLoaded: false,
-
   /**
    * Same to <code>controller.hosts</code>
    * @type {object[]}
    */
-  content: [],
-
-  contentObserver: function() {
-    this.set('content', []);
-    lazyLoading.run({
-      initSize: 20,
-      chunkSize: 50,
-      delay: 50,
-      destination: this.get('content'),
-      source: this.get('controller.hosts'),
-      context: this
-    });
-  }.observes('controller.hosts.length'),
+  content: function () {
+    return this.get('controller.hosts');
+  }.property('controller.hosts'),
 
   /**
    * Active category