Selaa lähdekoodia

AMBARI-15244. JS Error on ASW step4 (onechiporenko)

Oleg Nechiporenko 9 vuotta sitten
vanhempi
commit
8db1e302ac

+ 5 - 4
ambari-web/app/utils/configs/theme/theme.js

@@ -26,14 +26,15 @@ App.configTheme = Em.Object.create({
    * @param {Array} configs
    */
   resolveConfigThemeConditions: function (configs) {
+    var self = this;
     App.ThemeCondition.find().forEach(function (configCondition) {
       var _configs = Em.A(configCondition.get('configs'));
       if (configCondition.get("resource") === 'config' && _configs.length > 0) {
-        var isConditionTrue = this.calculateConfigCondition(configCondition.get("if"), configs);
+        var isConditionTrue = self.calculateConfigCondition(configCondition.get("if"), configs);
         var action = isConditionTrue ? configCondition.get("then") : configCondition.get("else");
         if (configCondition.get('id')) {
           var valueAttributes = action.property_value_attributes;
-          if (valueAttributes && !Em.none(valueAttributes['visible'])) {
+          if (valueAttributes && !Em.none(valueAttributes.visible)) {
             var themeResource;
             if (configCondition.get('type') === 'subsection') {
               themeResource = App.SubSection.find().findProperty('name', configCondition.get('name'));
@@ -52,7 +53,7 @@ App.configTheme = Em.Object.create({
                     // if config has already been hidden by condition with "subsection" or "subsectionTab" type
                     // then ignore condition of "config" type
                     if (configCondition.get('type') === 'config' && item.hiddenBySection) return false;
-                    item.hiddenBySection = !valueAttributes['visible'];
+                    item.hiddenBySection = !valueAttributes.visible;
                   }
                 });
               }, this);
@@ -78,7 +79,7 @@ App.configTheme = Em.Object.create({
       var condition = _condition.trim();
       if (condition === '&&' || condition === '||') {
         allConditionResult.push(_condition);
-      }  else {
+      } else {
         var splitIfCondition = condition.split('===');
         var ifCondition = splitIfCondition[0];
         var result = splitIfCondition[1] || "true";

+ 2 - 2
ambari-web/test/mappers/service_metrics_mapper_test.js

@@ -112,8 +112,8 @@ describe('App.serviceMetricsMapper', function () {
 
     tests.forEach(function (test) {
       it(test.message, function () {
-        services[0].components[0].host_components[0].metrics.dfs.FSNamesystem['HAState'] = test.haStateForNn1;
-        services[0].components[0].host_components[1].metrics.dfs.FSNamesystem['HAState'] = test.haStateForNn2;
+        services[0].components[0].host_components[0].metrics.dfs.FSNamesystem.HAState = test.haStateForNn1;
+        services[0].components[0].host_components[1].metrics.dfs.FSNamesystem.HAState = test.haStateForNn2;
         App.serviceMetricsMapper.computeAdditionalRelations(hostComponents, services);
         expect(hostComponents[0].display_name_advanced).to.equal(test.expectedNameForNn1);
         expect(hostComponents[1].display_name_advanced).to.equal(test.expectedNameForNn2);