Updated Branches: refs/heads/trunk 8d3f64661 -> 6106dff05
AMBARI-2607: Ambari manage properties should be relative to a configuration site. (jaimin) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/6106dff0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/6106dff0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/6106dff0 Branch: refs/heads/trunk Commit: 6106dff05bc4637d6fc7f0ca6b7d3815da0f3d3e Parents: 8d3f646 Author: Jaimin Jetly <[email protected]> Authored: Wed Sep 11 10:10:51 2013 -0700 Committer: Jaimin Jetly <[email protected]> Committed: Wed Sep 11 10:11:03 2013 -0700 ---------------------------------------------------------------------- ambari-web/app/utils/config.js | 22 +++++++++++++++++++- .../app/views/common/configs/services_config.js | 3 ++- 2 files changed, 23 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6106dff0/ambari-web/app/utils/config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js index 7049c85..3591623 100644 --- a/ambari-web/app/utils/config.js +++ b/ambari-web/app/utils/config.js @@ -108,6 +108,26 @@ App.config = Em.Object.create({ return []; } }.property('App.isHadoop2Stack'), + + /** + * + * @param siteNames + * @returns {Array} + */ + getBySitename: function (siteNames) { + var computedConfigs = this.get('configMapping').computed(); + var siteProperties = []; + if (typeof siteNames === "string") { + siteProperties = computedConfigs.filterProperty('filename', siteNames); + } else if (siteNames instanceof Array) { + siteNames.forEach(function (_siteName) { + siteProperties = siteProperties.concat(computedConfigs.filterProperty('filename', _siteName)); + }, this); + } + return siteProperties; + }, + + /** * Cache of loaded configurations. This is useful in not loading * same configuration multiple times. It is populated in multiple @@ -253,7 +273,7 @@ App.config = Em.Object.create({ serviceConfigObj.displayName = configsPropertyDef ? configsPropertyDef.displayName : null; serviceConfigObj.options = configsPropertyDef ? configsPropertyDef.options : null; globalConfigs.push(serviceConfigObj); - } else if (!this.get('configMapping').computed().someProperty('name', index)) { + } else if (!this.getBySitename(serviceConfigObj.get('filename')).someProperty('name', index)) { isAdvanced = advancedConfigs.someProperty('name', index); serviceConfigObj.id = 'site property'; serviceConfigObj.displayType = stringUtils.isSingleLine(serviceConfigObj.value) ? 'advanced' : 'multiLine'; http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6106dff0/ambari-web/app/views/common/configs/services_config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/services_config.js b/ambari-web/app/views/common/configs/services_config.js index 88387c5..6f01a02 100644 --- a/ambari-web/app/views/common/configs/services_config.js +++ b/ambari-web/app/views/common/configs/services_config.js @@ -368,6 +368,7 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({ }, showAddPropertyWindow: function (event) { var configsOfFile = this.get('service.configs').filterProperty('filename', this.get('category.siteFileName')); + var self =this; var serviceConfigObj = Ember.Object.create({ name: '', value: '', @@ -380,7 +381,7 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({ var name = this.get('name'); if (name.trim() != "") { if (validator.isValidConfigKey(name)) { - var configMappingProperty = App.config.get('configMapping').all().findProperty('name', name); + var configMappingProperty = App.config.get('configMapping').all().filterProperty('filename',self.get('category.siteFileName')).findProperty('name', name); if ((configMappingProperty == null) && (!configsOfFile.findProperty('name', name))) { this.set("isKeyError", false); this.set("errorMessage", "");
