瀏覽代碼

AMBARI-3056 Advanced config orders should be consistent in Install Wizard > Customize Services and Monitoring > Services > Config. (atkach)

atkach 12 年之前
父節點
當前提交
df278233fc

+ 1 - 1
ambari-web/app/controllers/main/service/info/configs.js

@@ -429,7 +429,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     var configGroups = App.config.loadConfigsByTags(this.get('serviceConfigTags'));
     //STEP 5: Merge global and on-site configs with pre-defined
     var configSet = App.config.mergePreDefinedWithLoaded(configGroups, advancedConfigs, this.get('serviceConfigTags'), serviceName);
-
+    configSet = App.config.syncOrderWithPredefined(configSet);
     //var serviceConfigs = this.getSitesConfigProperties(advancedConfigs);
     var configs = configSet.configs;
     //put global configs into globalConfigs to save them separately

+ 1 - 1
ambari-web/app/data/HDP2/global_properties.js

@@ -668,7 +668,7 @@ module.exports =
       "domain": "global",
       "serviceName": "YARN",
       "category": "ResourceManager",
-      "index": 0
+      "index": 1
     },
     {
       "id": "puppet var",

+ 42 - 6
ambari-web/app/utils/config.js

@@ -171,7 +171,7 @@ App.config = Em.Object.create({
         if(!isAdvanced) config.isUserProperty = true;
       }
     } else {
-      config.category = 'Advanced';
+      config.category = config.category ? config.category : 'Advanced';
       config.description = isAdvanced && advancedConfigs.findProperty('name', config.name).description;
       config.filename = isAdvanced && advancedConfigs.findProperty('name', config.name).filename;
       config.isRequired = true;
@@ -241,10 +241,7 @@ App.config = Em.Object.create({
           serviceConfigObj.index = configsPropertyDef.index;
           serviceConfigObj.isSecureConfig = configsPropertyDef.isSecureConfig === undefined ? false : configsPropertyDef.isSecureConfig;
           serviceConfigObj.belongsToService = configsPropertyDef.belongsToService;
-        }
-        // MAPREDUCE contains core-site properties but doesn't show them
-        if(serviceConfigObj.serviceName === 'MAPREDUCE' && serviceConfigObj.filename === 'core-site.xml'){
-          serviceConfigObj.isVisible = false;
+          serviceConfigObj.category = configsPropertyDef.category;
         }
         if (_tag.siteName === 'global') {
           if (configsPropertyDef) {
@@ -254,7 +251,6 @@ App.config = Em.Object.create({
           }
           serviceConfigObj.id = 'puppet var';
           serviceConfigObj.displayName = configsPropertyDef ? configsPropertyDef.displayName : null;
-          serviceConfigObj.category = configsPropertyDef ? configsPropertyDef.category : null;
           serviceConfigObj.options = configsPropertyDef ? configsPropertyDef.options : null;
           globalConfigs.push(serviceConfigObj);
         } else if (!this.get('configMapping').computed().someProperty('name', index)) {
@@ -275,6 +271,46 @@ App.config = Em.Object.create({
       mappingConfigs: mappingConfigs
     }
   },
+  /**
+   * synchronize order of config properties with order, that on UI side
+   * @param configSet
+   * @return {Object}
+   */
+  syncOrderWithPredefined: function(configSet){
+    var globalConfigs = configSet.globalConfigs,
+        siteConfigs = configSet.configs,
+        globalStart = [],
+        siteStart = [];
+
+    this.get('preDefinedGlobalProperties').mapProperty('name').forEach(function(name){
+      var _global = globalConfigs.findProperty('name', name);
+      if(_global){
+        globalStart.push(_global);
+        globalConfigs = globalConfigs.without(_global);
+      }
+    }, this);
+
+    this.get('preDefinedSiteProperties').mapProperty('name').forEach(function(name){
+      var _site = siteConfigs.findProperty('name', name);
+      if(_site){
+        siteStart.push(_site);
+        siteConfigs = siteConfigs.without(_site);
+      }
+    }, this);
+
+    var alphabeticalSort = function(a, b){
+      if (a.name < b.name) return -1;
+      if (a.name > b.name) return 1;
+      return 0;
+    }
+
+
+    return {
+      globalConfigs: globalStart.concat(globalConfigs.sort(alphabeticalSort)),
+      configs: siteStart.concat(siteConfigs.sort(alphabeticalSort)),
+      mappingConfigs: configSet.mappingConfigs
+    }
+  },
 
   /**
    * merge stored configs with pre-defined