You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2013/04/08 21:09:30 UTC

svn commit: r1465729 - in /incubator/ambari/trunk: ./ ambari-web/app/controllers/main/service/info/ ambari-web/app/controllers/wizard/ ambari-web/app/data/ ambari-web/app/templates/common/configs/ ambari-web/app/utils/ ambari-web/app/views/common/configs/

Author: jaimin
Date: Mon Apr  8 19:09:29 2013
New Revision: 1465729

URL: http://svn.apache.org/r1465729
Log:
AMBARI-1838. Cluster Management > Services > MapReduce > Config throws JS error and the page comes up blank. (jaimin)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
    incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
    incubator/ambari/trunk/ambari-web/app/data/config_properties.js
    incubator/ambari/trunk/ambari-web/app/data/custom_configs.js
    incubator/ambari/trunk/ambari-web/app/templates/common/configs/capacity_scheduler.hbs
    incubator/ambari/trunk/ambari-web/app/utils/config.js
    incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1465729&r1=1465728&r2=1465729&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Mon Apr  8 19:09:29 2013
@@ -656,6 +656,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1838. Cluster Management > Services > MapReduce > Config throws JS error
+ and the page comes up blank. (jaimin)
+
  AMBARI-1836. Remove hard-coded ports from agent scripts. (swagle)
 
  AMBARI-1834. Reduce the number of states that a host component can be in.

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js?rev=1465729&r1=1465728&r2=1465729&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js Mon Apr  8 19:09:29 2013
@@ -800,7 +800,12 @@ App.MainServiceInfoConfigsController = E
    * @param configs
    */
   saveSiteConfigs: function (configs) {
-    var storedConfigs = configs.filterProperty('id', 'site property').filterProperty('value');
+    //storedConfigs contains custom configs as well
+    var serviceConfigProperties = configs.filterProperty('id', 'site property');
+    serviceConfigProperties.forEach(function(_config){
+      if(typeof _config.get('value') === "boolean") _config.set('value', _config.value.toString());
+    });
+    var storedConfigs = serviceConfigProperties.filterProperty('value');
     var preConfigs = this.loadUiSideConfigs(this.get('configMapping').overridable());
     var postConfigs = this.loadUiSideConfigs(this.get('configMapping').computed());
     this.set('uiConfigs', preConfigs.concat(storedConfigs).concat(postConfigs));

Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js?rev=1465729&r1=1465728&r2=1465729&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js Mon Apr  8 19:09:29 2013
@@ -173,10 +173,14 @@ App.WizardStep8Controller = Em.Controlle
   },
 
   loadConfigs: function () {
-    var storedConfigs = this.get('content.serviceConfigProperties').filterProperty('id', 'site property').filterProperty('value');
+    //storedConfigs contains custom configs as well
+    var serviceConfigProperties = this.get('content.serviceConfigProperties').filterProperty('id', 'site property');
+    serviceConfigProperties.forEach(function(_config){
+      _config.value = (typeof _config.value === "boolean") ? _config.value.toString() : _config.value;
+    });
+    var storedConfigs = serviceConfigProperties.filterProperty('value');
     var uiConfigs = this.loadUiSideConfigs();
-    var customConfigs = this.loadCustomConfigs();
-    this.set('configs', storedConfigs.concat(uiConfigs, customConfigs));
+    this.set('configs', storedConfigs.concat(uiConfigs));
   },
 
   loadUiSideConfigs: function () {
@@ -319,24 +323,6 @@ App.WizardStep8Controller = Em.Controlle
     }
   },
 
