You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/08/20 00:38:33 UTC

git commit: AMBARI-2944. Incorrect behavior of some widget's settings popup. (xiwang via yusaku)

Updated Branches:
  refs/heads/trunk 1824b6a88 -> d9ff52e2b


AMBARI-2944. Incorrect behavior of some widget's settings popup. (xiwang via yusaku)


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

Branch: refs/heads/trunk
Commit: d9ff52e2b3e3b1f69a91a49f4d210dce289c363a
Parents: 1824b6a
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Mon Aug 19 15:38:05 2013 -0700
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Mon Aug 19 15:38:05 2013 -0700

----------------------------------------------------------------------
 .../main/dashboard/widgets/hbase_master_heap.js   | 18 ------------------
 .../views/main/dashboard/widgets/hdfs_capacity.js |  7 ++-----
 .../main/dashboard/widgets/jobtracker_heap.js     | 10 ----------
 .../views/main/dashboard/widgets/namenode_cpu.js  |  6 ++----
 .../views/main/dashboard/widgets/namenode_heap.js | 12 ------------
 .../main/dashboard/widgets/pie_chart_widget.js    |  8 +++++---
 .../dashboard/widgets/resource_manager_heap.js    |  3 +--
 .../views/main/dashboard/widgets/yarn_memory.js   |  3 ---
 8 files changed, 10 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d9ff52e2/ambari-web/app/views/main/dashboard/widgets/hbase_master_heap.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hbase_master_heap.js b/ambari-web/app/views/main/dashboard/widgets/hbase_master_heap.js
