hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From epa...@apache.org
Subject [hadoop] branch branch-2.9 updated: YARN-7171: RM UI should sort memory / cores numerically. Contributed by Ahmed Hussein
Date Thu, 07 Feb 2019 22:06:38 GMT
This is an automated email from the ASF dual-hosted git repository.

epayne pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-2.9 by this push:
     new 3d8da16  YARN-7171: RM UI should sort memory / cores numerically. Contributed by
Ahmed Hussein
3d8da16 is described below

commit 3d8da16c82fa13c16f5069fc627c71aaf9e7c023
Author: Eric E Payne <ericp@verizonmedia.com>
AuthorDate: Thu Feb 7 16:38:11 2019 +0000

    YARN-7171: RM UI should sort memory / cores numerically. Contributed by Ahmed Hussein
    
    (cherry picked from commit d1ca9432dd0b3e9b46b4903e8c9d33f5c28fcc1b)
---
 .../resources/webapps/static/yarn.dt.plugins.js    | 23 ++++++++++++++++++++++
 .../hadoop/yarn/server/webapp/WebPageUtils.java    |  3 ++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js
index c003272..51cb630 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js
@@ -41,6 +41,29 @@ jQuery.fn.dataTableExt.oSort['title-numeric-desc'] = function(a,b) {
   return ((x < y) ?  1 : ((x > y) ? -1 : 0));
 };
 
+// 'numeric-ignore-strings' sort type
+jQuery.fn.dataTableExt.oSort['num-ignore-str-asc'] = function(a, b) {
+  if (isNaN(a) && isNaN(b)) return ((a < b) ? 1 : ((a > b) ? -1 : 0));
+
+  if (isNaN(a)) return 1;
+  if (isNaN(b)) return -1;
+
+  x = parseFloat(a);
+  y = parseFloat(b);
+  return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+};
+
+jQuery.fn.dataTableExt.oSort['num-ignore-str-desc'] = function(a, b) {
+  if (isNaN(a) && isNaN(b)) return ((a < b) ? 1 : ((a > b) ? -1 : 0));
+
+  if (isNaN(a)) return 1;
+  if (isNaN(b)) return -1;
+
+  x = parseFloat(a);
+  y = parseFloat(b);
+  return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+};
+
 jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) {
   var
   _that = this,
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.java
index b2f65a8..1cd7d87 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.java
@@ -51,8 +51,9 @@ public class WebPageUtils {
     sb.append("[\n")
       .append("{'sType':'natural', 'aTargets': [0]")
       .append(", 'mRender': parseHadoopID }")
-      .append("\n, {'sType':'numeric', 'aTargets': [6, 7, 8]")
+      .append("\n, {'sType':'num-ignore-str', 'aTargets': [6, 7, 8]")
       .append(", 'mRender': renderHadoopDate }")
+      .append("\n, {'sType':'num-ignore-str', 'aTargets': [11, 12, 13, 14, 15] }")
       .append("\n, {'sType':'numeric', bSearchable:false, 'aTargets':");
     if (isFairSchedulerPage) {
       sb.append("[15]");


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message