ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-8109 Fix Tez configuration section on Ambari UI. (Buzhor Denys via atkach)
Date Sun, 02 Nov 2014 20:24:18 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.7.0 63b8b4b2b -> 55fea90a4


AMBARI-8109 Fix Tez configuration section on Ambari UI. (Buzhor Denys via atkach)


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

Branch: refs/heads/branch-1.7.0
Commit: 55fea90a4ef73c2a1cdac1ee7d1ea2da5f7731ef
Parents: 63b8b4b
Author: atkach <atkach@hortonworks.com>
Authored: Sun Nov 2 22:23:58 2014 +0200
Committer: atkach <atkach@hortonworks.com>
Committed: Sun Nov 2 22:23:58 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/data/HDP2.2/site_properties.js | 12 ++-
 ambari-web/app/data/HDP2.2/tez_properties.js  | 43 ++++++++++
 ambari-web/app/utils/config.js                | 39 ++++++++-
 ambari-web/test/utils/config_test.js          | 99 ++++++++++++++++++++++
 4 files changed, 190 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/55fea90a/ambari-web/app/data/HDP2.2/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2.2/site_properties.js b/ambari-web/app/data/HDP2.2/site_properties.js
index e9d8e2e..979d16a 100644
--- a/ambari-web/app/data/HDP2.2/site_properties.js
+++ b/ambari-web/app/data/HDP2.2/site_properties.js
@@ -18,6 +18,7 @@
 
 var App = require('app');
 
+var tezProperties = require('data/HDP2.2/tez_properties');
 var hdp2properties = require('data/HDP2/site_properties').configProperties;
 var excludedConfigs = [
   'storm.thrift.transport', //In HDP2.2 storm.thrift.transport property is computed on server
@@ -79,7 +80,16 @@ hdp22properties.push(
     "index": 1
   });
 
+var additionalProperties = [];
+
+tezProperties.forEach(function(config) {
+  if (!hdp22properties.findProperty('name', config.name)) additionalProperties.push(config);
+  else {
+    hdp22properties.findProperty('name', config.name).category = config.category;
+  }
+});
+
 module.exports =
 {
-  "configProperties": hdp22properties
+  "configProperties": hdp22properties.concat(additionalProperties)
 };

http://git-wip-us.apache.org/repos/asf/ambari/blob/55fea90a/ambari-web/app/data/HDP2.2/tez_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2.2/tez_properties.js b/ambari-web/app/data/HDP2.2/tez_properties.js
new file mode 100644
index 0000000..46f18ba
--- /dev/null
+++ b/ambari-web/app/data/HDP2.2/tez_properties.js
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var App = require('app');
+
+var tezPropsToCategory = {
+  'General': [
+    'tez.am.launch.cmd-opts',
+    'tez.am.launch.env',
+    'tez.task.resource.memory.mb',
+    'tez.task.launch.cmd-opts',
+    'tez.task.launch.env',
+    'tez.grouping.split-waves',
+    'tez.grouping.min-size',
+    'tez.grouping.max-size',
+    'tez.runtime.compress',
+    'tez.runtime.compress.codec'
+  ]
+};
+
+var tezProps = [];
+
+for (var category in tezPropsToCategory) {
+  tezProps = tezProps.concat(App.config.generateConfigPropertiesByName(tezPropsToCategory[category],

+    { category: category, serviceName: 'TEZ', filename: 'tez-site.xml'}));
+}
+
+module.exports = tezProps;
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/55fea90a/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index a82afdb..57e33de 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -1719,8 +1719,43 @@ App.config = Em.Object.create({
    * @param hostName
    *          (string) host name used to register
    */
-  getConfigGroupsForHost: function (hostName) {
+   getConfigGroupsForHost: function (hostName) {
 
-  }
+  },
 
+  /**
+   * Generate minimal config property object used in *_properties.js files.
+   * Example:
+   * <code>
+   *   var someProperties = App.config.generateConfigPropertiesByName([
+   *    'property_1', 'property_2', 'property_3'], { category: 'General', filename: 'myFileName'});
+   *   // someProperties contains Object[]
+   *   [
+   *    {
+   *      name: 'property_1',
+   *      displayName: 'property_1',
+   *      isVisible: true,
+   *      isReconfigurable: true,
+   *      category: 'General',
+   *      filename: 'myFileName'
+   *    },
+   *    .......
+   *   ]
+   * </code>
+   * @param {Array} names
+   * @param {Object} properties - additional properties which will merge with base object
definition
+   * @returns {*}
+   */
+  generateConfigPropertiesByName: function(names, properties) {
+    return names.map(function (item) {
+      var baseObj = {
+        name: item,
+        displayName: item,
+        isVisible: true,
+        isReconfigurable: true
+      };
+      if (properties) return $.extend(baseObj, properties);
+      else return baseObj;
+    });
+  }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/55fea90a/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 25b454f..5dec0ae 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -477,6 +477,105 @@ describe('App.config', function () {
     });
   });
 