index b9645ee..e2c6dc3 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hbase_master_heap.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hbase_master_heap.js
@@ -25,30 +25,12 @@ App.HBaseMasterHeapPieChartView = App.PieChartDashboardWidgetView.extend({
   id: '20',
 
   model_type: 'hbase',
-
   modelFieldMax: 'heapMemoryMax',
   modelFieldUsed: 'heapMemoryUsed',
-  hiddenInfo: function () {
-    var heapUsed = this.get('model').get('heapMemoryUsed');
-    var heapMax = this.get('model').get('heapMemoryMax');
-    var percent = heapMax > 0 ? 100 * heapUsed / heapMax : 0;
-    var result = [];
-    result.pushObject(percent.toFixed(1) + '% used');
-    result.pushObject(numberUtils.bytesToSize(heapUsed, 1, "parseFloat") + ' of ' + numberUtils.bytesToSize(heapMax, 1, "parseFloat"));
-    return result;
-  }.property('model.heapMemoryUsed', 'model.heapMemoryMax'),
-
   widgetHtmlId: 'widget-hbase-heap',
 
   didInsertElement: function() {
     this._super();
     this.calc();
-  },
-
-  calcDataForPieChart: function() {
-    var used = this.get('model').get(this.get('modelFieldUsed'));
-    var total = this.get('model').get(this.get('modelFieldMax'));
-    var percent = total > 0 ? ((used)*100 / total).toFixed() : 0;
-    return [ percent, 100 - percent];
   }
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d9ff52e2/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js b/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js
index 9b31557..5a256b7 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js
@@ -25,13 +25,11 @@ App.NameNodeCapacityPieChartView = App.PieChartDashboardWidgetView.extend({
   id: '2',
 
   model_type: 'hdfs',
-
   modelFieldMax: 'capacityTotal',
   /**
    * HDFS model has 'remaining' value, but not 'used'
    */
   modelFieldUsed: 'capacityRemaining',
-
   widgetHtmlId: 'widget-nn-capacity',
 
   didInsertElement: function() {
@@ -40,10 +38,8 @@ App.NameNodeCapacityPieChartView = App.PieChartDashboardWidgetView.extend({
   },
 
   calcHiddenInfo: function () {
-    var text = this.t("dashboard.services.hdfs.capacityUsed");
     var total = this.get('model').get(this.get('modelFieldMax')) + 0;
     var used = total - this.get('model').get(this.get('modelFieldUsed')) + 0;
-    var total = this.get('model.capacityTotal');
     var remaining = this.get('model.capacityRemaining');
     var used = total !== null && remaining !== null ? total - remaining : null;
     var percent = total > 0 ? ((used * 100) / total).toFixed(1) : 0;
@@ -60,7 +56,8 @@ App.NameNodeCapacityPieChartView = App.PieChartDashboardWidgetView.extend({
     var total = this.get('model').get(this.get('modelFieldMax')) * 1024 * 1024;
     var used = total - this.get('model').get(this.get('modelFieldUsed')) * 1024 * 1024;
     var percent = total > 0 ? ((used)*100 / total).toFixed() : 0;
-    return [ percent, 100 - percent];
+    var percent_precise = total > 0 ? ((used)*100 / total).toFixed(1) : 0;
+    return [percent, percent_precise];
   }
 
 });

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d9ff52e2/ambari-web/app/views/main/dashboard/widgets/jobtracker_heap.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/jobtracker_heap.js b/ambari-web/app/views/main/dashboard/widgets/jobtracker_heap.js
index 6df6c40..3ea297e 100644
--- a/ambari-web/app/views/main/dashboard/widgets/jobtracker_heap.js
+++ b/ambari-web/app/views/main/dashboard/widgets/jobtracker_heap.js
@@ -25,16 +25,6 @@ App.JobTrackerHeapPieChartView = App.PieChartDashboardWidgetView.extend({
   id: '6',
 
   model_type: 'mapreduce',
-
- /* hiddenInfo: function () {
-    var heapUsed = this.get('model').get('jobTrackerHeapUsed');
-    var heapMax = this.get('model').get('jobTrackerHeapMax');
-    var percent = heapMax > 0 ? 100 * heapUsed / heapMax : 0;
-    var result = [];
-    result.pushObject(percent.toFixed(1) + '% used');
-    result.pushObject(numberUtils.bytesToSize(heapUsed, 1, "parseFloat") + ' of ' + numberUtils.bytesToSize(heapMax, 1, "parseFloat"));
-    return result;
-  }.property('model.jobTrackerHeapUsed', 'model.jobTrackerHeapMax'),*/
   modelFieldMax: 'jobTrackerHeapMax',
   modelFieldUsed: 'jobTrackerHeapUsed',
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d9ff52e2/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js b/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
index 35708c5..86cda03 100644
--- a/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
+++ b/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
@@ -24,9 +24,7 @@ App.NameNodeCpuPieChartView = App.PieChartDashboardWidgetView.extend({
   id: '3',
 
   model_type: 'hdfs',
-
   widgetHtmlId: 'widget-nn-cpu',
-
   modelFieldUsed: 'nameNodeCpu',
 
   didInsertElement: function() {
@@ -58,7 +56,7 @@ App.NameNodeCpuPieChartView = App.PieChartDashboardWidgetView.extend({
     var value = this.get('model').get(this.get('modelFieldUsed'));
     value = value >= 100 ? 100: value;
     var percent = (value + 0).toFixed(1);
-    return [ percent, 100 - percent];
+    var percent_precise = (value + 0).toFixed(2);
+    return [ percent, percent_precise];
   }
-
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d9ff52e2/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js b/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js
index 7d283a7..6d46d33 100644
--- a/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js
+++ b/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js
@@ -25,20 +25,8 @@ App.NameNodeHeapPieChartView = App.PieChartDashboardWidgetView.extend({
   id: '1',
 
   model_type: 'hdfs',
-
- /* hiddenInfo: function () {
-    var memUsed = this.get('model').get('jvmMemoryHeapUsed');
-    var memCommitted = this.get('model').get('jvmMemoryHeapCommitted');
-    var percent = memCommitted > 0 ? ((100 * memUsed) / memCommitted) : 0;
-    var result = [];
-    result.pushObject(percent.toFixed(1) + '% used');
-    result.pushObject(numberUtils.bytesToSize(memUsed, 1, 'parseFloat', 1024 * 1024) + ' of ' + numberUtils.bytesToSize(memCommitted, 1, 'parseFloat', 1024 * 1024));
-    return result;
-  }.property('model.jvmMemoryHeapUsed', 'model.jvmMemoryHeapCommitted'),*/
-
   modelFieldMax: 'jvmMemoryHeapCommitted',
   modelFieldUsed: 'jvmMemoryHeapUsed',
-
   widgetHtmlId: 'widget-nn-heap',
 
   didInsertElement: function() {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d9ff52e2/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js b/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
index b4dcab0..c6e9d07 100644
--- a/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
+++ b/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
@@ -62,7 +62,8 @@ App.PieChartDashboardWidgetView = App.DashboardWidgetView.extend({
     var used = this.get('model').get(this.get('modelFieldUsed'));
     var total = this.get('model').get(this.get('modelFieldMax'));
     var percent = total > 0 ? ((used)*100 / total).toFixed() : 0;
-    return [ percent, 100 - percent];
+    var percent_precise = total > 0 ? ((used)*100 / total).toFixed(1) : 0;
+    return [percent, percent_precise];
   },
 
   calc: function() {
@@ -97,7 +98,8 @@ App.PieChartDashboardWidgetView = App.DashboardWidgetView.extend({
     }),
 
     data: function() {
-      return this.get('parentView.dataForPieChart');
+      var ori_data = this.get('parentView.dataForPieChart');
+      return [ ori_data[0], 100 - ori_data[0]];
     }.property(),
 
     setData: function() {
@@ -105,7 +107,7 @@ App.PieChartDashboardWidgetView = App.DashboardWidgetView.extend({
     }.observes('parentView.dataForPieChart'),
 
     contentColor: function () {
-      var used = parseFloat(this.get('data')[0]);
+      var used = parseFloat(this.get('parentView.dataForPieChart')[1]);
       var thresh1 = parseFloat(this.get('thresh1'));
       var thresh2 = parseFloat(this.get('thresh2'));
       var color_green = '#95A800';

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d9ff52e2/ambari-web/app/views/main/dashboard/widgets/resource_manager_heap.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/resource_manager_heap.js b/ambari-web/app/views/main/dashboard/widgets/resource_manager_heap.js
index 1b706c6..33b9853 100644
--- a/ambari-web/app/views/main/dashboard/widgets/resource_manager_heap.js
+++ b/ambari-web/app/views/main/dashboard/widgets/resource_manager_heap.js
@@ -23,11 +23,10 @@ App.ResourceManagerHeapPieChartView = App.PieChartDashboardWidgetView.extend({
 
   title: Em.I18n.t('dashboard.widgets.ResourceManagerHeap'),
   id: '24',
-  model_type: 'yarn',
 
+  model_type: 'yarn',
   modelFieldMax: 'jvmMemoryHeapCommitted',
   modelFieldUsed: 'jvmMemoryHeapUsed',
-
   widgetHtmlId: 'widget-rm-heap',
 
   didInsertElement: function() {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d9ff52e2/ambari-web/app/views/main/dashboard/widgets/yarn_memory.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/yarn_memory.js b/ambari-web/app/views/main/dashboard/widgets/yarn_memory.js
index 92d12f3..0df7ab9 100644
--- a/ambari-web/app/views/main/dashboard/widgets/yarn_memory.js
+++ b/ambari-web/app/views/main/dashboard/widgets/yarn_memory.js
@@ -25,9 +25,7 @@ App.YARNMemoryPieChartView = App.PieChartDashboardWidgetView.extend({
   id: '27',
 
   widgetHtmlId: 'widget-yarn-memory',
-
   model_type: 'yarn',
-
   modelFieldUsed: 'allocatedMemory',
   modelFieldMax: 'availableMemory',
 
@@ -35,5 +33,4 @@ App.YARNMemoryPieChartView = App.PieChartDashboardWidgetView.extend({
     this._super();
     this.calc();
   }
-
 });
\ No newline at end of file