فهرست منبع

AMBARI-17978. Install page shows in progress tasks in "Waiting" state (akovalenko)

Aleksandr Kovalenko 9 سال پیش
والد
کامیت
fd7b5084b9
2فایلهای تغییر یافته به همراه32 افزوده شده و 28 حذف شده
  1. 25 28
      ambari-web/app/controllers/wizard/step9_controller.js
  2. 7 0
      ambari-web/test/controllers/wizard/step9_test.js

+ 25 - 28
ambari-web/app/controllers/wizard/step9_controller.js

@@ -866,19 +866,11 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
         this.changeParseHostInfo(true);
       } else {
         this.set('progress', '34');
-        if (this.get('content.controllerName') === 'installerController') {
-          this.isAllComponentsInstalled().done(function () {
-            self.saveInstalledHosts(self);
-            self.changeParseHostInfo(true);
-          });
-          return;
-        } else {
-          this.launchStartServices(function () {
-            self.saveInstalledHosts(self);
-            self.changeParseHostInfo(true);
-          });
-          return;
-        }
+        this.isAllComponentsInstalled().done(function () {
+          self.saveInstalledHosts(self);
+          self.changeParseHostInfo(true);
+        });
+        return;
       }
     }
     this.changeParseHostInfo(false);
@@ -1115,21 +1107,17 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
    */
   isAllComponentsInstalled: function () {
     var dfd = $.Deferred();
-    if (this.get('content.controllerName') !== 'installerController' && this.get('content.controllerName') !== 'addHostController') {
+    App.ajax.send({
+      name: 'wizard.step9.installer.get_host_status',
+      sender: this,
+      data: {
+        cluster: this.get('content.cluster.name')
+      },
+      success: 'isAllComponentsInstalledSuccessCallback',
+      error: 'isAllComponentsInstalledErrorCallback'
+    }).complete(function () {
       dfd.resolve();
-    } else {
-      App.ajax.send({
-        name: 'wizard.step9.installer.get_host_status',
-        sender: this,
-        data: {
-          cluster: this.get('content.cluster.name')
-        },
-        success: 'isAllComponentsInstalledSuccessCallback',
-        error: 'isAllComponentsInstalledErrorCallback'
-      }).complete(function(){
-          dfd.resolve();
-      });
-    }
+    });
     return dfd.promise();
   },
 
@@ -1144,7 +1132,13 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
       isStartError: true,
       isCompleted: false
     };
+    var usedHostWithHeartbeatLost = false;
     var hostsWithHeartbeatLost = [];
+    var usedHosts = this.get('content.masterComponentHosts').filterProperty('isInstalled', false).mapProperty('hostName');
+    this.get('content.slaveComponentHosts').forEach(function(component) {
+      usedHosts = usedHosts.concat(component.hosts.filterProperty('isInstalled', false).mapProperty('hostName'));
+    });
+    usedHosts = usedHosts.uniq();
     jsonData.items.filterProperty('Hosts.host_state', 'HEARTBEAT_LOST').forEach(function (host) {
       var hostComponentObj = {hostName: host.Hosts.host_name};
       var componentArr = [];
@@ -1154,9 +1148,12 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
       }, this);
       hostComponentObj.componentNames = stringUtils.getFormattedStringFromArray(componentArr);
       hostsWithHeartbeatLost.pushObject(hostComponentObj);
+      if (!usedHostWithHeartbeatLost && usedHosts.contains(host.Hosts.host_name)) {
+        usedHostWithHeartbeatLost = true;
+      }
     }, this);
     this.set('hostsWithHeartbeatLost', hostsWithHeartbeatLost);
-    if (hostsWithHeartbeatLost.length) {
+    if (usedHostWithHeartbeatLost) {
       this.get('hosts').forEach(function (host) {
         if (hostsWithHeartbeatLost.someProperty(('hostName'), host.get('name'))) {
           host.set('status', 'heartbeat_lost');

+ 7 - 0
ambari-web/test/controllers/wizard/step9_test.js

@@ -1794,6 +1794,13 @@ describe('App.InstallerStep9Controller', function () {
       sinon.stub(c, 'launchStartServices', Em.K);
       sinon.stub(c, 'saveClusterStatus', Em.K);
       c.set('hosts', hosts);
+      c.set('content', Em.Object.create({
+        slaveComponentHosts: [
+          {hosts: [{isInstalled: true, hostName: 'h1'}]},
+          {hosts: [{isInstalled: false, hostName: 'h2'}]}
+        ],
+        masterComponentHosts: []
+      }));
       c.isAllComponentsInstalledSuccessCallback(jsonData);
       this.clusterStatus = c.saveClusterStatus.args[0][0];
     });