+  describe('#generateConfigPropertiesByName', function() {
+    var tests = [
+      {
+        names: ['property_1', 'property_2'],
+        properties: undefined,
+        e: {
+          keys: ['name', 'displayName', 'isVisible', 'isReconfigurable']
+        },
+        m: 'Should generate base property object without additional fields'
+      },
+      {
+        names: ['property_1', 'property_2'],
+        properties: { category: 'SomeCat', serviceName: 'SERVICE_NAME' },
+        e: {
+          keys: ['name', 'displayName', 'isVisible', 'isReconfigurable', 'category', 'serviceName']
+        },
+        m: 'Should generate base property object without additional fields'
+      }
+    ];
+
+    tests.forEach(function(test) {
+      it(test.m, function() {
+        expect(App.config.generateConfigPropertiesByName(test.names, test.properties).length).to.eql(test.names.length);
+        expect(App.config.generateConfigPropertiesByName(test.names, test.properties).map(function(property)
{
+          return Em.keys(property);
+        }).reduce(function(p, c) {
+          return p.concat(c);
+        }).uniq()).to.eql(test.e.keys);
+      });
+    });
+
+  });
+
+  describe('#generateConfigPropertiesByName', function() {
+    var tests = [
+      {
+        names: ['property_1', 'property_2'],
+        properties: undefined,
+        e: {
+          keys: ['name', 'displayName', 'isVisible', 'isReconfigurable']
+        },
+        m: 'Should generate base property object without additional fields'
+      },
+      {
+        names: ['property_1', 'property_2'],
+        properties: { category: 'SomeCat', serviceName: 'SERVICE_NAME' },
+        e: {
+          keys: ['name', 'displayName', 'isVisible', 'isReconfigurable', 'category', 'serviceName']
+        },
+        m: 'Should generate base property object without additional fields'
+      }
+    ];
+
+    tests.forEach(function(test) {
+      it(test.m, function() {
+        expect(App.config.generateConfigPropertiesByName(test.names, test.properties).length).to.eql(test.names.length);
+        expect(App.config.generateConfigPropertiesByName(test.names, test.properties).map(function(property)
{
+          return Em.keys(property);
+        }).reduce(function(p, c) {
+          return p.concat(c);
+        }).uniq()).to.eql(test.e.keys);
+      });
+    });
+
+  });
+
+  describe('#generateConfigPropertiesByName', function() {
+    var tests = [
+      {
+        names: ['property_1', 'property_2'],
+        properties: undefined,
+        e: {
+          keys: ['name', 'displayName', 'isVisible', 'isReconfigurable']
+        },
+        m: 'Should generate base property object without additional fields'
+      },
+      {
+        names: ['property_1', 'property_2'],
+        properties: { category: 'SomeCat', serviceName: 'SERVICE_NAME' },
+        e: {
+          keys: ['name', 'displayName', 'isVisible', 'isReconfigurable', 'category', 'serviceName']
+        },
+        m: 'Should generate base property object without additional fields'
+      }
+    ];
+
+    tests.forEach(function(test) {
+      it(test.m, function() {
+        expect(App.config.generateConfigPropertiesByName(test.names, test.properties).length).to.eql(test.names.length);
+        expect(App.config.generateConfigPropertiesByName(test.names, test.properties).map(function(property)
{
+          return Em.keys(property);
+        }).reduce(function(p, c) {
+          return p.concat(c);
+        }).uniq()).to.eql(test.e.keys);
+      });
+    });
+
+  });
+
   describe('#isManagedMySQLForHiveAllowed', function () {
 
     var cases = [


Mime
View raw message