Repository: ambari Updated Branches: refs/heads/trunk 0bfe4d864 -> a639659d1
AMBARI-13023. Improve `fileNamesToUpdate` calculation time (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a639659d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a639659d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a639659d Branch: refs/heads/trunk Commit: a639659d1ad5082a11bc4a30849f965ed82806da Parents: 0bfe4d8 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Mon Sep 7 15:50:34 2015 +0300 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Mon Sep 7 15:56:50 2015 +0300 ---------------------------------------------------------------------- .../mixins/common/configs/enhanced_configs.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/a639659d/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 c7fc3a7..1ccb4ab 100644 --- a/ambari-web/app/mixins/common/configs/enhanced_configs.js +++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js @@ -424,6 +424,11 @@ App.EnhancedConfigsMixin = Em.Mixin.create({ * @private */ parseConfigsByTag: function(configObject, updateOnlyBoundaries, parentConfigs, selectedConfigGroup) { + var wizardController = this.get('wizardController'); + if (wizardController) { + var fileNamesToUpdate = wizardController.getDBProperty('fileNamesToUpdate') || []; + this.set('_fileNamesToUpdate', fileNamesToUpdate); + } var notDefaultGroup = !!selectedConfigGroup; var parentPropertiesNames = parentConfigs ? parentConfigs.mapProperty('name') : []; /** get all configs by config group **/ @@ -535,6 +540,9 @@ App.EnhancedConfigsMixin = Em.Mixin.create({ } this._saveRecommendedAttributes(configObject, parentPropertiesNames, updateOnlyBoundaries, selectedConfigGroup); } + if (wizardController) { + wizardController.setDBProperty('fileNamesToUpdate', this.get('_fileNamesToUpdate').uniq()); + } }, /** @@ -548,6 +556,12 @@ App.EnhancedConfigsMixin = Em.Mixin.create({ */ _saveRecommendedAttributes: function(configs, parentPropertiesNames, updateOnlyBoundaries, selectedConfigGroup) { var self = this; + var wizardController = self.get('wizardController'); + var fileNamesToUpdate = wizardController ? this.get('_fileNamesToUpdate') : []; + var stackConfigsMap = {}; + App.StackConfigProperty.find().forEach(function (c) { + stackConfigsMap[c.get('id')] = c; + }); Em.keys(configs).forEach(function (siteName) { var service = App.config.getServiceByConfigType(siteName); var serviceName = service.get('serviceName'); @@ -557,14 +571,13 @@ App.EnhancedConfigsMixin = Em.Mixin.create({ var properties = configs[siteName].property_attributes || {}; Em.keys(properties).forEach(function (propertyName) { var cp = configProperties.findProperty('name', propertyName); - var stackProperty = App.StackConfigProperty.find().findProperty('id', App.config.configId(propertyName, siteName)); + var stackProperty = stackConfigsMap[App.config.configId(propertyName, siteName)]; var attributes = properties[propertyName] || {}; Em.keys(attributes).forEach(function (attributeName) { if (attributeName == 'delete') { if (!updateOnlyBoundaries) { var fileName = App.config.getOriginalFileName(siteName); var modifiedFileNames = self.get('modifiedFileNames'); - var wizardController = self.get('wizardController'); var dependentProperty = self.get('_dependentConfigValues').filterProperty('propertyName', propertyName).filterProperty('fileName', siteName).findProperty('configGroup', group && Em.get(group,'name')); if (dependentProperty) { Em.set(dependentProperty, 'toDelete', true); @@ -591,10 +604,8 @@ App.EnhancedConfigsMixin = Em.Mixin.create({ if (modifiedFileNames && !modifiedFileNames.contains(fileName)) { modifiedFileNames.push(fileName); } else if (wizardController) { - var fileNamesToUpdate = wizardController.getDBProperty('fileNamesToUpdate') || []; if (!fileNamesToUpdate.contains(fileName)) { fileNamesToUpdate.push(fileName); - wizardController.setDBProperty('fileNamesToUpdate', fileNamesToUpdate); } } } @@ -615,6 +626,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({ }); }); }); + this.set('_fileNamesToUpdate', fileNamesToUpdate); }, /**