Author: yusaku
Date: Mon Feb  4 18:45:41 2013
New Revision: 1442298

URL: http://svn.apache.org/viewvc?rev=1442298&view=rev
Log:
AMBARI-1340. Enhance Install/Start/Test progress display. (yusaku)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1442298&r1=1442297&r2=1442298&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Mon Feb  4 18:45:41 2013
@@ -38,6 +38,8 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
+ AMBARI-1340. Enhance Install/Start/Test progress display. (yusaku) 
+
  AMBARI-1339. Validate usernames in Misc section of Customize Services step
  in Install Wizard. (yusaku)
 

Modified: 
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js?rev=1442298&r1=1442297&r2=1442298&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js 
(original)
+++ 
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js 
Mon Feb  4 18:45:41 2013
@@ -356,6 +356,12 @@ App.WizardStep9Controller = Em.Controlle
     }
   },
 
+  /**
+   * calculate progress of tasks per host
+   * @param actions
+   * @param contentHost
+   * @return {Number}
+   */
   progressPerHost: function (actions, contentHost) {
     var progress = 0;
     var actionsPerHost = actions.length;
@@ -364,15 +370,20 @@ App.WizardStep9Controller = Em.Controlle
       + actions.filterProperty('Tasks.status', 'FAILED').length
       + actions.filterProperty('Tasks.status', 'ABORTED').length
       + actions.filterProperty('Tasks.status', 'TIMEDOUT').length;
-
-    // for the install phase (PENDING), % completed per host goes up to 33%; 
floor(100 / 3)
-    // for the start phase (INSTALLED), % completed starts from 34%
+    var queuedActions = actions.filterProperty('Tasks.status', 
'QUEUED').length;
+    var inProgressActions = actions.filterProperty('Tasks.status', 
'IN_PROGRESS').length;
+    /** for the install phase (PENDING), % completed per host goes up to 33%; 
floor(100 / 3)
+     * for the start phase (INSTALLED), % completed starts from 34%
+     * when task in queued state means it's completed on 9%
+     * in progress - 35%
+     * completed - 100%
+     */
     switch (this.get('content.cluster.status')) {
       case 'PENDING':
-        progress = Math.floor(((completedActions / actionsPerHost) * 100) / 3);
+        progress = Math.ceil(((queuedActions * 0.09) + (inProgressActions * 
0.35) + completedActions ) / actionsPerHost * 33);
         break;
       case 'INSTALLED':
-        progress = 34 + Math.floor(((completedActions / actionsPerHost) * 100 
* 2) / 3);
+        progress = 34 + Math.ceil(((queuedActions * 0.09) + (inProgressActions 
* 0.35) + completedActions ) / actionsPerHost * 66);
         break;
       default:
         progress = 100;


Reply via email to