فهرست منبع

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

Alex Antonenko 11 سال پیش
والد
کامیت
e8a60eb465
1فایلهای تغییر یافته به همراه8 افزوده شده و 3 حذف شده
  1. 8 3
      ambari-web/app/controllers/main/host/add_controller.js

+ 8 - 3
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);
   },