Repository: ambari
Updated Branches:
  refs/heads/trunk ccbdc0457 -> f89181b42


AMBARI-6072 Cpu usage widget stuck in loading when data is corrupted, second 
patch. (atkach)


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

Branch: refs/heads/trunk
Commit: f89181b42e9b1c1c86423e4b8e217f036e6b6dc9
Parents: ccbdc04
Author: atkach <[email protected]>
Authored: Wed Jun 25 13:51:33 2014 +0300
Committer: atkach <[email protected]>
Committed: Wed Jun 25 13:51:33 2014 +0300

----------------------------------------------------------------------
 .../app/views/main/dashboard/cluster_metrics/cpu.js     | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f89181b4/ambari-web/app/views/main/dashboard/cluster_metrics/cpu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/cluster_metrics/cpu.js 
b/ambari-web/app/views/main/dashboard/cluster_metrics/cpu.js
index f15d2e7..1917cbb 100644
--- a/ambari-web/app/views/main/dashboard/cluster_metrics/cpu.js
+++ b/ambari-web/app/views/main/dashboard/cluster_metrics/cpu.js
@@ -36,14 +36,24 @@ App.ChartClusterMetricsCPU = 
App.ChartLinearTimeView.extend({
   isTimePagingDisable: true,
   transformToSeries: function (jsonData) {
     var seriesArray = [];
+    var idle = null;
+
     if (jsonData && jsonData.metrics && jsonData.metrics.cpu) {
-      for ( var name in jsonData.metrics.cpu) {
+      for (var name in jsonData.metrics.cpu) {
         var seriesData = jsonData.metrics.cpu[name];
         if (seriesData) {
           var s = this.transformData(seriesData, name);
+          if (name === 'Idle') {
+            //CPU idle metric should be the last in series array
+            idle = s;
+            continue;
+          }
           seriesArray.push(s);
         }
       }
+      if (idle) {
+        seriesArray.push(idle);
+      }
     }
     return seriesArray;
   },

Reply via email to