AMBARI-7470 js error during install wizard > customize services. (Max Shepel 
via ababiichuk)


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

Branch: refs/heads/branch-alerts-dev
Commit: 7ca86a9560a7292c9d6a277f56dbf6d24c1cb921
Parents: 03a1ff9
Author: ababiichuk <[email protected]>
Authored: Wed Sep 24 18:56:17 2014 +0300
Committer: ababiichuk <[email protected]>
Committed: Wed Sep 24 18:56:17 2014 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  |  8 ++-
 ambari-web/app/utils/config.js                  | 60 ++++++++++----------
 2 files changed, 36 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7ca86a95/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js 
b/ambari-web/app/controllers/wizard/step7_controller.js
index 55c83ff..22db35d 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -690,9 +690,11 @@ App.WizardStep7Controller = 
Em.Controller.extend(App.ServerValidatorMixin, {
       }
       dependentConfigs.forEach(function (configName) {
         var config = configs.findProperty('name', configName);
-        var replaceStr = config.value.match(/.jar=host[^,]+/)[0];
-        var replaceWith = replaceStr.slice(0, replaceStr.lastIndexOf('=') - 
replaceStr.length + 1) + gangliaServerHost;
-        config.value = config.defaultValue = config.value.replace(replaceStr, 
replaceWith);
+        if (!Em.isNone(config.value)) {
+          var replaceStr = config.value.match(/.jar=host[^,]+/)[0];
+          var replaceWith = replaceStr.slice(0, replaceStr.lastIndexOf('=') - 
replaceStr.length + 1) + gangliaServerHost;
+          config.value = config.defaultValue = 
config.value.replace(replaceStr, replaceWith);
+        }
         config.forceUpdate = true;
       }, this);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7ca86a95/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 2d1004d..c0eb1c3 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -434,7 +434,7 @@ App.config = Em.Object.create({
    */
   mergePreDefinedWithStored: function (storedConfigs, advancedConfigs, 
selectedServiceNames) {
     var mergedConfigs = [];
-    var contentProperties = this.createContentProperties(advancedConfigs);
+    var contentProperties = advancedConfigs ? 
this.createContentProperties(advancedConfigs) : [];
     var preDefinedConfigs = 
this.get('preDefinedSiteProperties').concat(contentProperties);
 
     storedConfigs = (storedConfigs) ? storedConfigs : [];
@@ -453,7 +453,7 @@ App.config = Em.Object.create({
       }, this);
 
       var configData = {};
-      var isAdvanced = advancedConfigs.someProperty('name', name);
+      var isAdvanced = advancedConfigs && advancedConfigs.someProperty('name', 
name);
       if (storedCfgs.length <= 1 && preDefinedCfgs.length <= 1) {
         var stored = storedCfgs[0];
         var preDefined = preDefinedCfgs[0];
@@ -554,36 +554,38 @@ App.config = Em.Object.create({
         }, this);
       }
     }
-    advancedConfigs.forEach(function (_config) {
-      var configType = this.getConfigTagFromFileName(_config.filename);
-      var configCategory = 'Advanced ' + configType;
-      var categoryMetaData = null;
-      if (_config) {
-        if (this.get('configMapping').computed().someProperty('name', 
_config.name)) {
-        } else if (!(configsToVerifying.someProperty('name', _config.name))) {
-          if (this.get('customFileNames').contains(_config.filename)) {
-            categoryMetaData = this.identifyCategory(_config);
-            if (categoryMetaData != null) {
-              configCategory = categoryMetaData.get('name');
+    if (advancedConfigs) {
+      advancedConfigs.forEach(function (_config) {
+        var configType = this.getConfigTagFromFileName(_config.filename);
+        var configCategory = 'Advanced ' + configType;
+        var categoryMetaData = null;
+        if (_config) {
+          if (this.get('configMapping').computed().someProperty('name', 
_config.name)) {
+          } else if (!(configsToVerifying.someProperty('name', _config.name))) 
{
+            if (this.get('customFileNames').contains(_config.filename)) {
+              categoryMetaData = this.identifyCategory(_config);
+              if (categoryMetaData != null) {
+                configCategory = categoryMetaData.get('name');
+              }
             }
+            _config.id = "site property";
+            _config.category = configCategory;
+            _config.displayName = _config.name;
+            _config.defaultValue = _config.value;
+            // make all advanced configs optional and populated by default
+            /*
+             * if (/\${.*}/.test(_config.value) || (service.serviceName !==
+             * 'OOZIE' && service.serviceName !== 'HBASE')) { 
_config.isRequired =
+             * false; _config.value = ''; } else if
+             * (/^\s+$/.test(_config.value)) { _config.isRequired = false; }
+             */
+            _config.isRequired = true;
+            _config.displayType = stringUtils.isSingleLine(_config.value) ? 
'advanced' : 'multiLine';
+            serviceConfigs.push(_config);
           }
-          _config.id = "site property";
-          _config.category = configCategory;
-          _config.displayName = _config.name;
-          _config.defaultValue = _config.value;
-          // make all advanced configs optional and populated by default
-          /*
-           * if (/\${.*}/.test(_config.value) || (service.serviceName !==
-           * 'OOZIE' && service.serviceName !== 'HBASE')) { _config.isRequired 
=
-           * false; _config.value = ''; } else if
-           * (/^\s+$/.test(_config.value)) { _config.isRequired = false; }
-           */
-          _config.isRequired = true;
-          _config.displayType = stringUtils.isSingleLine(_config.value) ? 
'advanced' : 'multiLine';
-          serviceConfigs.push(_config);
         }
-      }
-    }, this);
+      }, this);
+    }
   },
   /**
    * Render a custom conf-site box for entering properties that will be 
written in *-site.xml files of the services

Reply via email to