Kaynağa Gözat

AMBARI-6747 Changing CapScheduler only versions all configs in service. (Buzhor Denys via ababiichuk)

aBabiichuk 10 yıl önce
ebeveyn
işleme
d70da2c852

+ 14 - 1
ambari-web/app/controllers/main/service/info/configs.js

@@ -1031,7 +1031,20 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
       if (this.get('content.serviceName') === 'YARN' && !App.supports.capacitySchedulerUi) {
         configs = App.config.textareaIntoFileConfigs(configs, 'capacity-scheduler.xml');
       }
-      this.saveSiteConfigs(configs.filterProperty('group', null));
+      var modifiedConfigs = configs
+        // get only modified and created configs
+        .filter(function(config) { return config.get('isNotDefaultValue') || config.get('isNotSaved'); })
+        // get file names
+        .mapProperty('filename').uniq()
+        // get configs by filename
+        .map(function(fileName) {
+          return configs.filterProperty('filename', fileName);
+        })
+        // concatenate results
+        .reduce(function(current, prev) { return current.concat(prev); });
+
+      // save modified original configs that have no group
+      this.saveSiteConfigs(modifiedConfigs.filter(function(config) { return !config.get('group'); }));
 
       /**
        * First we put cluster configurations, which automatically creates /configurations

+ 8 - 0
ambari-web/app/utils/config.js

@@ -334,6 +334,7 @@ App.config = Em.Object.create({
           isOverridable: true,
           isRequired: true,
           isFinal: finalAttributes[index] === "true",
+          defaultIsFinal: finalAttributes[index] === "true",
           showLabel: true,
           serviceName: serviceName,
           belongsToService: []
@@ -840,6 +841,7 @@ App.config = Em.Object.create({
             description: item.property_description,
             isVisible: item.isVisible,
             isFinal: item.final === "true",
+            defaultIsFinal: item.final === "true",
             filename: item.filename || fileName
           });
         }
@@ -1113,6 +1115,7 @@ App.config = Em.Object.create({
       "isOverridable": true,
       "isRequired": true,
       "isVisible": true,
+      "supportsFinal": true,
       "serviceName": "YARN",
       "filename": "capacity-scheduler.xml",
       "category": "CapacityScheduler"
@@ -1137,8 +1140,11 @@ App.config = Em.Object.create({
         value += _config.name + '=' + _config.value + '\n';
         defaultValue += _config.name + '=' + _config.defaultValue + '\n';
       }, this);
+      var isFinal = fileConfigs.someProperty('isFinal', true);
       complexConfig.value = value;
       complexConfig.defaultValue = defaultValue;
+      complexConfig.isFinal = isFinal;
+      complexConfig.defaultIsFinal = isFinal;
       configs = configs.filter(function (_config) {
         return _config.filename !== filename;
       });
@@ -1173,6 +1179,8 @@ App.config = Em.Object.create({
             defaultValue: value,
             serviceName: configsTextarea.get('serviceName'),
             filename: filename,
+            isFinal: configsTextarea.get('isFinal'),
+            isNotDefaultValue: configsTextarea.get('isNotDefaultValue'),
             group: null
           }));
         }