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

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

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


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

Branch: refs/heads/trunk
Commit: 2ca172d4ce7fa6e025ce512212b07eab25f38bcc
Parents: 6d258d7
Author: ababiichuk <ab...@hortonworks.com>
Authored: Thu Feb 11 15:20:33 2016 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Feb 11 17:46:11 2016 +0200

----------------------------------------------------------------------
 .../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, 31 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2ca172d4/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 c92e83d..c6f4689 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -676,10 +676,7 @@ 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) {
-                    // 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.isVisible = valueAttributes['visible'];
                   }
                 });
               }, this);

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ca172d4/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 99a5921..231c376 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('hiddenBySection') && (c.get('warn') || c.get('error'));
+          return c.get('isVisible') && (c.get('warn') || c.get('error'));
         })
       });
       if (configsWithErrors) {

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

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ca172d4/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 21e3dd3..422dc22 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -180,12 +180,6 @@ 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/2ca172d4/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 7274569..62729ff 100644
--- a/ambari-web/app/models/configs/theme/sub_section.js
+++ b/ambari-web/app/models/configs/theme/sub_section.js
@@ -94,11 +94,7 @@ App.SubSection = DS.Model.extend({
 
   showTabs: Em.computed.and('hasTabs', 'someSubSectionTabIsVisible'),
 
-  visibleProperties: function() {
-    return this.get('configs').filter(function(c) {
-      return c.get('isVisible') && !c.get('hiddenBySection');
-    });
-  }.property('configs.@each.isVisible', 'configs.@each.hiddenBySection'),
+  visibleProperties: Em.computed.filterBy('configs', 'isVisible', true),
 
   visibleTabs: Em.computed.filterBy('subSectionTabs', 'isVisible', true),
 
@@ -178,11 +174,9 @@ App.SubSection = DS.Model.extend({
    * @type {boolean}
    */
   isHiddenByFilter: function () {
-    var configs = this.get('configs').filter(function(c) {
-      return !c.get('hiddenBySection') && c.get('isVisible');
-    });
+    var configs = this.get('visibleProperties');
     return configs.length ? configs.everyProperty('isHiddenByFilter', true) : false;
-  }.property('configs.@each.isHiddenByFilter'),
+  }.property('visibleProperties.@each.isHiddenByFilter'),
 
   /**
    * @type {boolean}

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

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ca172d4/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 f58e086..fab5742 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,30 +31,28 @@
       {{#each service in view.serviceConfigs}}
         {{#each property in service.configs}}
           {{#if property.isVisible}}
-            {{#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 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}}
           {{/if}}
         {{/each}}
       {{/each}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ca172d4/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 e9eaed2..9052b2a 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,9 +434,6 @@ 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]);
-          }
         }
       }
     }
@@ -460,7 +457,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('hiddenBySection', !valueAttributes['visible']);
+        themeResource.get('configs').setEach('isVisible', valueAttributes['visible']);
       }
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ca172d4/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 8a757ea..e12f23d 100644
--- a/ambari-web/test/models/configs/objects/service_config_test.js
+++ b/ambari-web/test/models/configs/objects/service_config_test.js
@@ -25,35 +25,30 @@ 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
       })
@@ -69,7 +64,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','p4','p5']);
+      expect(serviceConfig.get('visibleProperties').mapProperty('name')).to.be.eql(['p1','p3', 'p4','p5']);
     });
   });