ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-17500. UI: a popup with a property descriprtion doesn't fade away (onechiporenko)
Date Thu, 30 Jun 2016 14:27:29 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk febdf2132 -> db798a76c


AMBARI-17500. UI: a popup with a property descriprtion doesn't fade away (onechiporenko)


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

Branch: refs/heads/trunk
Commit: db798a76cbf16ee1847481da181ff080a9d92f8d
Parents: febdf21
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Thu Jun 30 15:00:52 2016 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Thu Jun 30 17:27:13 2016 +0300

----------------------------------------------------------------------
 .../service/configs/widget_popover_support.js   | 30 ++++++++++++++++----
 .../configs/widgets/config_widget_view.js       | 16 +++++------
 .../test/mixins/common/serverValidator_test.js  |  2 +-
 .../widgets/combo_config_widget_view_test.js    |  3 +-
 .../configs/widgets/config_widget_view_test.js  |  1 +
 .../widgets/list_config_widget_view_test.js     |  1 +
 .../widgets/slider_config_widget_view_test.js   |  1 +
 .../widgets/time_interval_spinner_view_test.js  |  1 +
 .../widgets/toggle_config_widget_view_test.js   |  1 +
 9 files changed, 40 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/db798a76/ambari-web/app/mixins/main/service/configs/widget_popover_support.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/service/configs/widget_popover_support.js b/ambari-web/app/mixins/main/service/configs/widget_popover_support.js
