Repository: ambari
Updated Branches:
  refs/heads/trunk 6cfff2107 -> 1e3afa867


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


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1e3afa86
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1e3afa86
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1e3afa86

Branch: refs/heads/trunk
Commit: 1e3afa8678fd9513d77b559b7f8882a6bc15d2f5
Parents: 705a0fb
Author: aBabiichuk <ababiic...@hortonworks.com>
Authored: Wed Apr 29 19:43:07 2015 +0300
Committer: aBabiichuk <ababiic...@hortonworks.com>
Committed: Wed Apr 29 19:59:21 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step9_controller.js  | 17 +++++----
 .../test/controllers/wizard/step9_test.js       | 36 ++++++++++++--------
 2 files changed, 32 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1e3afa86/ambari-web/app/controllers/wizard/step9_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step9_controller.js 
b/ambari-web/app/controllers/wizard/step9_controller.js
index 67ed385..bb557e2 100644
--- a/ambari-web/app/controllers/wizard/step9_controller.js
+++ b/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();
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1e3afa86/ambari-web/test/controllers/wizard/step9_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step9_test.js 
b/ambari-web/test/controllers/wizard/step9_test.js
index d0a895a..71f35a6 100644
--- a/ambari-web/test/controllers/wizard/step9_test.js
+++ b/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;
     });
   });
 

Reply via email to