ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject git commit: AMBARI-6195. Tasks request without response blocks UI (alexantonenko)
Date Wed, 18 Jun 2014 19:12:04 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 2ecfba125 -> 71c521ad1


AMBARI-6195. Tasks request without response blocks UI (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 71c521ad1724f88e517becd72b12b7c9f3436b3e
Parents: 2ecfba1
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Wed Jun 18 22:10:03 2014 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Wed Jun 18 22:10:03 2014 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step9_controller.js  | 40 +++++++-------------
 1 file changed, 14 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/71c521ad/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 88a3e0a..1cf5e8b 100644
--- a/ambari-web/app/controllers/wizard/step9_controller.js
+++ b/ambari-web/app/controllers/wizard/step9_controller.js
@@ -230,32 +230,20 @@ App.WizardStep9Controller = Em.Controller.extend({
       this.set('content.cluster.isCompleted', false);
       this.set('content.cluster.requestId', 1);
     }
+    var needPolling = false;
     var clusterStatus = this.get('content.cluster.status');
     console.log('navigateStep: clusterStatus = ' + clusterStatus);
     if (this.get('content.cluster.isCompleted') === false) {
-      // the cluster has not yet successfully installed and started
-      if (clusterStatus === 'INSTALL FAILED') {
-        this.loadStep();
-        this.loadLogData(this.get('content.cluster.requestId'));
-      } else {
-        if (clusterStatus === 'START FAILED') {
-          this.loadStep();
-          this.loadLogData(this.get('content.cluster.requestId'));
-        }
-        else {
-          // handle PENDING, INSTALLED
-          this.loadStep();
-          this.loadLogData(this.get('content.cluster.requestId'));
-          this.startPolling();
-        }
+      if (clusterStatus !== 'INSTALL FAILED' && clusterStatus !== 'START FAILED')
{
+        needPolling = true;
       }
     } else {
       // handle STARTED
       // the cluster has successfully installed and started
-      this.loadStep();
-      this.loadLogData(this.get('content.cluster.requestId'));
       this.set('progress', '100');
     }
+    this.loadStep();
+    this.loadLogData(needPolling);
   },
 
   /**
@@ -920,14 +908,12 @@ App.WizardStep9Controller = Em.Controller.extend({
    * This function calls API just once to fetch log data of all tasks.
    * @method loadLogData
    */
-  loadLogData: function () {
+  loadLogData: function (startPolling) {
     var requestsId = this.get('wizardController').getDBProperty('cluster').oldRequestsId;
-    requestsId.forEach(function (requestId) {
-      if (App.testMode) {
-        this.set('POLL_INTERVAL', 1);
-      }
-      this.getLogsByRequest(false, requestId);
-    }, this);
+    if (App.testMode) {
+      this.set('POLL_INTERVAL', 1);
+    }
+    this.getLogsByRequest(!!startPolling, requestsId[requestsId.length-1]);
   },
 
   /**
@@ -1002,7 +988,7 @@ App.WizardStep9Controller = Em.Controller.extend({
       },
       success: 'getLogsByRequestSuccessCallback',
       error: 'getLogsByRequestErrorCallback'
-    }).retry({times: App.maxRetries, timeout: App.timeout}).then(null,
+    }).retry({times: App.maxRetries, timeout: 3000}).then(null,
       function () {
         App.showReloadPopup();
         console.log('Install services all retries failed');
@@ -1043,7 +1029,9 @@ App.WizardStep9Controller = Em.Controller.extend({
    * Error-callback for get log by request
    * @method getLogsByRequestErrorCallback
    */
-  getLogsByRequestErrorCallback: Em.K,
+  getLogsByRequestErrorCallback: function () {
+    this.loadLogData(true);
+  },
 
   /**
    * Delegates the function call to {getLogsByRequest} with appropriate params


Mime
View raw message