index 3974465..ded8dd9 100644
--- a/ambari-web/app/mixins/main/service/configs/widget_popover_support.js
+++ b/ambari-web/app/mixins/main/service/configs/widget_popover_support.js
@@ -39,24 +39,26 @@ App.WidgetPopoverSupport = Em.Mixin.create({
 
   /**
    * Where popover should be displayed - top|left|right|bottom
+   * popover to left if config is located at the right most sub-section of the right most
section.
+   *
    * @type {string}
    */
   popoverPlacement: function () {
-    // popover to left if config is located at the right most sub-section of the right most
section.
     return this.get('section.isLastColumn') && this.get('subSection.isLastColumn')?
'left' : 'right';
-  }.property(),
+  }.property('section.isLastColumn', 'subSection.isLastColumn'),
 
   initPopover: function () {
     if (this.get('isPopoverEnabled') !== false) {
+      this.destroyPopover();
       var leftPopoverTemplate = '<div class="popover config-widget-left-popover"><div
class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div
class="popover-content"><p></p></div></div></div>',
         isWidget = !Em.isEmpty(this.$('.original-widget')),
         popoverSelector = isWidget ? this.$('.original-widget') : this.$('.input-append');
 
       App.popover(popoverSelector, {
-        template: this.get('popoverPlacement') == 'left'? leftPopoverTemplate : undefined,
+        template: this.get('popoverPlacement') === 'left'? leftPopoverTemplate : undefined,
         title: Em.I18n.t('installer.controls.serviceConfigPopover.title').format(
           this.get('configLabel'),
-          (this.get('configLabel') == this.get('config.name')) ? '' : this.get('config.name')
+          this.get('configLabel') === this.get('config.name') ? '' : this.get('config.name')
         ),
         content: this.get('config.description'),
         placement: this.get('popoverPlacement'),
@@ -66,11 +68,27 @@ App.WidgetPopoverSupport = Em.Mixin.create({
           hide: 0
         }
       });
+      this.on('willDestroyElement', this, this.destroyPopover);
     }
   },
 
-  willDestroyElement: function() {
-    this.$().popover('destroy');
+  /**
+   * Destroy popover after config becomes hidden
+   */
+  destroyPopover: function () {
+    this.movePopover('destroy');
+  },
+
+  /**
+   * Hide popover on config state changing (from widget-view to raw-mode and from raw-mode
to widget-view)
+   */
+  hidePopover: function () {
+    this.movePopover('hide');
+  }.observes('config.showAsTextBox'),
+
+  movePopover: function (action) {
+    var popoverSelector = Em.isEmpty(this.$('.original-widget')) ? this.$('.input-append')
: this.$('.original-widget');
+    this.$(popoverSelector).popover(action);
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/db798a76/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 817643a..86ae3f3 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
@@ -320,7 +320,7 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
    */
   showFinalConfig: function () {
     var config = this.get('config');
-    return config.get('isFinal') || (!config.get('isNotEditable') && this.get('isHover'));
+    return config.get('isFinal') || !config.get('isNotEditable') && this.get('isHover');
   }.property('config.isFinal', 'config.isNotEditable', 'isHover'),
 
   /**
@@ -376,7 +376,7 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
       this.configValueObserverForAttributes();
 
       //Add Observer to configCondition that depends on another config value
-      var isConditionConfigDependent =  configConditions.filterProperty('resource', 'config').length;
+      var isConditionConfigDependent = configConditions.filterProperty('resource', 'config').length;
       if (isConditionConfigDependent) {
         this.addObserver('config.value', this, this.configValueObserverForAttributes);
       }
@@ -405,7 +405,7 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
     var serviceConfigs = this.get('controller.stepConfigs').findProperty('serviceName',serviceName).get('configs');
     var isConditionTrue;
     configConditions.forEach(function(configCondition){
-      var ifStatement =  configCondition.get("if");
+      var ifStatement = configCondition.get("if");
       if (configCondition.get("resource") === 'config') {
         isConditionTrue = App.configTheme.calculateConfigCondition(ifStatement, serviceConfigs);
         if (configCondition.get("type") === 'subsection' || configCondition.get("type") ===
'subsectionTab') {
@@ -434,7 +434,7 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
    * @method {configValueObserverForAction}
    */
   configValueObserverForAction: function() {
-    var assignMasterOnStep7Controller =  App.router.get('assignMasterOnStep7Controller');
+    var assignMasterOnStep7Controller = App.router.get('assignMasterOnStep7Controller');
     var configAction = this.get('config.configAction');
     var serviceName = this.get('config.serviceName');
     var serviceConfigs = this.get('controller.stepConfigs').findProperty('serviceName', serviceName).get('configs');
@@ -512,15 +512,15 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs,
App.WidgetPo
     var action = isConditionTrue ? subsectionCondition.get("then") : subsectionCondition.get("else");
     if (subsectionCondition.get('id')) {
       var valueAttributes = action.property_value_attributes;
-      if (valueAttributes && !Em.none(valueAttributes['visible'])) {
+      if (valueAttributes && !Em.none(valueAttributes.visible)) {
         var themeResource;
         if (subsectionCondition.get('type') === 'subsection') {
           themeResource = App.SubSection.find().findProperty('name', subsectionConditionName);
         } else if (subsectionCondition.get('type') === 'subsectionTab') {
           themeResource = App.SubSectionTab.find().findProperty('name', subsectionConditionName);
         }
-        themeResource.set('isHiddenByConfig', !valueAttributes['visible']);
-        themeResource.get('configs').setEach('hiddenBySection', !valueAttributes['visible']);
+        themeResource.set('isHiddenByConfig', !valueAttributes.visible);
+        themeResource.get('configs').setEach('hiddenBySection', !valueAttributes.visible);
       }
     }
   },
@@ -584,7 +584,7 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
    * @returns {boolean}
    */
   isValueCompatibleWithWidget: function() {
-    return (this.get('isOverrideEqualityError') && !this.get('config.isValid')) ||
this.get('config.isValid') || !this.get('supportSwitchToTextBox');
+    return this.get('isOverrideEqualityError') && !this.get('config.isValid') ||
this.get('config.isValid') || !this.get('supportSwitchToTextBox');
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/db798a76/ambari-web/test/mixins/common/serverValidator_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/serverValidator_test.js b/ambari-web/test/mixins/common/serverValidator_test.js
index 4a22e28..943eb57 100644
--- a/ambari-web/test/mixins/common/serverValidator_test.js
+++ b/ambari-web/test/mixins/common/serverValidator_test.js
@@ -177,7 +177,7 @@ describe('App.ServerValidatorMixin', function () {
       });
     });
 
-    it('creates general issue object', function() {
+    it('creates WRONG TYPE issue object', function() {
       expect(instanceObject.createErrorMessage.bind(instanceObject, 'WRONG TYPE', null, ['msg3']))
         .to.throw(Error, 'Unknown config error type WRONG TYPE');
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/db798a76/ambari-web/test/views/common/configs/widgets/combo_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/combo_config_widget_view_test.js
b/ambari-web/test/views/common/configs/widgets/combo_config_widget_view_test.js
index 9f3c254..9cf2d85 100644
--- a/ambari-web/test/views/common/configs/widgets/combo_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/combo_config_widget_view_test.js
@@ -22,7 +22,8 @@ describe('App.ComboConfigWidgetView', function() {
 
   beforeEach(function() {
     this.view = App.ComboConfigWidgetView.create({
-      initPopover: Em.K
+      initPopover: Em.K,
+      movePopover: Em.K
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/db798a76/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
index 096918e..f7efd7f 100644
--- a/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
@@ -23,6 +23,7 @@ var view;
 function getView() {
   return App.ConfigWidgetView.create({
     initPopover: Em.K,
+    movePopover: Em.K,
     config: Em.Object.create({
       isOriginalSCP: false,
       isPropertyOverridable: false,

http://git-wip-us.apache.org/repos/asf/ambari/blob/db798a76/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
b/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
index 47dfc5d..66f9d09 100644
--- a/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
@@ -25,6 +25,7 @@ describe('App.ListConfigWidgetView', function () {
 
     view = App.ListConfigWidgetView.create({
       initPopover: Em.K,
+      movePopover: Em.K,
       config: Em.Object.create({
         validate: App.ServiceConfigProperty.prototype.validate,
         name: 'a.b.c',

http://git-wip-us.apache.org/repos/asf/ambari/blob/db798a76/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
index d757b2e..86f9431 100644
--- a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
@@ -26,6 +26,7 @@ describe('App.SliderConfigWidgetView', function () {
     viewInt = App.SliderConfigWidgetView.create({
       initSlider: Em.K,
       initPopover: Em.K,
+      movePopover: Em.K,
       slider: {
         enable: Em.K,
         disable: Em.K,

http://git-wip-us.apache.org/repos/asf/ambari/blob/db798a76/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
b/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
index 04564a3..b6300d3 100644
--- a/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
@@ -23,6 +23,7 @@ describe('App.TimeIntervalSpinnerView', function () {
 
   beforeEach(function () {
     view = App.TimeIntervalSpinnerView.create({
+      movePopover: Em.K,
       controller: Em.Object.create({
         removeCurrentFromDependentList: Em.K
       }),

http://git-wip-us.apache.org/repos/asf/ambari/blob/db798a76/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
b/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
index 44d8322..4c54b8a 100644
--- a/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
@@ -25,6 +25,7 @@ describe('App.ToggleConfigWidgetView', function () {
     this.view = App.ToggleConfigWidgetView.create({
       initSwitcher: Em.K,
       initPopover: Em.K,
+      movePopover: Em.K,
       config: Em.Object.create({
         name: 'a.b.c',
         value: 'active',


Mime
View raw message