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

Chang Li commented on HDFS-6407:
--------------------------------

[~wheat9],
I just updated my patch. I slightly modify my render function. My previous 
patch did some slight parsing due to the "Block Pool Used"  column contains a 
compound data of "blockPoolUsed" and "blockPoolUsedPercent". There is already 
Used data column, and I don't see the meaning of displaying blockPoolUsed 
again. Moreover, it's confusing to sort blockPoolUsed and blockPoolUsedPercent 
compound because it's likely it has low blockPoolUsed size but high 
blockPoolUsedPercent. So I only display the usedPercent. That also help 
eliminate the only parsing I was using. 
Below is my latest render function. When it sort it only used the unformmatted 
data in the table. When it's displaying, I use the same format code in 
dfs-dust.js. Let me know what else concern you have for separating control and 
view. Thanks
{code}
"columnDefs": [ {
                "targets": [3,4,5,6,8],
                "render": function ( data, type, full, meta) {
                  var colIndex = meta.col;
                  var v;
                  if (type == 'display') {
                    if (colIndex == 8) {
                      return Math.round(v * 100) / 100 + '%';
                    }                    
                    var UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'ZB'];
                    var prev = 0, i = 0;
                    while (Math.floor(v) > 0 && i < UNITS.length) {
                      prev = v;
                      v /= 1024;
                      i += 1;
                    }

                    if (i > 0 && i < UNITS.length) {
                      v = prev;
                      i -= 1;
                    }
                    return Math.round(v * 100) / 100 + ' ' + UNITS[i];
                  }
                  return v; 
                }
             }]
{code}

> new namenode UI, lost ability to sort columns in datanode tab
> -------------------------------------------------------------
>
>                 Key: HDFS-6407
>                 URL: https://issues.apache.org/jira/browse/HDFS-6407
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 2.4.0
>            Reporter: Nathan Roberts
>            Assignee: Benoy Antony
>            Priority: Critical
>              Labels: BB2015-05-TBR
>         Attachments: 002-datanodes-sorted-capacityUsed.png, 
> 002-datanodes.png, 002-filebrowser.png, 002-snapshots.png, 
> HDFS-6407-002.patch, HDFS-6407-003.patch, HDFS-6407.4.patch, 
> HDFS-6407.5.patch, HDFS-6407.6.patch, HDFS-6407.7.patch, HDFS-6407.patch, 
> browse_directory.png, datanodes.png, snapshots.png, sorting 2.png, sorting 
> table.png
>
>
> old ui supported clicking on column header to sort on that column. The new ui 
> seems to have dropped this very useful feature.
> There are a few tables in the Namenode UI to display  datanodes information, 
> directory listings and snapshots.
> When there are many items in the tables, it is useful to have ability to sort 
> on the different columns.



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

Reply via email to