Forráskód Böngészése

AMBARI-5136 Installer - Install, Start and Test: list of hosts are disappeared after retry. (atkach)

atkach 11 éve
szülő
commit
03c757c63a

+ 22 - 13
ambari-web/app/controllers/wizard/step9_controller.js

@@ -39,10 +39,9 @@ App.WizardStep9Controller = Em.Controller.extend({
   hosts: [],
 
   /*
-   * Array of above hosts that should be made visible depending upon "Host State Filter" chosen <Possible filter values:
-   * All, In Progress, Warning, Success and Fail>
+   * Indicate whether to show the message(that there are no hosts to display) instead of list of hosts
    */
-  visibleHosts: [],
+  isAnyHostDisplayed: true,
 
   /**
    * overall progress of <Install,Start and Test> page shown as progress bar on the top of the page
@@ -236,16 +235,26 @@ App.WizardStep9Controller = Em.Controller.extend({
    */
   updateVisibleHosts: function () {
     var targetStatus = this.get('category.hostStatus');
-    var visibleHosts = (targetStatus === 'all') ? this.get('hosts') : this.get('hosts').filter(function (_host) {
-      if (targetStatus == 'inProgress') {
-        return (_host.get('status') == 'info' || _host.get('status') == 'pending' || _host.get('status') == 'in_progress');
-      } else if (targetStatus === 'failed') {
-        return (_host.get('status') === 'failed' || _host.get('status') === 'heartbeat_lost');
-      } else {
-        return (_host.get('status') == targetStatus);
-      }
-    }, this);
-    this.set('visibleHosts', visibleHosts);
+    var isAnyHostDisplayed = false;
+    if (targetStatus === 'all') {
+      isAnyHostDisplayed = true;
+      this.get('hosts').setEach('isVisible', true);
+    } else {
+      this.get('hosts').forEach(function (_host) {
+        var isVisible = false;
+        var status = _host.get('status');
+        if (targetStatus == 'inProgress') {
+          isVisible = (status == 'info' || status == 'pending' || status == 'in_progress');
+        } else if (targetStatus === 'failed') {
+          isVisible = (status === 'failed' || status === 'heartbeat_lost');
+        } else {
+          isVisible = (status == targetStatus);
+        }
+        isAnyHostDisplayed = (isAnyHostDisplayed || isVisible);
+        _host.set('isVisible', isVisible);
+      }, this)
+    }
+    this.set('isAnyHostDisplayed', isAnyHostDisplayed);
   }.observes('category'),
 
   /**

+ 3 - 3
ambari-web/app/templates/wizard/step9.hbs

@@ -75,9 +75,9 @@
         </thead>
 
         <tbody>
-        {{#if controller.visibleHosts.length}}
-          {{#each host in controller.visibleHosts}}
-            {{#view App.HostStatusView objBinding="host" controllerBinding="controller"}}
+        {{#if isAnyHostDisplayed}}
+          {{#each host in hosts}}
+            {{#view App.HostStatusView objBinding="host" controllerBinding="controller" classBinding="host.isVisible::hidden"}}
               <td>
                 {{host.name}}
               </td>