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

2016-06-30 Thread onechiporenko
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 
Authored: Thu Jun 30 15:00:52 2016 +0300
Committer: Oleg Nechiporenko 
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 = '',
 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 conf

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

2016-06-30 Thread onechiporenko
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 129d965d7 -> 52d7fe447


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/52d7fe44
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/52d7fe44
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/52d7fe44

Branch: refs/heads/branch-2.4
Commit: 52d7fe4478fdd13deb4654b3d47ef326b7a15689
Parents: 129d965
Author: Oleg Nechiporenko 
Authored: Thu Jun 30 15:00:52 2016 +0300
Committer: Oleg Nechiporenko 
Committed: Thu Jun 30 17:26:51 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/52d7fe44/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 = '',
 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/52d7fe44/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 () {