ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [37/50] [abbrv] git commit: AMBARI-7579 Strange behavior of config history after security enabled. (atkach)
Date Wed, 01 Oct 2014 15:27:35 GMT
AMBARI-7579 Strange behavior of config history after security enabled. (atkach)


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

Branch: refs/heads/branch-alerts-dev
Commit: fb6c685cbcf01f32c0840c32f6aa1e98f8c8e30a
Parents: eee0384
Author: atkach <atkach@hortonworks.com>
Authored: Wed Oct 1 13:50:01 2014 +0300
Committer: atkach <atkach@hortonworks.com>
Committed: Wed Oct 1 13:50:01 2014 +0300

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    |  5 ++--
 ambari-web/app/messages.js                      |  1 +
 ambari-web/app/models/stack_service.js          | 24 ++++++++---------
 ambari-web/app/utils/config.js                  | 28 +++++++++++++++-----
 4 files changed, 36 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fb6c685c/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 2086a8c..808e505 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -803,7 +803,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
       isMock: true,
       displayType: 'label'
     };
-    undefinedConfig.category = App.config.identifyCategory(undefinedConfig).name;
+    var category = App.config.identifyCategory(undefinedConfig);
+    undefinedConfig.category = category && category.name;
     return undefinedConfig;
   },
 
@@ -1073,7 +1074,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
    * @method createConfigProperty
    */
   createConfigProperty: function (_serviceConfigProperty, defaultGroupSelected, serviceConfigsData)
{
-    console.log("config", _serviceConfigProperty);
     if (!_serviceConfigProperty) return null;
     var overrides = _serviceConfigProperty.overrides;
     // we will populate the override properties below
@@ -1187,7 +1187,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
           }
         }
       }
-      console.log("config result", serviceConfigProperty);
     } else {
       serviceConfigProperty.set('isVisible', false);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb6c685c/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index f5cfb9b..32513a8 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -219,6 +219,7 @@ Em.I18n.translations = {
   'common.view': 'View',
   'common.compare': 'Compare',
   'common.latest': 'Latest',
+  'common.custom': 'Custom',
   'common.continueAnyway': 'Continue Anyway',
 
   'passiveState.turnOn':'Turn On Maintenance Mode',

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb6c685c/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js b/ambari-web/app/models/stack_service.js
index d4b7e68..0d4d30e 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -333,27 +333,25 @@ App.StackService.configCategories = function () {
 
   // Add Advanced section for every configType to all the services
   configTypes.forEach(function (type) {
-    var displayName = 'Advanced ' + type;
-    var canAddProperty = false;
-    var advancedSection;
-    advancedSection = App.ServiceConfigCategory.create({ name: 'Advanced ' + type, displayName:
displayName,
-      canAddProperty: canAddProperty});
-    serviceConfigCategories.pushObject(advancedSection);
+    serviceConfigCategories.pushObject(App.ServiceConfigCategory.create({
+      name: 'Advanced ' + type,
+      displayName: Em.I18n.t('common.advanced') + " " + type,
+      canAddProperty: false
+    }));
   }, this);
 
   // Add custom section for every configType to all the services
   configTypes.forEach(function (type) {
-    var displayName = 'Custom ' + type;
-    var canAddProperty = true;
-    var customSection;
-    var siteFileName = type + '.xml';
     var configTypesWithNoCustomSection = ['capacity-scheduler','mapred-queue-acls','flume-conf',
'pig-properties'];
     if (type.endsWith('-env') || type.endsWith('-log4j') || configTypesWithNoCustomSection.contains(type))
{
       return;
     }
-    customSection = App.ServiceConfigCategory.create({ name: displayName, displayName: displayName,
siteFileName: siteFileName,
-      canAddProperty: canAddProperty});
-    serviceConfigCategories.pushObject(customSection);
+    serviceConfigCategories.pushObject(App.ServiceConfigCategory.create({
+      name: 'Custom ' + type,
+      displayName: Em.I18n.t('common.custom') + " " + type,
+      siteFileName: type + '.xml',
+      canAddProperty: true
+    }));
   }, this);
   return serviceConfigCategories;
 };

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb6c685c/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 7baf180..f2d3ecc 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -189,18 +189,34 @@ App.config = Em.Object.create({
    */
   loadedConfigurationsCache: {},
 
+  /**
+   * identify category by filename of config
+   * @param config
+   * @return {object|null}
+   */
   identifyCategory: function (config) {
-    if (config.filename.indexOf("env") != -1) return;
-    var category = null;
-    var serviceConfigMetaData = this.get('preDefinedServiceConfigs').findProperty('serviceName',
config.serviceName);
-    if (serviceConfigMetaData) {
-      var configCategories = serviceConfigMetaData.get('configCategories');
+    var category = null,
+      categoryName = "",
+      serviceConfigMetaData = this.get('preDefinedServiceConfigs').findProperty('serviceName',
config.serviceName),
+      configCategories = (serviceConfigMetaData && serviceConfigMetaData.get('configCategories'))
|| [];
+
+    if (config.filename.contains("env")) {
+      if (config.category) {
+        category = configCategories.findProperty("name", config.category);
+      } else {
+        configCategories.forEach(function (_category) {
+          if (_category.name.contains(this.getConfigTagFromFileName(config.filename))) {
+            category = _category;
+          }
+        }, this);
+      }
+    } else {
       configCategories.forEach(function (_category) {
         if (_category.siteFileNames && Array.isArray(_category.siteFileNames) &&
_category.siteFileNames.contains(config.filename)) {
           category = _category;
         }
       });
-      category = (category == null) ? configCategories.findProperty('siteFileName', this.getOriginalFileName(config.filename))
: category;
+      category = Em.isNone(category) ? configCategories.findProperty('siteFileName', this.getOriginalFileName(config.filename))
: category;
     }
     return category;
   },


Mime
View raw message