You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2013/02/06 23:09:42 UTC

svn commit: r1443238 - in /incubator/ambari/trunk: CHANGES.txt ambari-web/app/mappers/hosts_mapper.js

Author: jaimin
Date: Wed Feb  6 22:09:41 2013
New Revision: 1443238

URL: http://svn.apache.org/viewvc?rev=1443238&view=rev
Log:
AMBARI-1351. Provide consistent ordering of hosts in heatmap. (jaimin)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-web/app/mappers/hosts_mapper.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1443238&r1=1443237&r2=1443238&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Wed Feb  6 22:09:41 2013
@@ -255,6 +255,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1351. Provide consistent ordering of hosts in heatmap. (jaimin)
+
  AMBARI_1344. mapred.tasktracker.reduce.tasks.maximum in mapred-site.xml is not
  taking effect. (yusaku)
 

Modified: incubator/ambari/trunk/ambari-web/app/mappers/hosts_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/hosts_mapper.js?rev=1443238&r1=1443237&r2=1443238&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/hosts_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/hosts_mapper.js Wed Feb  6 22:09:41 2013
@@ -78,9 +78,24 @@ App.hostsMapper = App.QuickDataMapper.cr
         result.push(this.parseIt(item, this.config));
 
       }, this);
-
+      result = this.sortByPublicHostName(result);
       App.store.loadMany(this.get('model'), result);
     }
+  },
+  /**
+   * Default data sorting by public_host_name field
+   * @param data
+   * @return {Array}
+   */
+  sortByPublicHostName: function(data) {
+    data.sort(function(a, b) {
+      var ap = a.public_host_name;
+      var bp = b.public_host_name;
+      if (ap > bp) return 1;
+      if (ap < bp) return -1;
+      return 0;
+    });
+    return data;
   }
 
 });