Explorar o código

AMBARI-1340. Enhance Install/Start/Test progress display. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1442298 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako %!s(int64=12) %!d(string=hai) anos
pai
achega
ce698bdf9b
Modificáronse 2 ficheiros con 18 adicións e 5 borrados
  1. 2 0
      CHANGES.txt
  2. 16 5
      ambari-web/app/controllers/wizard/step9_controller.js

+ 2 - 0
CHANGES.txt

@@ -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)
 

+ 16 - 5
ambari-web/app/controllers/wizard/step9_controller.js

@@ -356,6 +356,12 @@ App.WizardStep9Controller = Em.Controller.extend({
     }
   },
 
+  /**
+   * 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.Controller.extend({
       + 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;