Browse Source

AMBARI-12142 Strange behavior when comparing config versions of custom config group. (ababiichuk)

aBabiichuk 10 years ago
parent
commit
85d89c699c

+ 7 - 6
ambari-web/app/templates/common/configs/service_config_category.hbs

@@ -112,14 +112,15 @@
                 <span class="help-inline">{{errorMessage}}</span>
                 <span class="help-inline">{{errorMessage}}</span>
                 <span class="help-inline">{{warnMessage}}</span>
                 <span class="help-inline">{{warnMessage}}</span>
               </div>
               </div>
-              {{#if this.isOverridden}}
-                {{view App.ServiceConfigView.SCPOverriddenRowsView
-                serviceConfigPropertyBinding="this"
-                isDefaultGroupSelectedBinding="controller.selectedConfigGroup.isDefault"
-                }}
-              {{/if}}
               {{#if this.isComparison}}
               {{#if this.isComparison}}
                 {{view App.ServiceConfigView.SCPComparisonRowsView serviceConfigPropertyBinding="this"}}
                 {{view App.ServiceConfigView.SCPComparisonRowsView serviceConfigPropertyBinding="this"}}
+              {{else}}
+                {{#if this.isOverridden}}
+                  {{view App.ServiceConfigView.SCPOverriddenRowsView
+                  serviceConfigPropertyBinding="this"
+                  isDefaultGroupSelectedBinding="controller.selectedConfigGroup.isDefault"
+                  }}
+                {{/if}}
               {{/if}}
               {{/if}}
             </div>
             </div>
           </div>
           </div>

+ 1 - 1
ambari-web/app/templates/common/configs/widgets/combo_config_widget.hbs

@@ -16,7 +16,7 @@
 * limitations under the License.
 * limitations under the License.
 }}
 }}
 {{template "templates/common/configs/widgets/config_label"}}
 {{template "templates/common/configs/widgets/config_label"}}
-<div {{bindAttr class=":pull-left view.isOriginalSCP:original-widget view.disabled:disabled view.config.showAsTextBox:hide"}}>
+<div {{bindAttr class=":pull-left view.isOriginalSCP:original-widget view.disabled:disabled view.doNotShowWidget:hide"}}>
   <div class="input-append">
   <div class="input-append">
     <div class="dropdown btn-group">
     <div class="dropdown btn-group">
       {{view Em.TextField valueBinding="view.content.value" disabled="disabled"}}
       {{view Em.TextField valueBinding="view.content.value" disabled="disabled"}}

+ 14 - 8
ambari-web/app/templates/common/configs/widgets/controls.hbs

@@ -16,11 +16,15 @@
 * limitations under the License.
 * limitations under the License.
 }}
 }}
 
 
