Pārlūkot izejas kodu

AMBARI-1223. Confirm Hosts page: It looks like hosts disappear if you are on "Fail" filter and click on "Retry Failed" button. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1435446 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 gadi atpakaļ
vecāks
revīzija
bea7c5feec

+ 3 - 0
CHANGES.txt

@@ -17,6 +17,9 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
+ AMBARI-1223. Confirm Hosts page: It looks like hosts disappear if you are
+ on "Fail" filter and click on "Retry Failed" button. (yusaku)
+
  AMBARI-1222. DAG, Jobs Timeline, and Tasks graphs UI cleanup. (yusaku)
 
  AMBARI-1221. There is no default sort order on Hosts table and the order

+ 29 - 4
ambari-web/app/controllers/wizard/step3_controller.js

@@ -245,6 +245,8 @@ App.WizardStep3Controller = Em.Controller.extend({
   },
 
   retrySelectedHosts: function () {
+    //to display all hosts
+    this.set('category', 'All');
     if (!this.get('isRetryDisabled')) {
       this.set('isRetryDisabled', true);
       var selectedHosts = this.get('bootHosts').filterProperty('bootStatus', 'FAILED');
@@ -267,6 +269,28 @@ App.WizardStep3Controller = Em.Controller.extend({
     this.doBootstrap();
   },
 
+  isInstallInProgress: function(){
+    var bootStatuses = this.get('bootHosts').getEach('bootStatus');
+    if(bootStatuses.length &&
+      (bootStatuses.contains('REGISTERING') ||
+        bootStatuses.contains('DONE') ||
+        bootStatuses.contains('RUNNING') ||
+        bootStatuses.contains('PENDING'))){
+      return true;
+    }
+    return false;
+  }.property('bootHosts.@each.bootStatus'),
+
+  disablePreviousSteps: function(){
+    if(this.get('isInstallInProgress')){
+      App.router.get('installerController').setLowerStepsDisable(3);
+      this.set('isSubmitDisabled', true);
+    } else {
+      App.router.get('installerController.isStepDisabled').findProperty('step', 1).set('value', false);
+      App.router.get('installerController.isStepDisabled').findProperty('step', 2).set('value', false);
+    }
+  }.observes('isInstallInProgress'),
+
   doBootstrap: function () {
     if (this.get('stopBootstrap')) {
       return;
@@ -298,10 +322,11 @@ App.WizardStep3Controller = Em.Controller.extend({
             for (var i = 0; i < hosts.length; i++) {
 
               var isValidHost = data.hostsStatus.someProperty('hostName', hosts[i].get('name'));
-
-              if (!isValidHost) {
-                hosts[i].set('bootStatus', 'FAILED');
-                hosts[i].set('bootLog', 'Registration with the server failed.');
+              if(hosts[i].get('bootStatus') !== 'REGISTERED'){
+                if (!isValidHost) {
+                  hosts[i].set('bootStatus', 'FAILED');
+                  hosts[i].set('bootLog', 'Registration with the server failed.');
+                }
               }
             }
           }

+ 2 - 0
ambari-web/app/messages.js

@@ -121,6 +121,8 @@ Em.I18n.translations = {
   'installer.step3.hosts.retry.popup.body':'Are you sure you want to retry discovery of the selected host(s)?',
   'installer.step3.hostInformation.popup.header':'Error in retrieving host Information',
   'installer.step3.hostInformation.popup.body' : 'All bootstrapped hosts registered but unable to retrieve cpu and memory related information',
+  'installer.step3.hosts.noHosts':'No hosts to display',
+
   'installer.step4.header':'Choose Services',
   'installer.step4.body':'Choose which services you want to install on your cluster.',
   'installer.step4.mapreduceCheck.popup.header':'MapReduce Needed',

+ 6 - 1
ambari-web/app/routes/installer.js

@@ -148,7 +148,12 @@ module.exports = Em.Route.extend({
       controller.loadAllPriorSteps();
       controller.connectOutlet('wizardStep3', controller.get('content'));
     },
-    back: Em.Router.transitionTo('step2'),
+    back: function(event){
+      //if install not in progress
+      if(!event.context){
+        Em.Router.transitionTo('step2');
+      }
+    },
     next: function (router, context) {
       var installerController = router.get('installerController');
       var wizardStep3Controller = router.get('wizardStep3Controller');

+ 7 - 2
ambari-web/app/templates/wizard/step3.hbs

@@ -81,7 +81,7 @@
         </thead>
 
         <tbody>
-
+        {{#if visibleHosts.length}}
         {{#each host in visibleHosts}}
         {{#view App.WizardHostView categoryBinding="controller.category" hostInfoBinding="host"}}
         <td>
@@ -108,6 +108,11 @@
         </td>
         {{/view}}
         {{/each}}
+        {{else}}
+        <tr>
+            <td colspan="5"><p>{{t installer.step3.hosts.noHosts}}</p></td>
+        </tr>
+        {{/if}}
 
         </tbody>
 
@@ -120,7 +125,7 @@
     </div>
   </div>
   <div class="btn-area">
-    <a class="btn pull-left" {{action back}}>&larr; Back</a>
+    <a class="btn pull-left" {{bindAttr disabled="isInstallInProgress"}} {{action back isInstallInProgress}}>&larr; Back</a>
     <a class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}} {{action submit target="controller"}}>Next &rarr;</a>
   </div>
 </div>