ソースを参照

AMBARI-6604. Adding custom config in yarn-site does not show final checkbox

Srimanth Gunturi 10 年 前
コミット
f2eae89604

+ 2 - 2
ambari-web/app/controllers/main/service/info/configs.js

@@ -665,10 +665,10 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
    */
   setSupportsFinal: function (serviceConfigProperty) {
     var fileName = serviceConfigProperty.get('filename');
-    var matchingConfigTypes = this.get('configTypesInfo').supportsFinal.filter(function(configType) {
+    var matchingConfigType = this.get('configTypesInfo').supportsFinal.find(function(configType) {
       return fileName.startsWith(configType);
     });
-    serviceConfigProperty.set('supportsFinal', matchingConfigTypes.length > 0);
+    serviceConfigProperty.set('supportsFinal', !!matchingConfigType);
   },
 
   /**

+ 2 - 2
ambari-web/app/controllers/wizard.js

@@ -796,10 +796,10 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
         var supportsFinal = App.config.getConfigTypesInfoFromService(service).supportsFinal;
 
         function shouldSupportFinal(filename) {
-          var matchingConfigTypes = supportsFinal.filter(function (configType) {
+          var matchingConfigType = supportsFinal.find(function (configType) {
             return filename.startsWith(configType);
           });
-          return (matchingConfigTypes.length > 0);
+          return !!matchingConfigType;
         }
 
         properties.forEach(function (property) {

+ 12 - 0
ambari-web/app/views/common/configs/services_config.js

@@ -493,6 +493,17 @@ App.ServiceConfigsByCategoryView = Ember.View.extend(App.UserPref, {
       var configsOfFile = service.get('configs').filterProperty('filename', siteFileName);
       var siteFileProperties = App.config.get('configMapping').all().filterProperty('filename', siteFileName);
 
+      function shouldSupportFinal(filename) {
+        var stackService = App.StackService.find().findProperty('serviceName', serviceName);
+        var supportsFinal = App.config.getConfigTypesInfoFromService(stackService).supportsFinal;
+        var matchingConfigType = supportsFinal.find(function (configType) {
+          return filename.startsWith(configType);
+        });
+        return !!matchingConfigType;
+      }
+
+      var supportsFinal = shouldSupportFinal(siteFileName);
+
       function isDuplicatedConfigKey(name) {
         return siteFileProperties.findProperty('name', name) || configsOfFile.findProperty('name', name);
       }
@@ -510,6 +521,7 @@ App.ServiceConfigsByCategoryView = Ember.View.extend(App.UserPref, {
           id: 'site property',
           serviceName: serviceName,
           defaultValue: null,
+          supportsFinal: supportsFinal,
           filename: siteFileName || '',
           isUserProperty: true,
           isNotSaved: true