Repository: ambari Updated Branches: refs/heads/trunk 8de76e83c -> c136edff1
AMBARI-10629 'dtnode_heapsize' maximum not being used by the widget. (ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c136edff Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c136edff Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c136edff Branch: refs/heads/trunk Commit: c136edff173404c09f7174d85f680ae30d1efd0b Parents: 8de76e8 Author: aBabiichuk <ababiic...@cybervisiontech.com> Authored: Tue Apr 21 17:40:49 2015 +0300 Committer: aBabiichuk <ababiic...@cybervisiontech.com> Committed: Tue Apr 21 17:51:55 2015 +0300 ---------------------------------------------------------------------- .../mixins/common/configs/enhanced_configs.js | 43 +++++++++++--------- 1 file changed, 24 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/c136edff/ambari-web/app/mixins/common/configs/enhanced_configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/common/configs/enhanced_configs.js b/ambari-web/app/mixins/common/configs/enhanced_configs.js index 3bd54e8..d2e677e 100644 --- a/ambari-web/app/mixins/common/configs/enhanced_configs.js +++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js @@ -444,26 +444,31 @@ App.EnhancedConfigsMixin = Em.Mixin.create({ } } } - - /** - * saving new attribute values - */ - if (configs[key].property_attributes && configs[key].property_attributes[propertyName]) { - - var stackProperty = App.StackConfigProperty.find(propertyName + '_' + key); - if (stackProperty && stackProperty.get('valueAttributes')) { - if (configs[key].property_attributes[propertyName].minimum) { - stackProperty.set('valueAttributes.minimum', configs[key].property_attributes[propertyName].minimum); - } - if (configs[key].property_attributes[propertyName].maximum) { - stackProperty.set('valueAttributes.maximum', configs[key].property_attributes[propertyName].maximum); - } - if (configs[key].property_attributes[propertyName].increment_step) { - stackProperty.set('valueAttributes.increment_step', configs[key].property_attributes[propertyName].increment_step); - } - } - } } + this._saveRecommendedAttributes(configs); } + }, + + /** + * Save property attributes recieved from recommendations. These attributes are minimum, maximum, + * increment_step. Attributes are stored in <code>App.StackConfigProperty</code> model. + * + * @param {Object[]} configs + */ + _saveRecommendedAttributes: function(configs) { + Em.keys(configs).forEach(function(siteName) { + var properties = configs[siteName].property_attributes || {}; + Em.keys(properties).forEach(function(propertyName) { + var stackProperty = App.StackConfigProperty.find().findProperty('id', propertyName + '_' + siteName); + if (stackProperty) { + var attributes = properties[propertyName] || {}; + Em.keys(attributes).forEach(function(attributeName) { + if (attributeName == 'delete') return; + Em.set(stackProperty.get('valueAttributes'), attributeName, attributes[attributeName]); + }); + } + }); + }); } + });