You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/06/06 22:13:47 UTC

svn commit: r1490420 - in /incubator/ambari/trunk/ambari-web/app: models/service_config.js utils/config.js utils/string_utils.js views/common/configs/services_config.js

Author: yusaku
Date: Thu Jun  6 20:13:47 2013
New Revision: 1490420

URL: http://svn.apache.org/r1490420
Log:
AMBARI-2299. Custom config UI need to be compatible with multi-line values. (Oleg Nechiporenko via yusaku)

Modified:
    incubator/ambari/trunk/ambari-web/app/models/service_config.js
    incubator/ambari/trunk/ambari-web/app/utils/config.js
    incubator/ambari/trunk/ambari-web/app/utils/string_utils.js
    incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js

Modified: incubator/ambari/trunk/ambari-web/app/models/service_config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/service_config.js?rev=1490420&r1=1490419&r2=1490420&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/service_config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/service_config.js Thu Jun  6 20:13:47 2013
@@ -427,6 +427,9 @@ App.ServiceConfigProperty = Ember.Object
       case 'directories':
         return App.ServiceConfigTextArea;
         break;
+      case 'multiLine':
+        return App.ServiceConfigTextArea;
+        break;
       case 'custom':
         return App.ServiceConfigBigTextArea;
       case 'masterHost':

Modified: incubator/ambari/trunk/ambari-web/app/utils/config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/config.js?rev=1490420&r1=1490419&r2=1490420&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/config.js Thu Jun  6 20:13:47 2013
@@ -194,7 +194,7 @@ App.config = Em.Object.create({
         } else if (!this.get('configMapping').computed().someProperty('name', index)) {
           isAdvanced = advancedConfigs.someProperty('name', index);
           serviceConfigObj.id = 'site property';
-          serviceConfigObj.displayType = 'advanced';
+          serviceConfigObj.displayType = stringUtils.isSingleLine(serviceConfigObj.value) ? 'advanced' : 'multiLine';
           serviceConfigObj.displayName = configsPropertyDef ? configsPropertyDef.displayName : index;
           this.calculateConfigProperties(serviceConfigObj, isAdvanced, advancedConfigs);
           configs.push(serviceConfigObj);
@@ -245,7 +245,7 @@ App.config = Em.Object.create({
           serviceName: stored.serviceName,
           value: stored.value,
           defaultValue: stored.defaultValue,
-          displayType: "advanced",
+          displayType: stringUtils.isSingleLine(stored.value) ? 'advanced' : 'multiLine',
           filename: stored.filename,
           category: 'Advanced',
           isUserProperty: stored.isUserProperty === true,

Modified: incubator/ambari/trunk/ambari-web/app/utils/string_utils.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/string_utils.js?rev=1490420&r1=1490419&r2=1490420&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/string_utils.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/string_utils.js Thu Jun  6 20:13:47 2013
@@ -101,5 +101,9 @@ module.exports = {
       i++;
     }
     return result;
+  },
+
+  isSingleLine: function(string){
+    return string.trim().indexOf("\n") == -1;
   }
 }

Modified: incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js?rev=1490420&r1=1490419&r2=1490420&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js Thu Jun  6 20:13:47 2013
@@ -18,6 +18,7 @@
 
 var App = require('app');
 var validator = require('utils/validator');
+var stringUtils = require('utils/string_utils');
 
 App.ServicesConfigView = Em.View.extend({
   templateName: require('templates/common/configs/services_config'),
@@ -220,7 +221,7 @@ App.ServiceConfigsByCategoryView = Ember
     if (categoryMetaData != null) {
       serviceConfigObj.filename = categoryMetaData.siteFileName;
     }
-    
+
     var self = this;
     App.ModalPopup.show({
       // classNames: ['big-modal'],
@@ -237,6 +238,7 @@ App.ServiceConfigsByCategoryView = Ember
           serviceConfigObj.displayName = serviceConfigObj.name;
           serviceConfigObj.id = 'site property';
           serviceConfigObj.serviceName = serviceName;
+          serviceConfigObj.displayType = stringUtils.isSingleLine(serviceConfigObj.get('value')) ? 'advanced' : 'multiLine';
           var serviceConfigProperty = App.ServiceConfigProperty.create(serviceConfigObj);
           self.get('controller.secureConfigs').filterProperty('filename',self.get('category.siteFileName')).forEach(function(_secureConfig){
             if(_secureConfig.name === serviceConfigProperty.get('name')) {
@@ -258,7 +260,7 @@ App.ServiceConfigsByCategoryView = Ember
     });
 
   },
-  
+
   /**
    * Removes the top-level property from list of properties.
    * Should be only called on user properties.