Updated Branches:
  refs/heads/trunk 5cc2b12a5 -> e8a60eb46

AMBARI-3929. AddHost confg-groups sorting (Mikhail Bayuk via alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e8a60eb4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e8a60eb4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e8a60eb4

Branch: refs/heads/trunk
Commit: e8a60eb465c1ae43ec4dc9686d734453457b6305
Parents: 5cc2b12
Author: Alex Antonenko <[email protected]>
Authored: Fri Nov 29 17:17:42 2013 +0200
Committer: Alex Antonenko <[email protected]>
Committed: Fri Nov 29 17:17:42 2013 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/add_controller.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e8a60eb4/ambari-web/app/controllers/main/host/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/add_controller.js 
b/ambari-web/app/controllers/main/host/add_controller.js
index 84b2ea4..2cc93c7 100644
--- a/ambari-web/app/controllers/main/host/add_controller.js
+++ b/ambari-web/app/controllers/main/host/add_controller.js
@@ -367,7 +367,7 @@ App.AddHostController = App.WizardController.extend({
           var service = componentServiceMap[slave.componentName];
           var configGroups = 
this.get('content.configGroups').filterProperty('ConfigGroup.tag', service);
           var configGroupsNames = 
configGroups.mapProperty('ConfigGroup.group_name');
-          configGroupsNames.push('Default');
+          configGroupsNames.unshift('Default');
           selectedServices.push({
             serviceId: service,
             displayName: App.Service.DisplayNames[service],
@@ -389,8 +389,8 @@ App.AddHostController = App.WizardController.extend({
           serviceMatch.hosts = 
serviceMatch.hosts.concat(selectedClientHosts).uniq();
         } else {
           var configGroups = 
this.get('content.configGroups').filterProperty('ConfigGroup.tag', service);
-          var configGroupsNames = 
configGroups.mapProperty('ConfigGroup.group_name');
-          configGroupsNames.push('Default');
+          var configGroupsNames = 
configGroups.mapProperty('ConfigGroup.group_name').sort();
+          configGroupsNames.unshift('Default');
           selectedServices.push({
             serviceId: service,
             displayName: App.Service.DisplayNames[service],
@@ -402,6 +402,11 @@ App.AddHostController = App.WizardController.extend({
         }
       }, this);
     }
+    selectedServices.forEach(function(selectedService){
+      selectedService.configGroups.sort(function(cfgA, cfgB){
+        return cfgA.ConfigGroup.group_name >= cfgB.ConfigGroup.group_name;
+      });
+    });
     this.set('content.serviceConfigGroups', selectedServices);
   },
 

Reply via email to