Browse Source

AMBARI-10276. Install wizard (step 3): Removing hosts during bootstrap, will case unexpected behaviour (alexantonenko)

Alex Antonenko 10 năm trước cách đây
mục cha
commit
d75309a7b9

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

@@ -68,7 +68,9 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
    * is Retry button disabled
    * @type {bool}
    */
-  isRetryDisabled: true,
+  isRetryDisabled: function() {
+    return (this.get('isBackDisabled')) ? this.get('isBackDisabled') : !this.get('bootHosts').filterProperty('bootStatus', 'FAILED').length;
+  }.property('bootHosts.@each.bootStatus', 'isBackDisabled'),
 
   /**
    * Is Back button disabled
@@ -216,7 +218,6 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
     this.set('registrationStartedAt', null);
     this.set('isLoaded', false);
     this.set('isSubmitDisabled', true);
-    this.set('isRetryDisabled', true);
     this.set('stopChecking', false);
   },
 
@@ -235,10 +236,10 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
     });
     App.router.get(this.get('content.controllerName')).launchBootstrap(bootStrapData, function (requestId) {
       if (requestId == '0') {
-        var controller = App.router.get(App.clusterStatus.wizardControllerName);
-        controller.registerErrPopup(Em.I18n.t('common.information'), Em.I18n.t('installer.step2.evaluateStep.hostRegInProgress'));
+        self.startBootstrap();
       } else if (requestId) {
         self.set('content.installOptions.bootRequestId', requestId);
+        App.router.get(self.get('content.controllerName')).save('installOptions');
         self.startBootstrap();
       }
     });
@@ -325,7 +326,8 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
    * @method removeHost
    */
   removeHost: function (hostInfo) {
-    this.removeHosts([hostInfo]);
+    if (!this.get('isBackDisabled'))
+      this.removeHosts([hostInfo]);
   },
 
   /**
@@ -412,7 +414,6 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
    */
   retrySelectedHosts: function () {
     if (!this.get('isRetryDisabled')) {
-      this.set('isRetryDisabled', true);
       var selectedHosts = this.get('bootHosts').filterProperty('bootStatus', 'FAILED');
       selectedHosts.forEach(function (_host) {
         _host.set('bootStatus', 'DONE');
@@ -1214,7 +1215,6 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
    */
   stopRegistration: function () {
     this.set('isSubmitDisabled', !this.get('bootHosts').someProperty('bootStatus', 'REGISTERED'));
-    this.set('isRetryDisabled', !this.get('bootHosts').someProperty('bootStatus', 'FAILED'));
   },
 
   /**

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

@@ -24,10 +24,12 @@
   <div class="box">
     <div class="box-header">
       <div class="button-section">
-        <button class="btn btn-primary step3-remove-selected-btn" {{bindAttr disabled="view.noHostsSelected"}}
-          {{action removeSelectedHosts target="controller" }}><i class="icon-trash icon-white"></i>
-          {{t installer.step3.removeSelected}}
-        </button>
+        {{#unless isBackDisabled}}
+          <button class="btn btn-primary step3-remove-selected-btn" {{bindAttr disabled="view.noHostsSelected"}}
+            {{action removeSelectedHosts target="controller" }}><i class="icon-trash icon-white"></i>
+            {{t installer.step3.removeSelected}}
+          </button>
+        {{/unless}}
         {{#unless isRetryDisabled}}
           <a class="btn btn-primary decommission"
              href="#" {{action retrySelectedHosts target="view"}}><i class="icon-repeat icon-white"></i>
@@ -91,7 +93,7 @@
                    data-toggle="modal" {{action hostLogPopup host target="controller"}}><span {{bindAttr class="host.bootStatusColor"}}>{{host.bootStatusForDisplay}}</span></a>
               </td>
               <td class="step3-table-action">
-                <a class="btn btn-mini" {{action remove target="view"}}><i class="icon-trash"></i>
+                <a class="btn btn-mini" {{action remove target="view"}}{{bindAttr disabled="isBackDisabled"}}><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>

+ 4 - 5
ambari-web/test/controllers/wizard/step3_test.js

@@ -1083,28 +1083,28 @@ describe('App.WizardStep3Controller', function () {
           Em.Object.create({bootStatus: 'REGISTERED'}),
           Em.Object.create({bootStatus: 'RUNNING'})
         ],
-        e: {isSubmitDisabled: false, isRetryDisabled: true}
+        e: {isSubmitDisabled: false}
       },
       {
         bootHosts: [
           Em.Object.create({bootStatus: 'FAILED'}),
           Em.Object.create({bootStatus: 'RUNNING'})
         ],
-        e: {isSubmitDisabled: true, isRetryDisabled: false}
+        e: {isSubmitDisabled: true}
       },
       {
         bootHosts: [
           Em.Object.create({bootStatus: 'FAILED'}),
           Em.Object.create({bootStatus: 'REGISTERED'})
         ],
-        e: {isSubmitDisabled: false, isRetryDisabled: false}
+        e: {isSubmitDisabled: false}
       },
       {
         bootHosts: [
           Em.Object.create({bootStatus: 'RUNNING'}),
           Em.Object.create({bootStatus: 'RUNNING'})
         ],
-        e: {isSubmitDisabled: true, isRetryDisabled: true}
+        e: {isSubmitDisabled: true}
       }
     ]);
     tests.forEach(function (test) {
@@ -1112,7 +1112,6 @@ describe('App.WizardStep3Controller', function () {
         c.reopen({bootHosts: test.bootHosts});
         c.stopRegistration();
         expect(c.get('isSubmitDisabled')).to.equal(test.e.isSubmitDisabled);
-        expect(c.get('isRetryDisabled')).to.equal(test.e.isRetryDisabled);
       });
     });