Repository: ambari
Updated Branches:
  refs/heads/trunk 06c7233d3 -> a39eb7d3b


AMBARI-10817 'yarn.scheduler.capacity.resource-calculator' not showing up in 
enhanced-configs. (ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7be88f62
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7be88f62
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7be88f62

Branch: refs/heads/trunk
Commit: 7be88f62168af949c1d21560e35fc8a47ed27300
Parents: 06c7233
Author: aBabiichuk <ababiic...@cybervisiontech.com>
Authored: Wed Apr 29 09:53:39 2015 +0300
Committer: aBabiichuk <ababiic...@cybervisiontech.com>
Committed: Wed Apr 29 10:46:51 2015 +0300

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    |  3 +-
 ambari-web/app/utils/config.js                  | 15 ++++++----
 ambari-web/test/utils/config_test.js            | 29 +++++++++++++++++++-
 3 files changed, 39 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7be88f62/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js 
b/ambari-web/app/controllers/main/service/info/configs.js
index 945bc56..64cdcc8 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -410,7 +410,8 @@ App.MainServiceInfoConfigsController = 
Em.Controller.extend(App.ServerValidatorM
 
       //put properties from capacity-scheduler.xml into one config with 
textarea view
       if (self.get('content.serviceName') === 'YARN') {
-        configs = App.config.fileConfigsIntoTextarea(configs, 
'capacity-scheduler.xml');
+        var configsToSkip = 
self.get('advancedConfigs').filterProperty('filename', 
'capacity-scheduler.xml').filterProperty('subSection');
+        configs = App.config.fileConfigsIntoTextarea(configs, 
'capacity-scheduler.xml', configsToSkip);
       }
       self.set('allConfigs', configs);
       //add configs as names of host components

http://git-wip-us.apache.org/repos/asf/ambari/blob/7be88f62/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index c298fb3..1169de1 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -1346,11 +1346,12 @@ App.config = Em.Object.create({
    * transform set of configs from file
    * into one config with textarea content:
    * name=value
-   * @param configs
-   * @param filename
+   * @param {App.ServiceConfigProperty[]} configs
+   * @param {String} filename
+   * @param {App.ServiceConfigProperty[]} [configsToSkip=[]]
    * @return {*}
    */
-  fileConfigsIntoTextarea: function (configs, filename) {
+  fileConfigsIntoTextarea: function (configs, filename, configsToSkip) {
     var fileConfigs = configs.filterProperty('filename', filename);
     var value = '';
     var defaultValue = '';
@@ -1358,8 +1359,10 @@ App.config = Em.Object.create({
     var complexConfig = $.extend({}, template);
     if (complexConfig) {
       fileConfigs.forEach(function (_config) {
-        value += _config.name + '=' + _config.value + '\n';
-        defaultValue += _config.name + '=' + _config.defaultValue + '\n';
+        if (!(configsToSkip && configsToSkip.someProperty('name', 
_config.name))) {
+          value += _config.name + '=' + _config.value + '\n';
+          defaultValue += _config.name + '=' + _config.defaultValue + '\n';
+        }
       }, this);
       var isFinal = fileConfigs.someProperty('isFinal', true);
       complexConfig.value = value;
@@ -1367,7 +1370,7 @@ App.config = Em.Object.create({
       complexConfig.isFinal = isFinal;
       complexConfig.defaultIsFinal = isFinal;
       configs = configs.filter(function (_config) {
-        return _config.filename !== filename;
+        return _config.filename !== filename || (configsToSkip && 
configsToSkip.someProperty('name', _config.name));
       });
       configs.push(complexConfig);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7be88f62/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js 
b/ambari-web/test/utils/config_test.js
index bbfdc6b..1649db9 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -124,7 +124,34 @@ describe('App.config', function () {
       expect(result[0].value).to.equal('');
       expect(result[0].defaultValue).to.equal('');
     });
-
+    it("filename has configs that shouldn't be included in textarea", function 
() {
+      var configs = [
+        {
+          name: 'config1',
+          value: 'value1',
+          defaultValue: 'value1',
+          filename: filename
+        },
+        {
+          name: 'config2',
+          value: 'value2',
+          defaultValue: 'value2',
+          filename: filename
+        }
+      ];
+      var cfg = {
+        name: 'config3',
+        value: 'value3',
+        defaultValue: 'value3',
+        filename: filename
+      };
+      configs.push(cfg);
+      var result = App.config.fileConfigsIntoTextarea.call(App.config, 
configs, filename, [cfg]);
+      expect(result.length).to.equal(2);
+      expect(result[1].value).to.equal('config1=value1\nconfig2=value2\n');
+      
expect(result[1].defaultValue).to.equal('config1=value1\nconfig2=value2\n');
+      expect(configs.findProperty('name', 'config3')).to.eql(cfg);
+    });
   });
 
   describe('#textareaIntoFileConfigs', function () {

Reply via email to