You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2017/09/11 16:54:31 UTC

ambari git commit: AMBARI-21927. Unable to add a property to Default conf group which has same property name as in custom config group (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 26b9f4f13 -> 92bd10d65


AMBARI-21927. Unable to add a property to Default conf group which has same property name as in custom config group (akovalenko)


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

Branch: refs/heads/trunk
Commit: 92bd10d65f92f95c55bd2bc84a75244f2748ed09
Parents: 26b9f4f
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Mon Sep 11 16:57:13 2017 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Mon Sep 11 19:53:52 2017 +0300

----------------------------------------------------------------------
 .../configs/service_configs_by_category_view.js     | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/92bd10d6/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index 6cf9b99..2e7de36 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -430,6 +430,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.Persist, App.ConfigOverrid
   createProperty: function (propertyObj) {
     var config;
     var selectedConfigGroup = this.get('controller.selectedConfigGroup');
+    var categoryConfigsAll = this.get('categoryConfigsAll');
     if (selectedConfigGroup.get('isDefault')) {
       config = App.config.createDefaultConfig(propertyObj.name, propertyObj.filename, false, {
         value: propertyObj.value,
@@ -447,7 +448,13 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.Persist, App.ConfigOverrid
         isNotSaved: true
       }, selectedConfigGroup);
     }
-    this._appendConfigToCollection(App.ServiceConfigProperty.create(config));
+    var serviceConfigProperty = App.ServiceConfigProperty.create(config);
+    var duplicatedProperty = categoryConfigsAll.findProperty('name', config.name);
+    if (duplicatedProperty && duplicatedProperty.get('isUndefinedLabel')) {
+      serviceConfigProperty.set('overrides', duplicatedProperty.get('overrides'));
+      categoryConfigsAll.removeAt(categoryConfigsAll.indexOf(duplicatedProperty));
+    }
+    this._appendConfigToCollection(serviceConfigProperty);
   },
 
   /**
@@ -457,6 +464,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.Persist, App.ConfigOverrid
   _appendConfigToCollection: function (serviceConfigProperty) {
     this.get('serviceConfigs').pushObject(serviceConfigProperty);
     this.get('categoryConfigsAll').pushObject(serviceConfigProperty);
+    this.setVisibleCategoryConfigs();
   },
 
   /**
@@ -471,7 +479,8 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.Persist, App.ConfigOverrid
     var serviceName = service.get('serviceName');
 
     var configsOfFile = service.get('configs').filterProperty('filename', siteFileName);
-    return configsOfFile.findProperty('name', name);
+    var duplicatedProperty = configsOfFile.findProperty('name', name);
+    return duplicatedProperty && !duplicatedProperty.get('isUndefinedLabel');
   },
 
   /**
@@ -484,7 +493,8 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.Persist, App.ConfigOverrid
     var configFiles = service.get('configs').mapProperty('filename').uniq();
     configFiles.forEach(function (configFile) {
       var configsOfFile = service.get('configs').filterProperty('filename', configFile);
-      if (configsOfFile.findProperty('name', name)) {
+      var duplicatedProperty = configsOfFile.findProperty('name', name);
+      if (duplicatedProperty && !duplicatedProperty.get('isUndefinedLabel')) {
         files.push(configFile);
       }
     }, this);