-
-  /**
-   * load custom configs
-   */
-  loadCustomConfigs: function () {
-    var configs = this.get('content.serviceConfigProperties').filterProperty('id', 'conf-site');
-    var customConfigs = [];
-    configs.forEach(function (_config) {
-      customConfigs.pushObject({
-        "id": "site property",
-        "name": _config.name,
-        "value": _config.value,
-        "filename": _config.filename
-      });
-    }, this);
-    return customConfigs;
-  },
-
   getServiceInfo: function (componentName) {
     var serviceConfig;
     switch (componentName) {

Modified: incubator/ambari/trunk/ambari-web/app/data/config_properties.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/config_properties.js?rev=1465729&r1=1465728&r2=1465729&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/config_properties.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/config_properties.js Mon Apr  8 19:09:29 2013
@@ -1673,7 +1673,7 @@ module.exports =
       "category": "Advanced"
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.capacity-scheduler.maximum-system-jobs",
       "displayName": "Max system jobs",
       "displayType": "int",
@@ -1689,7 +1689,7 @@ module.exports =
       "filename": "capacity-scheduler.xml"
     },
     /*{
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.cluster.map.memory.mb",
       "displayName": "Map slot memory",
       "displayType": "int",
@@ -1707,7 +1707,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.cluster.reduce.memory.mb",
       "displayName": "Reduce slot memory",
       "displayType": "int",
@@ -1725,7 +1725,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.cluster.max.map.memory.mb",
       "displayName": "Max map task memory",
       "displayType": "int",
@@ -1743,7 +1743,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.cluster.max.reduce.memory.mb",
       "displayName": "Max reduce task memory",
       "displayType": "int",
@@ -1761,7 +1761,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.job.map.memory.mb",
       "displayName": "Map task memory",
       "displayType": "int",
@@ -1779,7 +1779,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.job.reduce.memory.mb",
       "displayName": "Reduce task memory",
       "displayType": "int",

Modified: incubator/ambari/trunk/ambari-web/app/data/custom_configs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/custom_configs.js?rev=1465729&r1=1465728&r2=1465729&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/custom_configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/custom_configs.js Mon Apr  8 19:09:29 2013
@@ -20,7 +20,7 @@
 module.exports =
   [
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.capacity-scheduler.queue.<queue-name>.capacity",
       "displayName": "Capacity",
       "value": '',
@@ -35,7 +35,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.capacity-scheduler.queue.<queue-name>.maximum-capacity",
       "displayName": "Max Capacity",
       "value": '',
@@ -58,7 +58,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.capacity-scheduler.queue.<queue-name>.minimum-user-limit-percent",
       "displayName": "Min User Limit",
       "value": '',
@@ -81,7 +81,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.capacity-scheduler.queue.<queue-name>.user-limit-factor",
       "displayName": "User Limit Factor",
       "value": '',
@@ -98,7 +98,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.capacity-scheduler.queue.<queue-name>.supports-priority",
       "displayName": "Supports Priority",
       "value": false,
@@ -113,7 +113,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.queue.<queue-name>.acl-submit-job",
       "displayName": "",
       "value": '',
@@ -127,7 +127,7 @@ module.exports =
       "filename": 'mapred-queue-acls.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.queue.<queue-name>.acl-administer-jobs",
       "displayName": "",
       "value": '',
@@ -141,7 +141,7 @@ module.exports =
       "filename": 'mapred-queue-acls.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.capacity-scheduler.queue.<queue-name>.maximum-initialized-active-tasks",
       "displayName": "Max initialized active tasks",
       "value": '',
@@ -157,7 +157,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.capacity-scheduler.queue.<queue-name>.maximum-initialized-active-tasks-per-user",
       "displayName": "Max initialized active tasks per user",
       "value": '',
@@ -173,7 +173,7 @@ module.exports =
       "filename": 'capacity-scheduler.xml'
     },
     {
-      "id": "conf-site",
+      "id": "site property",
       "name": "mapred.capacity-scheduler.queue.<queue-name>.init-accept-jobs-factor",
       "displayName": "Init accept jobs factor",
       "value": '',

Modified: incubator/ambari/trunk/ambari-web/app/templates/common/configs/capacity_scheduler.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/common/configs/capacity_scheduler.hbs?rev=1465729&r1=1465728&r2=1465729&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/common/configs/capacity_scheduler.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/common/configs/capacity_scheduler.hbs Mon Apr  8 19:09:29 2013
@@ -69,7 +69,7 @@
                     {{#if isVisible}}
                         <div class="row-fluid">
                             <div {{bindAttr class="errorMessage:error :control-label-span :span4"}}>
-                                <label class="control-label">{{displayName}}</label>
+                                <label>{{displayName}}</label>
                             </div>
                             <div class="span8">
                                 <div {{bindAttr class="errorMessage:error: :control-group"}}>

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=1465729&r1=1465728&r2=1465729&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/config.js Mon Apr  8 19:09:29 2013
@@ -128,7 +128,7 @@ App.config = Em.Object.create({
           serviceConfigObj.category = configsPropertyDef ? configsPropertyDef.category : null;
           serviceConfigObj.options = configsPropertyDef ? configsPropertyDef.options : null;
           globalConfigs.push(serviceConfigObj);
-        } else if (!this.get('configMapping').all().someProperty('name', index)) {
+        } else if (!this.get('configMapping').computed().someProperty('name', index)) {
           serviceConfigObj.id = 'site property';
           serviceConfigObj.displayType = 'advanced';
           serviceConfigObj.displayName = configsPropertyDef ? configsPropertyDef.displayName : index;
@@ -141,12 +141,8 @@ App.config = Em.Object.create({
           if (categoryMetaData != null) {
             serviceConfigObj.category = categoryMetaData.get('name');
             serviceConfigObj.isUserProperty = true;
-            configs.push(serviceConfigObj);
-          } else {
-            serviceConfigObj.id = 'conf-site';
-            serviceConfigObj.serviceName = serviceName;
-            customConfigs.push(serviceConfigObj);
           }
+          configs.push(serviceConfigObj);
         } else {
           mappingConfigs.push(serviceConfigObj);
         }
@@ -225,7 +221,7 @@ App.config = Em.Object.create({
     var configCategory = 'Advanced';
     advancedConfigs.forEach(function (_config) {
       if (_config) {
-        if (this.get('configMapping').all().someProperty('name', _config.name)) {
+        if (this.get('configMapping').computed().someProperty('name', _config.name)) {
         } else if (!(serviceConfigs.someProperty('name', _config.name))) {
           var categoryMetaData = this.identifyCategory(_config);
           if (categoryMetaData != null) {
@@ -269,49 +265,48 @@ App.config = Em.Object.create({
       queueProperties.setEach('isQueue', true);
     } else {
       queueProperties = preDefinedCustomConfigs.filterProperty('isQueue');
-      this.addDefaultQueue(configs, queueProperties);
+      queueProperties.forEach(function(customConfig){
+        this.setDefaultQueue(customConfig);
+        configs.push(customConfig);
+      }, this);
     }
   },
   /**
-   * add properties of default queue to configs
-   * @param configs
-   * @param queueProperties
+   * set values to properties of default queue
+   * @param customConfig
    */
-  addDefaultQueue: function (configs, queueProperties) {
-    queueProperties.forEach(function(customConfig){
-      customConfig.name = customConfig.name.replace(/<queue-name>/, 'default');
-      //values for default queue
-      switch (customConfig.name){
-        case 'mapred.capacity-scheduler.queue.default.capacity':
-          customConfig.value = '100';
-          break;
-        case 'mapred.capacity-scheduler.queue.default.maximum-capacity':
-          customConfig.value = '100';
-          break;
-        case 'mapred.capacity-scheduler.queue.default.minimum-user-limit-percent':
-          customConfig.value = '100';
-          break;
-        case 'mapred.capacity-scheduler.queue.default.user-limit-factor':
-          customConfig.value = '1';
-          break;
-        case 'mapred.capacity-scheduler.queue.default.maximum-initialized-active-tasks':
-          customConfig.value = '200000';
-          break;
-        case 'mapred.capacity-scheduler.queue.default.maximum-initialized-active-tasks-per-user':
-          customConfig.value = '100000';
-          break;
-        case 'mapred.capacity-scheduler.queue.default.init-accept-jobs-factor':
-          customConfig.value = '10';
-          break;
-        case 'mapred.queue.default.acl-submit-job':
-          customConfig.value = '* *';
-          break;
-        case 'mapred.queue.default.acl-administer-jobs':
-          customConfig.value = '* *';
-          break;
-      }
-      configs.push(customConfig);
-    });
+  setDefaultQueue: function (customConfig) {
+    customConfig.name = customConfig.name.replace(/<queue-name>/, 'default');
+    //values for default queue
+    switch (customConfig.name) {
+      case 'mapred.capacity-scheduler.queue.default.capacity':
+        customConfig.value = '100';
+        break;
+      case 'mapred.capacity-scheduler.queue.default.maximum-capacity':
+        customConfig.value = '100';
+        break;
+      case 'mapred.capacity-scheduler.queue.default.minimum-user-limit-percent':
+        customConfig.value = '100';
+        break;
+      case 'mapred.capacity-scheduler.queue.default.user-limit-factor':
+        customConfig.value = '1';
+        break;
+      case 'mapred.capacity-scheduler.queue.default.maximum-initialized-active-tasks':
+        customConfig.value = '200000';
+        break;
+      case 'mapred.capacity-scheduler.queue.default.maximum-initialized-active-tasks-per-user':
+        customConfig.value = '100000';
+        break;
+      case 'mapred.capacity-scheduler.queue.default.init-accept-jobs-factor':
+        customConfig.value = '10';
+        break;
+      case 'mapred.queue.default.acl-submit-job':
+        customConfig.value = '* *';
+        break;
+      case 'mapred.queue.default.acl-administer-jobs':
+        customConfig.value = '* *';
+        break;
+    }
   },
   /**
    * render configs, distribute them by service

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=1465729&r1=1465728&r2=1465729&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 Mon Apr  8 19:09:29 2013
@@ -598,9 +598,31 @@ App.ServiceConfigCapacityScheduler = App
         queue.push(config);
       }
     });
+    //each queue consists of 10 properties if less then add missing properties
+    if(queue.length < 10){
+      this.addMissingProperties(queue, queueName);
+    }
     return queue;
   },
   /**
+   * add missing properties to queue
+   * @param queue
+   * @param queueName
+   */
+  addMissingProperties: function(queue, queueName){
+    var customConfigs = this.get('customConfigs');
+    customConfigs.forEach(function(_config){
+      var serviceConfigProperty = $.extend({}, _config);
+      serviceConfigProperty.name = serviceConfigProperty.name.replace(/<queue-name>/, queueName);
+      if(!queue.someProperty('name', serviceConfigProperty.name)){
+        App.config.setDefaultQueue(serviceConfigProperty);
+        serviceConfigProperty = App.ServiceConfigProperty.create(serviceConfigProperty);
+        serviceConfigProperty.validate();
+        queue.push(serviceConfigProperty);
+      }
+    }, this);
+  },
+  /**
    * format table content from queues
    */
   tableContent: function(){
@@ -890,7 +912,11 @@ App.ServiceConfigCapacityScheduler = App
             });
           }
           if(config.name == 'mapred.capacity-scheduler.queue.' + content.name + '.supports-priority'){
-            config.set('value', (config.get('value') == 'true') ? true : false);
+            if(config.get('value') == 'true' || config.get('value') === true){
+              config.set('value', true);
+            } else {
+              config.set('value', false);
+            }
           }
           configs[index] = App.ServiceConfigProperty.create(config);
         });