Explorar el Código

AMBARI-2084. Wrong host mapping in Assign Masters step. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1480832 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako hace 12 años
padre
commit
79a7f97a43

+ 2 - 0
CHANGES.txt

@@ -837,6 +837,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2084. Wrong host mapping in Assign Masters step. (yusaku)
+
  AMBARI-2098. Customizing webcat pid run directory fails service status. 
  (swagle)
 

+ 14 - 1
ambari-web/app/controllers/wizard/step5_controller.js

@@ -125,6 +125,19 @@ App.WizardStep5Controller = Em.Controller.extend({
       }
     }
     this.set("hosts", result);
+    this.sortHosts(this.get('hosts'));
+  },
+
+  sortHosts: function (hosts) {
+    hosts.sort(function (a, b) {
+      if (a.get('memory') == b.get('memory')) {
+        if (a.get('cpu') == b.get('cpu')) {
+          return a.get('host_name').localeCompare(b.get('host_name')); // hostname asc
+        }
+        return b.get('cpu') - a.get('cpu'); // cores desc
+      }
+      return b.get('memory') - a.get('memory'); // ram desc
+    });
   },
 
   /**
@@ -218,7 +231,7 @@ App.WizardStep5Controller = Em.Controller.extend({
       if (item.display_name === "ZooKeeper") {
         componentObj.set('zId', zid++);
         componentObj.set("showRemoveControl", showRemoveControlZk);
-      } else if(App.supports.multipleHBaseMasters && item.component_name === "HBASE_MASTER"){
+      } else if (App.supports.multipleHBaseMasters && item.component_name === "HBASE_MASTER") {
         componentObj.set('zId', hid++);
         componentObj.set("showRemoveControl", showRemoveControlHb);
       }

+ 0 - 32
ambari-web/app/views/wizard/step5_view.js

@@ -36,43 +36,11 @@ App.SelectHostView = Em.Select.extend({
   componentName:null,
   attributeBindings:['disabled'],
 
-  filterContent:function () {
-    this.get('content').sort(function (a, b) {
-      if (a.get('memory') == b.get('memory')) {
-        if (a.get('cpu') == b.get('cpu')) {
-
-//          try to compare as ipaddresses
-          if (a.get('host_name').ip2long() && b.get('host_name').ip2long()) {
-            return a.get('host_name').ip2long() - b.get('host_name').ip2long(); // hostname asc
-          }
-
-//          try to compare as strings
-          if (a.get('host_name') > b.get('host_name')) {
-            return 1;
-          }
-
-          if (b.get('host_name') > a.get('host_name')) {
-            return -1;
-          }
-
-          return 0;
-        }
-        return b.get('cpu') - a.get('cpu'); // cores desc
-      }
-
-      return b.get('memory') - a.get('memory'); // ram desc
-    });
-
-  }.observes('content'),
-
   change:function () {
     this.get('controller').assignHostToMaster(this.get("componentName"), this.get("value"), this.get("zId"));
   },
 
   didInsertElement:function () {
-    if (!this.get('controller.isReassignWizard')) {
-      this.filterContent();
-    }
     this.set("value", this.get("selectedHost"));
   }
 });