-
+<div {{bindAttr class="view.isPropertyUndefined::hide :left :widget-config-raw"}}>
+  <i>{{t common.property.undefined}}</i>
+</div>
 {{#if view.supportSwitchToCheckBox}}
 {{#if view.supportSwitchToCheckBox}}
-  <div {{bindAttr class="view.config.showAsTextBox::hide :left :widget-config-raw"}}>
-    {{view App.PlainConfigTextField sectionBinding="view.section" subSectionBinding="view.subSection" configBinding="view.config" disabledBinding="view.canNotEdit"}}
-  </div>
+  {{#unless view.isPropertyUndefined}}
+    <div {{bindAttr class="view.config.showAsTextBox::hide :left :widget-config-raw"}}>
+      {{view App.PlainConfigTextField sectionBinding="view.section" subSectionBinding="view.subSection" configBinding="view.config" disabledBinding="view.canNotEdit"}}
+    </div>
+  {{/unless}}
 {{/if}}
 {{/if}}
 {{#if view.canEdit}}
 {{#if view.canEdit}}
   <div class="widget-config-controls">
   <div class="widget-config-controls">
@@ -128,10 +132,12 @@
 
 
 
 
 {{#if view.isOriginalSCP}}
 {{#if view.isOriginalSCP}}
-  {{view App.ConfigWidgetOverrideView
-  serviceConfigPropertyBinding="view.config"
-  isDefaultGroupSelectedBinding="controller.selectedConfigGroup.isDefault"
-  }}
+  {{#unless view.config.hasCompareDiffs}}
+    {{view App.ConfigWidgetOverrideView
+    serviceConfigPropertyBinding="view.config"
+    isDefaultGroupSelectedBinding="controller.selectedConfigGroup.isDefault"
+    }}
+  {{/unless}}
 {{/if}}
 {{/if}}
 
 
 {{#if view.isComparison}}
 {{#if view.isComparison}}

+ 1 - 1
ambari-web/app/templates/common/configs/widgets/directory_config_widget.hbs

@@ -18,7 +18,7 @@
 
 
 <div {{bindAttr class="view.isOriginalSCP:original-widget"}}>
 <div {{bindAttr class="view.isOriginalSCP:original-widget"}}>
   {{template "templates/common/configs/widgets/config_label"}}
   {{template "templates/common/configs/widgets/config_label"}}
-   <div class="directory-textarea-wrapper">
+   <div  {{bindAttr class=":directory-textarea-wrapper view.doNotShowWidget:hide"}}>
      {{view view.configView}}
      {{view view.configView}}
    </div>
    </div>
    <div class="right">
    <div class="right">

+ 1 - 1
ambari-web/app/templates/common/configs/widgets/list_config_widget.hbs

@@ -19,7 +19,7 @@
 <div {{bindAttr class="view.config.isHiddenByFilter:hide view.isOriginalSCP:original-widget"}}>
 <div {{bindAttr class="view.config.isHiddenByFilter:hide view.isOriginalSCP:original-widget"}}>
   {{template "templates/common/configs/widgets/config_label"}}
   {{template "templates/common/configs/widgets/config_label"}}
   <div class="pull-left btn-group">
   <div class="pull-left btn-group">
-    <a {{bindAttr class=":btn :dropdown-toggle view.config.isEditable::disabled view.config.showAsTextBox:hide"}} data-toggle="dropdown">{{view.displayVal}} <span class="caret"></span></a>
+    <a {{bindAttr class=":btn :dropdown-toggle view.config.isEditable::disabled view.doNotShowWidget:hide"}} data-toggle="dropdown">{{view.displayVal}} <span class="caret"></span></a>
     <ul class="dropdown-menu">
     <ul class="dropdown-menu">
       {{#each option in view.options}}
       {{#each option in view.options}}
         <li>
         <li>

+ 1 - 1
ambari-web/app/templates/common/configs/widgets/slider_config_widget.hbs

@@ -18,7 +18,7 @@
 
 
 <div class="widget-config slider-widget">
 <div class="widget-config slider-widget">
   {{template "templates/common/configs/widgets/config_label"}}
   {{template "templates/common/configs/widgets/config_label"}}
-  <div {{bindAttr class="view.isOriginalSCP:original-widget view.config.showAsTextBox:hide :ui-slider-wrapper"}}>
+  <div {{bindAttr class="view.isOriginalSCP:original-widget view.doNotShowWidget:hide :ui-slider-wrapper"}}>
     <div {{bindAttr class=":pull-left :ui-slider-wrapper-inner"}}>{{view Ember.TextField valueBinding="view.config.value" class="input-mini slider-input"}}</div>
     <div {{bindAttr class=":pull-left :ui-slider-wrapper-inner"}}>{{view Ember.TextField valueBinding="view.config.value" class="input-mini slider-input"}}</div>
   </div>
   </div>
   {{template "templates/common/configs/widgets/controls"}}
   {{template "templates/common/configs/widgets/controls"}}

+ 1 - 1
ambari-web/app/templates/common/configs/widgets/time_interval_spinner.hbs

@@ -17,7 +17,7 @@
 }}
 }}
 
 
 {{template "templates/common/configs/widgets/config_label"}}
 {{template "templates/common/configs/widgets/config_label"}}
-<div {{bindAttr class=":pull-left view.isOriginalSCP:original-widget view.config.showAsTextBox:hide"}}>
+<div {{bindAttr class=":pull-left view.isOriginalSCP:original-widget view.doNotShowWidget:hide"}}>
   {{#each spinnerContent in view.content}}
   {{#each spinnerContent in view.content}}
     {{view App.SpinnerInputView contentBinding="spinnerContent" disabledBinding="view.disabled"}}
     {{view App.SpinnerInputView contentBinding="spinnerContent" disabledBinding="view.disabled"}}
   {{/each}}
   {{/each}}

+ 1 - 1
ambari-web/app/templates/common/configs/widgets/toggle_config_widget.hbs

@@ -17,7 +17,7 @@
 }}
 }}
 
 
 {{template "templates/common/configs/widgets/config_label"}}
 {{template "templates/common/configs/widgets/config_label"}}
-<div {{bindAttr class=":pull-left view.config.showAsTextBox:hide view.isOriginalSCP:original-widget"}}>
+<div {{bindAttr class=":pull-left view.doNotShowWidget:hide view.isOriginalSCP:original-widget"}}>
   {{view Ember.Checkbox checkedBinding="view.switcherValue"}}
   {{view Ember.Checkbox checkedBinding="view.switcherValue"}}
 </div>
 </div>
 {{template "templates/common/configs/widgets/controls"}}
 {{template "templates/common/configs/widgets/controls"}}

+ 0 - 8
ambari-web/app/views/common/configs/service_configs_by_category_view.js

@@ -328,14 +328,6 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
     });
     });
   },
   },
 
 
-  willDestroyElement: function () {
-    if (this.get('parentView.controller.name') == 'mainServiceInfoConfigsController') {
-      this.get('categoryConfigsAll').forEach(function (item) {
-        item.set('isVisible', false);
-      });
-    }
-  },
-
   /**
   /**
    * @returns {string}
    * @returns {string}
    */
    */

+ 23 - 0
ambari-web/app/views/common/configs/widgets/config_widget_view.js

@@ -58,6 +58,24 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
    */
    */
   configLabelClass: '',
   configLabelClass: '',
 
 
+  /**
+   * defines if widget should be shown
+   * if not, text-field with config value or label "Undefined" should be shown
+   * @type {boolean}
+   */
+  doNotShowWidget: function() {
+    return this.get('isPropertyUndefined') || this.get('config.showAsTextBox');
+  }.property('isPropertyUndefined', 'config.showAsTextBox'),
+
+  /**
+   * defines if property in not defined in selected version
+   * in this case "Undefined" should be shown instead of widget
+   * @type {boolean}
+   */
+  isPropertyUndefined: function() {
+    return this.get('config.value') === "Undefined";
+  }.property('config.value'),
+
   /**
   /**
    * Tab where current widget placed
    * Tab where current widget placed
    * Bound in the template
    * Bound in the template
@@ -151,11 +169,13 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
       this.errorLevelObserver();
       this.errorLevelObserver();
       this.addObserver('issuedConfig.warnMessage', this, this.errorLevelObserver);
       this.addObserver('issuedConfig.warnMessage', this, this.errorLevelObserver);
       this.addObserver('issuedConfig.errorMessage', this, this.errorLevelObserver);
       this.addObserver('issuedConfig.errorMessage', this, this.errorLevelObserver);
+      this.addObserver('parentView.isPropertyUndefined', this, this.errorLevelObserver);
     },
     },
 
 
     willDestroyElement: function() {
     willDestroyElement: function() {
       this.removeObserver('issuedConfig.warnMessage', this, this.errorLevelObserver);
       this.removeObserver('issuedConfig.warnMessage', this, this.errorLevelObserver);
       this.removeObserver('issuedConfig.errorMessage', this, this.errorLevelObserver);
       this.removeObserver('issuedConfig.errorMessage', this, this.errorLevelObserver);
+      this.removeObserver('parentView.isPropertyUndefined', this, this.errorLevelObserver);
     },
     },
 
 
     /**
     /**
@@ -164,6 +184,9 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
      */
      */
     errorLevelObserver: function() {
     errorLevelObserver: function() {
       var messageLevel = this.get('issuedConfig.errorMessage') ? 'ERROR': this.get('issuedConfig.warnMessage') ? 'WARN' : 'NONE';
       var messageLevel = this.get('issuedConfig.errorMessage') ? 'ERROR': this.get('issuedConfig.warnMessage') ? 'WARN' : 'NONE';
+      if (this.get('parentView.isPropertyUndefined')) {
+        messageLevel = 'NONE';
+      }
       var issue = {
       var issue = {
         ERROR: {
         ERROR: {
           iconClass: '',
           iconClass: '',