Browse Source

AMBARI-6053 Add Host wizard get stuck on Confirm Hosts step. (atkach)

atkach 11 years ago
parent
commit
0a1aaaa4b6

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

@@ -159,13 +159,13 @@ App.AddHostController = App.WizardController.extend({
     var clients = [];
     var clients = [];
     var serviceComponents = App.StackServiceComponent.find();
     var serviceComponents = App.StackServiceComponent.find();
     var clientComponents = [];
     var clientComponents = [];
-    var dbHosts = this.get('content.hosts');
+    var installedHosts = this.get('content.installedHosts');
 
 
-    for (var hostName in dbHosts) {
-      dbHosts[hostName].hostComponents.forEach(function (componentName) {
+    installedHosts.forEach(function (host) {
+      host.hostComponents.forEach(function (componentName) {
         clientComponents[componentName] = true;
         clientComponents[componentName] = true;
       }, this);
       }, this);
-    }
+    });
 
 
     this.get('content.services').filterProperty('isSelected').forEach(function (_service) {
     this.get('content.services').filterProperty('isSelected').forEach(function (_service) {
       var client = serviceComponents.filterProperty('serviceName', _service.serviceName).findProperty('isClient');
       var client = serviceComponents.filterProperty('serviceName', _service.serviceName).findProperty('isClient');

+ 1 - 1
ambari-web/app/controllers/wizard/step2_controller.js

@@ -145,7 +145,7 @@ App.WizardStep2Controller = Em.Controller.extend({
 
 
   installedHostNames: function () {
   installedHostNames: function () {
     if (this.get('content.controllerName') === 'addHostController') {
     if (this.get('content.controllerName') === 'addHostController') {
-      return this.get('content.installedHosts').mapProperty('hostName');
+      return this.get('content.installedHosts').mapProperty('name');
     } else {
     } else {
       return [];
       return [];
     }
     }

+ 1 - 1
ambari-web/app/controllers/wizard/step3_controller.js

@@ -96,7 +96,7 @@ App.WizardStep3Controller = Em.Controller.extend({
    * @type {string[]}
    * @type {string[]}
    */
    */
   hostsInCluster: function () {
   hostsInCluster: function () {
-    return this.get('content.installedHosts').getEach('hostName');
+    return this.get('content.installedHosts').getEach('name');
   }.property('content.installedHosts'),
   }.property('content.installedHosts'),
 
 
   /**
   /**

+ 11 - 7
ambari-web/app/views/main/host/add_view.js

@@ -63,7 +63,7 @@ App.AddHostView = Em.View.extend({
 
 
   loadHosts: function () {
   loadHosts: function () {
     App.ajax.send({
     App.ajax.send({
-      name: 'hosts.all',
+      name: 'hosts.confirmed',
       sender: this,
       sender: this,
       data: {},
       data: {},
       success: 'loadHostsSuccessCallback',
       success: 'loadHostsSuccessCallback',
@@ -72,17 +72,21 @@ App.AddHostView = Em.View.extend({
   },
   },
 
 
   loadHostsSuccessCallback: function (response) {
   loadHostsSuccessCallback: function (response) {
-    var hosts = [];
+    var installedHosts = [];
 
 
     response.items.forEach(function (item) {
     response.items.forEach(function (item) {
-      hosts.push({
-        hostName: item.Hosts.host_name,
+      installedHosts.push({
+        name: item.Hosts.host_name,
+        cpu: item.Hosts.cpu_count,
+        memory: item.Hosts.total_mem,
+        disk_info: item.Hosts.disk_info,
         bootStatus: "REGISTERED",
         bootStatus: "REGISTERED",
-        isInstalled: true
+        isInstalled: true,
+        hostComponents: item.host_components.mapProperty('HostRoles.component_name')
       });
       });
     });
     });
-    this.get('controller').setDBProperty('installedHosts', hosts);
-    this.set('controller.content.installedHosts', hosts);
+    this.get('controller').setDBProperty('installedHosts', installedHosts);
+    this.set('controller.content.installedHosts', installedHosts);
     this.set('isLoaded', true);
     this.set('isLoaded', true);
   },
   },