Author: yusaku
Date: Fri Jan 11 02:15:49 2013
New Revision: 1431810
URL: http://svn.apache.org/viewvc?rev=1431810&view=rev
Log:
AMBARI-1118. Dashboard > HDFS title's free capacity doesn't match summary.
(Srimanth Gunturi via yusaku)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/views/main/dashboard/service/hdfs.js
Modified: incubator/ambari/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1431810&r1=1431809&r2=1431810&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri Jan 11 02:15:49 2013
@@ -675,6 +675,9 @@ AMBARI-666 branch (unreleased changes)
BUG FIXES
+ AMBARI-1118. Dashboard > HDFS title's free capacity doesn't match summary.
+ (Srimanth Gunturi via yusaku)
+
AMBARI-1115. Host component live status is broken. (Srimanth Gunturi via
yusaku)
Modified:
incubator/ambari/trunk/ambari-web/app/views/main/dashboard/service/hdfs.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/dashboard/service/hdfs.js?rev=1431810&r1=1431809&r2=1431810&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/dashboard/service/hdfs.js
(original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/dashboard/service/hdfs.js
Fri Jan 11 02:15:49 2013
@@ -58,13 +58,14 @@ App.MainDashboardServiceHdfsView = App.M
var svc = this.get('service');
var liveCount = svc.get('liveDataNodes').get('length');
var totalCount = svc.get('dataNodes').get('length');
- var total = svc.get('capacityTotal') + 0;
- var used = svc.get('capacityUsed') + 0;
- var percentRemaining = (100 - Math.round((used * 100) / total)).toFixed(1);
- if (percentRemaining == "NaN") {
- percentRemaining = "n/a ";
+ var total = this.get('service.capacityTotal') + 0;
+ var remaining = this.get('service.capacityRemaining') + 0;
+ var used = total - remaining;
+ var percent = total > 0 ? ((used * 100) / total).toFixed(1) : 0;
+ if (percent == "NaN" || percent < 0) {
+ percent = "n/a ";
}
- return text.format(liveCount, totalCount, percentRemaining);
+ return text.format(liveCount, totalCount, percent);
}.property('service.liveDataNodes', 'service.dataNodes',
'service.capacityUsed', 'service.capacityTotal'),
capacity: function () {