[ 
https://issues.apache.org/jira/browse/HDFS-7483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14627322#comment-14627322
 ] 

Haohui Mai commented on HDFS-7483:
----------------------------------

{code}
+  var helpers = {
+    'percentage': function(chunk, context, bodies, params) {
+      var a = dust.helpers.tap(params.a, chunk, context);
+      var b = dust.helpers.tap(params.b, chunk, context);
+      var f = parseFloat(a)/parseFloat(b);
+      return chunk.write(Math.round(f * 10000) / 100 + '%');
+    }
+  };
+
+  for(var key in helpers) {
+         dust.helpers[key] = helpers[key];
+  }
+
{code}

A better approach is to do it through the math helper 
(http://www.dustjs.com/guides/dust-helpers/) and to format it with the 
{{fmt_percentage}} helper.

> Display information per tier on the Namenode UI
> -----------------------------------------------
>
>                 Key: HDFS-7483
>                 URL: https://issues.apache.org/jira/browse/HDFS-7483
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Benoy Antony
>            Assignee: Benoy Antony
>         Attachments: HDFS-7483-001.patch, HDFS-7483-002.patch, overview.png, 
> storagetypes.png, storagetypes_withnostorage.png, withOneStorageType.png, 
> withTwoStorageType.png
>
>
> If cluster has different types of storage, it is useful to display the 
> storage information per type. 
> The information will be available via JMX (HDFS-7390)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to