Browse Source

AMBARI-10840 Exception appears on clicking retry button (sometimes). (ababiichuk)

aBabiichuk 10 năm trước cách đây
mục cha
commit
1e3afa8678

+ 10 - 7
ambari-web/app/controllers/wizard/step9_controller.js

@@ -45,13 +45,13 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
    */
   progress: '0',
 
-  /*
+  /**
    * Json file for the mock data to be used in mock mode
    * @type {string}
    */
   mockDataPrefix: '/data/wizard/deploy/5_hosts',
 
-  /*
+  /**
    * Current Request data polled from the API: api/v1/clusters/{clusterName}/requests/{RequestId}?fields=tasks/Tasks/command,
    * tasks/Tasks/exit_code,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,
    * tasks/Tasks/status&minimal_response=true
@@ -59,7 +59,7 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
    */
   polledData: [],
 
-  /*
+  /**
    * This flag is only used in UI mock mode as a counter for number of polls.
    * @type {number}
    */
@@ -89,7 +89,7 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
    */
   startCallFailed: false,
 
-  /*
+  /**
    * Status of the page. Possible values: <info, warning, failed and success>.
    * This property is used in the step-9 view for displaying the appropriate color of the overall progress bar and
    * the appropriate result message at the bottom of the page
@@ -130,7 +130,7 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
     }
   }.observes('content.cluster.status', 'content.controllerName'),
 
-  /*
+  /**
    * Computed property to determine if the Retry button should be made visible on the page.
    * @type {bool}
    */
@@ -829,7 +829,10 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
       if (this.get('status') === 'failed') {
         clusterStatus.status = 'INSTALL FAILED';
         this.saveClusterStatus(clusterStatus);
-        this.set('progress', '100');
+        this.setProperties({
+          progress: '100',
+          isPolling: false
+        });
         this.get('hosts').forEach(function (host) {
           host.set('progress', '100');
         });
@@ -1142,7 +1145,7 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
       });
       this.set('progress', '100');
       this.saveClusterStatus(clusterStatus);
-    } else if (this.get('content.cluster.status') === 'PENDING') {
+    } else if (this.get('content.cluster.status') === 'PENDING' && this.get('isPolling')) {
       this.launchStartServices();
     }
 

+ 22 - 14
ambari-web/test/controllers/wizard/step9_test.js

@@ -473,14 +473,18 @@ describe('App.InstallerStep9Controller', function () {
           })
         })
       ]);
-      c.set('status', 'failed');
-      c.set('hosts', Em.A([
-        Em.Object.create({
-          progress: 0
-        })
-      ]));
+      c.setProperties({
+        status: 'failed',
+        isPolling: true,
+        hosts: Em.A([
+          Em.Object.create({
+            progress: 0
+          })
+        ])
+      });
       c.setIsServicesInstalled(polledData);
       expect(c.get('progress')).to.equal('100');
+      expect(c.get('isPolling')).to.be.false;
     });
     it('Should return 34% completed', function () {
       var polledData = Em.A([
@@ -495,17 +499,21 @@ describe('App.InstallerStep9Controller', function () {
           })
         })
       ]);
-      c.set('status', '');
-      c.set('hosts', Em.A([
-        Em.Object.create({
-          progress: 0
+      c.setProperties({
+        status: '',
+        isPolling: true,
+        hosts: Em.A([
+          Em.Object.create({
+            progress: 0
+          })
+        ]),
+        content: Em.Object.create({
+          controllerName: 'installerController'
         })
-      ]));
-      c.set('content', Em.Object.create({
-        controllerName: 'installerController'
-      }));
+      });
       c.setIsServicesInstalled(polledData);
       expect(c.get('progress')).to.equal('34');
+      expect(c.get('isPolling')).to.be.true;
     });
   });