Prechádzať zdrojové kódy

AMBARI-1351. Provide consistent ordering of hosts in heatmap. (jaimin)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1443238 13f79535-47bb-0310-9956-ffa450edef68
Jaimin Jetly 12 rokov pred
rodič
commit
ea5f703822
2 zmenil súbory, kde vykonal 18 pridanie a 1 odobranie
  1. 2 0
      CHANGES.txt
  2. 16 1
      ambari-web/app/mappers/hosts_mapper.js

+ 2 - 0
CHANGES.txt

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

+ 16 - 1
ambari-web/app/mappers/hosts_mapper.js

@@ -78,9 +78,24 @@ App.hostsMapper = App.QuickDataMapper.create({
         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;
   }
 
 });