You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2016/02/16 19:30:35 UTC

[30/50] [abbrv] ambari git commit: Revert "AMBARI-15014 Incorrect #of required properties at Ranger Customize Services page (Next button not enabled). (ababiichuk)"

Revert "AMBARI-15014 Incorrect #of required properties at Ranger Customize Services page (Next button not enabled). (ababiichuk)"

This reverts commit 2ca172d4ce7fa6e025ce512212b07eab25f38bcc.


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 1319763ec7aa4e436ce2ff30d138180d2a2194b1
Parents: 9e5dd9f
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Sat Feb 13 13:04:29 2016 +0530
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Sat Feb 13 13:04:29 2016 +0530

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  |  5 ++-
 ambari-web/app/mixins/common/serverValidator.js |  2 +-
 .../models/configs/objects/service_config.js    |  6 ++-
 .../configs/objects/service_config_property.js  |  6 +++
 .../app/models/configs/theme/sub_section.js     | 12 +++--
 .../app/models/configs/theme/sub_section_tab.js |  6 ++-
 .../config_recommendation_popup.hbs             | 46 ++++++++++----------
 .../configs/widgets/config_widget_view.js       |  5 ++-
 .../configs/objects/service_config_test.js      |  7 ++-
 9 files changed, 64 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1319763e/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 ee37427..634c86b 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -680,7 +680,10 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
               themeResource.get('configProperties').forEach(function (_configId) {
                 configs.forEach(function (item) {
                   if (App.config.configId(item.name, item.filename) === _configId) {
-                    item.isVisible = valueAttributes['visible'];
+                    // 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'];
                   }
                 });
               }, this);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1319763e/ambari-web/app/mixins/common/serverValidator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index 231c376..99a5921 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -301,7 +301,7 @@ App.ServerValidatorMixin = Em.Mixin.create({
         : self.get('stepConfigs');
       var configsWithErrors = stepConfigs.some(function (step) {
         return step.get('configs').some(function(c) {
-          return c.get('isVisible') && (c.get('warn') || c.get('error'));
+          return c.get('isVisible') && !c.get('hiddenBySection') && (c.get('warn') || c.get('error'));
         })
       });
       if (configsWithErrors) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1319763e/ambari-web/app/models/configs/objects/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config.js b/ambari-web/app/models/configs/objects/service_config.js
index c75486c..56b8aa4 100644
--- a/ambari-web/app/models/configs/objects/service_config.js
+++ b/ambari-web/app/models/configs/objects/service_config.js
@@ -38,7 +38,11 @@ App.ServiceConfig = Ember.Object.extend({
 
   errorCount: Em.computed.alias('configsWithErrors.length'),
 
-  visibleProperties: Em.computed.filterBy('configs', 'isVisible', true),
+  visibleProperties: function() {
+    return this.get('configs').filter(function(c) {
+      return c.get('isVisible') && !c.get('hiddenBySection');
+    });
+  }.property('configs.@each.isVisible', 'configs.@each.hiddenBySection'),
 
   configsWithErrors: function() {
     return this.get('visibleProperties').filter(function(c) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1319763e/ambari-web/app/models/configs/objects/service_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_property.js b/ambari-web/app/models/configs/objects/service_config_property.js
index 422dc22..21e3dd3 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -180,6 +180,12 @@ App.ServiceConfigProperty = Em.Object.extend({
   showAsTextBox: false,
 
   /**
+   * config is invisible since wrapper section is hidden
+   * @type {boolean}
+   */
+  hiddenBySection: false,
+
+  /**
    * @type {boolean}
    */
   recommendedValueExists: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1319763e/ambari-web/app/models/configs/theme/sub_section.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/theme/sub_section.js b/ambari-web/app/models/configs/theme/sub_section.js
index 62729ff..7274569 100644
--- a/ambari-web/app/models/configs/theme/sub_section.js
+++ b/ambari-web/app/models/configs/theme/sub_section.js
@@ -94,7 +94,11 @@ App.SubSection = DS.Model.extend({
 
   showTabs: Em.computed.and('hasTabs', 'someSubSectionTabIsVisible'),
 
-  visibleProperties: Em.computed.filterBy('configs', 'isVisible', true),
+  visibleProperties: function() {
+    return this.get('configs').filter(function(c) {
+      return c.get('isVisible') && !c.get('hiddenBySection');
+    });
+  }.property('configs.@each.isVisible', 'configs.@each.hiddenBySection'),
 
   visibleTabs: Em.computed.filterBy('subSectionTabs', 'isVisible', true),
 
@@ -174,9 +178,11 @@ App.SubSection = DS.Model.extend({
    * @type {boolean}
    */
   isHiddenByFilter: function () {
-    var configs = this.get('visibleProperties');
+    var configs = this.get('configs').filter(function(c) {
+      return !c.get('hiddenBySection') && c.get('isVisible');
+    });
     return configs.length ? configs.everyProperty('isHiddenByFilter', true) : false;
-  }.property('visibleProperties.@each.isHiddenByFilter'),
+  }.property('configs.@each.isHiddenByFilter'),
 
   /**
    * @type {boolean}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1319763e/ambari-web/app/models/configs/theme/sub_section_tab.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/theme/sub_section_tab.js b/ambari-web/app/models/configs/theme/sub_section_tab.js
index 236c5c7..2262882 100644
--- a/ambari-web/app/models/configs/theme/sub_section_tab.js
+++ b/ambari-web/app/models/configs/theme/sub_section_tab.js
@@ -55,7 +55,11 @@ App.SubSectionTab = DS.Model.extend({
    */
   isActive: DS.attr('boolean', {defaultValue: false}),
 
-  visibleProperties: Em.computed.filterBy('configs', 'isVisible', true),
+  visibleProperties: function() {
+    return this.get('configs').filter(function(c) {
+      return c.get('isVisible') && !c.get('hiddenBySection');
+    });
+  }.property('configs.@each.isVisible', 'configs.@each.hiddenBySection'),
 
   /**
    * Number of the errors in all configs

http://git-wip-us.apache.org/repos/asf/ambari/blob/1319763e/ambari-web/app/templates/common/modal_popups/config_recommendation_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/config_recommendation_popup.hbs b/ambari-web/app/templates/common/modal_popups/config_recommendation_popup.hbs
index fab5742..f58e086 100644
--- a/ambari-web/app/templates/common/modal_popups/config_recommendation_popup.hbs
+++ b/ambari-web/app/templates/common/modal_popups/config_recommendation_popup.hbs
@@ -31,28 +31,30 @@
       {{#each service in view.serviceConfigs}}
         {{#each property in service.configs}}
           {{#if property.isVisible}}
-            {{#if property.warn}}
-              <tr>
-                <td>{{property.serviceName}}</td>
-                <td>{{property.name}}</td>
-                <td>{{property.value}}</td>
-                <td>
-                  <div class="property-message">{{property.warnMessage}}</div>
-                  <div class="property-description">{{property.description}}</div>
-                </td>
-              </tr>
-            {{/if}}
-            {{#if property.error}}
-              <tr>
-                <td>{{property.serviceName}}</td>
-                <td>{{property.name}}</td>
-                <td>{{property.value}}</td>
-                <td>
-                  <div class="property-message">{{property.errorMessage}}</div>
-                  <div class="property-description">{{property.description}}</div>
-                </td>
-              </tr>
-            {{/if}}
+            {{#unless property.hiddenBySection}}
+              {{#if property.warn}}
+                <tr>
+                  <td>{{property.serviceName}}</td>
+                  <td>{{property.name}}</td>
+                  <td>{{property.value}}</td>
+                  <td>
+                    <div class="property-message">{{property.warnMessage}}</div>
+                    <div class="property-description">{{property.description}}</div>
+                  </td>
+                </tr>
+              {{/if}}
+              {{#if property.error}}
+                <tr>
+                  <td>{{property.serviceName}}</td>
+                  <td>{{property.name}}</td>
+                  <td>{{property.value}}</td>
+                  <td>
+                    <div class="property-message">{{property.errorMessage}}</div>
+                    <div class="property-description">{{property.description}}</div>
+                  </td>
+                </tr>
+              {{/if}}
+            {{/unless}}
           {{/if}}
         {{/each}}
       {{/each}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1319763e/ambari-web/app/views/common/configs/widgets/config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/config_widget_view.js b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
index 9052b2a..e9eaed2 100644
--- a/ambari-web/app/views/common/configs/widgets/config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
@@ -434,6 +434,9 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
         var conditionalConfig = serviceConfigs.filterProperty('filename',conditionalConfigFileName).findProperty('name', conditionalConfigName);
         if (conditionalConfig) {
           conditionalConfig.set(valueAttribute, valueAttributes[key]);
+          if (valueAttribute === 'isVisible') {
+            conditionalConfig.set('hiddenBySection', !valueAttributes[key]);
+          }
         }
       }
     }
@@ -457,7 +460,7 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
           themeResource = App.SubSectionTab.find().findProperty('name', subsectionConditionName);
         }
         themeResource.set('isHiddenByConfig', !valueAttributes['visible']);
-        themeResource.get('configs').setEach('isVisible', valueAttributes['visible']);
+        themeResource.get('configs').setEach('hiddenBySection', !valueAttributes['visible']);
       }
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/1319763e/ambari-web/test/models/configs/objects/service_config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/objects/service_config_test.js b/ambari-web/test/models/configs/objects/service_config_test.js
index e12f23d..8a757ea 100644
--- a/ambari-web/test/models/configs/objects/service_config_test.js
+++ b/ambari-web/test/models/configs/objects/service_config_test.js
@@ -25,30 +25,35 @@ var serviceConfig,
       Em.Object.create({
         'name': 'p1',
         'isVisible': true,
+        'hiddenBySection': false,
         'isValid': true,
         'isValidOverride': true
       }),
       Em.Object.create({
         'name': 'p2',
         'isVisible': false,
+        'hiddenBySection': false,
         'isValid': true,
         'isValidOverride': true
       }),
       Em.Object.create({
         'name': 'p3',
         'isVisible': true,
+        'hiddenBySection': true,
         'isValid': true,
         'isValidOverride': true
       }),
       Em.Object.create({
         'name': 'p4',
         'isVisible': true,
+        'hiddenBySection': false,
         'isValid': false,
         'isValidOverride': true
       }),
       Em.Object.create({
         'name': 'p5',
         'isVisible': true,
+        'hiddenBySection': false,
         'isValid': true,
         'isValidOverride': false
       })
@@ -64,7 +69,7 @@ describe('App.ServiceConfig', function () {
 
   describe('#visibleProperties', function() {
     it('returns collection of properties that should be shown', function() {
-      expect(serviceConfig.get('visibleProperties').mapProperty('name')).to.be.eql(['p1','p3', 'p4','p5']);
+      expect(serviceConfig.get('visibleProperties').mapProperty('name')).to.be.eql(['p1','p4','p5']);
     });
   });