You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/09/07 14:54:33 UTC

ambari git commit: AMBARI-13023. Improve `fileNamesToUpdate` calculation time (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 a21d2bc21 -> b7fb7472e


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/b7fb7472
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b7fb7472
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b7fb7472

Branch: refs/heads/branch-2.1
Commit: b7fb7472e2d2434c99b3edf52c8fa6b4f00e4e5a
Parents: a21d2bc
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Mon Sep 7 15:50:34 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Mon Sep 7 15:50:34 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/b7fb7472/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 5794e75..dd55a14 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -423,6 +423,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 **/
@@ -534,6 +539,9 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
       }
       this._saveRecommendedAttributes(configObject, parentPropertiesNames, updateOnlyBoundaries, selectedConfigGroup);
     }
+    if (wizardController) {
+      wizardController.setDBProperty('fileNamesToUpdate', this.get('_fileNamesToUpdate').uniq());
+    }
   },
 
   /**
@@ -547,6 +555,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');
@@ -556,14 +570,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);
@@ -590,10 +603,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);
                 }
               }
             }
@@ -614,6 +625,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
         });
       });
     });
+    this.set('_fileNamesToUpdate', fileNamesToUpdate);
   },
 
   /**