Updated Branches: refs/heads/trunk 26041800e -> df278233f
AMBARI-3056 Advanced config orders should be consistent in Install Wizard > Customize Services and Monitoring > Services > Config. (atkach) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/df278233 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/df278233 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/df278233 Branch: refs/heads/trunk Commit: df278233fc7d93ae67d23519dadf66d6100deefa Parents: 2604180 Author: atkach <[email protected]> Authored: Tue Sep 3 17:30:31 2013 +0300 Committer: atkach <[email protected]> Committed: Tue Sep 3 17:36:43 2013 +0300 ---------------------------------------------------------------------- .../controllers/main/service/info/configs.js | 2 +- ambari-web/app/data/HDP2/global_properties.js | 2 +- ambari-web/app/utils/config.js | 48 +++++++++++++++++--- 3 files changed, 44 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/df278233/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index 6f24fe4..7641dc1 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/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 http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/df278233/ambari-web/app/data/HDP2/global_properties.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/data/HDP2/global_properties.js b/ambari-web/app/data/HDP2/global_properties.js index 8b27224..e5b0eeb 100644 --- a/ambari-web/app/data/HDP2/global_properties.js +++ b/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", http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/df278233/ambari-web/app/utils/config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js index 49f64fd..7049c85 100644 --- a/ambari-web/app/utils/config.js +++ b/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
