Parcourir la source

AMBARI-6283. cannot edit custom props after creating host config group. (onechiporenko)

Oleg Nechiporenko il y a 11 ans
Parent
commit
1a549c1194

+ 1 - 1
ambari-web/app/templates/common/configs/capacity_scheduler.hbs

@@ -91,7 +91,7 @@
         </div>
       {{! For Advanced, Advanced Core Site, Advanced HDFS Site sections, show the 'Add Property' link.}}
       {{#if view.canEdit}}
-          {{#if view.category.canAddProperty }}
+          {{#if view.category.customCanAddProperty }}
               <div>
                   <a href="#" {{action "showAddPropertyWindow" this target="view" }} >{{t installer.step7.config.addProperty}}...</a>
               </div>

+ 1 - 1
ambari-web/app/templates/common/configs/service_config.hbs

@@ -152,7 +152,7 @@
                   {{! For Advanced, Advanced Core Site, Advanced HDFS Site sections, show the 'Add Property' link.}}
                   {{#if App.isAdmin}}
                     {{#if view.canEdit}}
-                      {{#if category.canAddProperty }}
+                      {{#if category.customCanAddProperty }}
                         <div>
                           <a href="#" {{action "showAddPropertyWindow" this target="view" }} >{{t installer.step7.config.addProperty}}...</a>
                         </div>

+ 13 - 10
ambari-web/app/views/common/configs/services_config.js

@@ -70,15 +70,18 @@ App.ServiceConfigView = Em.View.extend({
     if (!controller.get('selectedService.configCategories')) {
       return;
     }
-    var canAddProperty = true;
-    if (controller.get('selectedConfigGroup') && !controller.get('selectedConfigGroup').isDefault) {
-      canAddProperty = false;
-    }
-    controller.get('selectedService.configCategories').filterProperty('siteFileName').forEach(function (config) {
-      if (config.get('canAddProperty') !== false) {
-        config.set('canAddProperty', canAddProperty);
+
+    if (controller.get('selectedConfigGroup')) {
+      if (controller.get('selectedConfigGroup').isDefault) {
+        controller.get('selectedService.configCategories').filterProperty('siteFileName').forEach(function (config) {
+          config.set('customCanAddProperty', config.get('canAddProperty'));
+        });
       }
-    });
+      else {
+        controller.get('selectedService.configCategories').filterProperty('siteFileName').setEach('customCanAddProperty', false);
+      }
+    }
+
   }.observes(
     'App.router.mainServiceInfoConfigsController.selectedConfigGroup.name',
     'App.router.wizardStep7Controller.selectedConfigGroup.name'
@@ -399,8 +402,8 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
    * Should we show config group or not
    */
   isShowBlock: function () {
-    return this.get('category.canAddProperty') || this.get('filteredCategoryConfigs').length > 0;
-  }.property('category.canAddProperty', 'filteredCategoryConfigs.length'),
+    return this.get('category.customCanAddProperty') || this.get('filteredCategoryConfigs').length > 0;
+  }.property('category.customCanAddProperty', 'filteredCategoryConfigs.length'),
 
   didInsertElement: function () {
     var isCollapsed = this.get('category.isCollapsed') == undefined ? (this.get('category.name').indexOf('Advanced') != -1 || this.get('category.name').indexOf('CapacityScheduler') != -1) : this.get('category.isCollapsed');