Sfoglia il codice sorgente

AMBARI-1118. Dashboard > HDFS title's free capacity doesn't match summary. (Srimanth Gunturi via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1431810 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 anni fa
parent
commit
c81ed11739
2 ha cambiato i file con 10 aggiunte e 6 eliminazioni
  1. 3 0
      CHANGES.txt
  2. 7 6
      ambari-web/app/views/main/dashboard/service/hdfs.js

+ 3 - 0
CHANGES.txt

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

+ 7 - 6
ambari-web/app/views/main/dashboard/service/hdfs.js

@@ -58,13 +58,14 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
     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 () {