ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject [1/2] ambari git commit: Revert "AMBARI-15014 Incorrect #of required properties at Ranger Customize Services page (Next button not enabled). (ababiichuk)"
Date Sat, 13 Feb 2016 07:31:26 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 9adcea949 -> d564f86d7


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

This reverts commit d3d66f2549a16cd1aab17af3e4a7fe033626ca79.


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

Branch: refs/heads/branch-2.2
Commit: a1d7b80ca58bbc924616ce891d7c25d9c62f1312
Parents: 9adcea9
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Sat Feb 13 12:20:31 2016 +0530
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Sat Feb 13 12:20:31 2016 +0530

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/a1d7b80c/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 aff70ca..148a9a2 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -688,7 +688,10 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
               themeResource.get('configProperties').forEach(function (_config) {
                 configs.forEach(function (item) {
                   if (item.name === _config.get('name') && item.filename === _config.get('fileName'))
{
-                    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/a1d7b80c/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 1ea9c59..ebb68ad 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -399,7 +399,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/a1d7b80c/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 d8677d1..71b05e6 100644
--- a/ambari-web/app/models/configs/objects/service_config.js
+++ b/ambari-web/app/models/configs/objects/service_config.js
@@ -61,7 +61,7 @@ App.ServiceConfig = Ember.Object.extend({
         category.incrementProperty('nonSlaveErrorCount');
         masterErrors++;
       }
-      if (!item.get('isValid') && item.get('widgetType') && item.get('isVisible'))
{
+      if (!item.get('isValid') && item.get('widgetType') && item.get('isVisible')
&& !item.get('hiddenBySection')) {
         enhancedConfigsErrors++;
       }
       if (item.get('overrides')) {
@@ -76,7 +76,7 @@ App.ServiceConfig = Ember.Object.extend({
       }
     });
     return masterErrors + slaveErrors + overrideErrors + enhancedConfigsErrors;
-  }.property('configs.@each.isValid', 'configs.@each.isVisible', 'configCategories.@each.slaveErrorCount',
'configs.@each.overrideErrorTrigger'),
+  }.property('configs.@each.isValid', 'configs.@each.isVisible', 'configs.@each.hiddenBySection',
'configCategories.@each.slaveErrorCount', 'configs.@each.overrideErrorTrigger'),
 
   /**
    * checks if for example for kdc_type, the value isn't just the pretty version of the saved
value, for example mit-kdc

http://git-wip-us.apache.org/repos/asf/ambari/blob/a1d7b80c/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 1da8e21..dcc7a1e 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -187,6 +187,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/a1d7b80c/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 d4c9195..ce26a3c 100644
--- a/ambari-web/app/models/configs/theme/sub_section.js
+++ b/ambari-web/app/models/configs/theme/sub_section.js
@@ -182,7 +182,9 @@ App.SubSection = DS.Model.extend({
    * @type {boolean}
    */
   isHiddenByFilter: function () {
-    var configs = this.get('configs').filterProperty('isVisible');
+    var configs = this.get('configs').filter(function(c) {
+      return !c.get('hiddenBySection') && c.get('isVisible');
+    });
     return configs.length ? configs.everyProperty('isHiddenByFilter', true) : false;
   }.property('configs.@each.isHiddenByFilter'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a1d7b80c/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 610a1d3..d5d5349 100644
--- a/ambari-web/app/models/configs/theme/sub_section_tab.js
+++ b/ambari-web/app/models/configs/theme/sub_section_tab.js
@@ -76,7 +76,9 @@ App.SubSectionTab = DS.Model.extend({
    * @type {boolean}
    */
   isHiddenByFilter: function () {
-    var configs = this.get('configs').filterProperty('isVisible');
+    var configs = this.get('configs').filter(function(c) {
+      return !c.get('hiddenBySection') && c.get('isVisible');
+    });
     return configs.length ? configs.everyProperty('isHiddenByFilter', true) : false;
   }.property('configs.@each.isHiddenByFilter'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a1d7b80c/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/a1d7b80c/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 4b4c477..a0515e6 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
@@ -442,6 +442,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]);
+          }
         }
       }
     }
@@ -465,7 +468,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/a1d7b80c/ambari-web/test/models/configs/section_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/section_test.js b/ambari-web/test/models/configs/section_test.js
index f7be9b7..967534e 100644
--- a/ambari-web/test/models/configs/section_test.js
+++ b/ambari-web/test/models/configs/section_test.js
@@ -64,6 +64,13 @@ describe('App.Section', function () {
         },
         {
           subSections: [
+            App.SubSection.createRecord({configs: [Em.Object.create({isHiddenByFilter: true,
isVisible: false, hiddenBySection: false}), Em.Object.create({isHiddenByFilter: true, isVisible:
true, hiddenBySection: true})]})
+          ],
+          m: 'no subsections are hidden (hiddenBySection)',
+          e: false
+        },
+        {
+          subSections: [
             App.SubSection.createRecord({configs: [Em.Object.create({isHiddenByFilter: true,
isVisible: true}), Em.Object.create({isHiddenByFilter: true, isVisible: true})]}),
             App.SubSection.createRecord({configs: [Em.Object.create({isHiddenByFilter: false,
isVisible: true}), Em.Object.create({isHiddenByFilter: false, isVisible: true})]})
           ],


Mime
View raw message