Updated Branches: refs/heads/trunk 83683f607 -> b51f04229
AMBARI-2931. Popover stuck after routing to another page. (atkach via yusaku) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/b51f0422 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/b51f0422 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/b51f0422 Branch: refs/heads/trunk Commit: b51f04229eed6b247a030f7e2bf1a4488bca8d9d Parents: 83683f6 Author: Yusaku Sako <[email protected]> Authored: Fri Aug 16 10:16:07 2013 -0700 Committer: Yusaku Sako <[email protected]> Committed: Fri Aug 16 10:16:33 2013 -0700 ---------------------------------------------------------------------- ambari-web/app/utils/helper.js | 15 ++++++++++++++- ambari-web/app/views/wizard/controls_view.js | 6 +++--- .../app/views/wizard/stack_upgrade/step2_view.js | 2 +- ambari-web/app/views/wizard/step0_view.js | 2 +- ambari-web/app/views/wizard/step2_view.js | 2 +- ambari-web/app/views/wizard/step6_view.js | 2 +- 6 files changed, 21 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/b51f0422/ambari-web/app/utils/helper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js index d62f990..f234035 100644 --- a/ambari-web/app/utils/helper.js +++ b/ambari-web/app/utils/helper.js @@ -350,4 +350,17 @@ App.format = { taskStatus:function (_taskStatus) { return _taskStatus.toLowerCase(); } -}; \ No newline at end of file +}; + +/** + * wrapper to bootstrap popover + * fix issue when popover stuck on view routing + * @param self + * @param options + */ +App.popover = function(self, options) { + self.popover(options); + self.on("remove", function () { + $(this).trigger('mouseleave'); + }); +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/b51f0422/ambari-web/app/views/wizard/controls_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/wizard/controls_view.js b/ambari-web/app/views/wizard/controls_view.js index 7c49f9b..975744f 100644 --- a/ambari-web/app/views/wizard/controls_view.js +++ b/ambari-web/app/views/wizard/controls_view.js @@ -33,7 +33,7 @@ App.ServiceConfigPopoverSupport = Ember.Mixin.create({ didInsertElement: function () { if (this.get('isPopoverEnabled') !== 'false') { - this.$().popover({ + App.popover(this.$(), { title: Em.I18n.t('installer.controls.serviceConfigPopover.title').format(this.get('serviceConfig.displayName'), this.get('serviceConfig.name')), content: this.get('serviceConfig.description'), placement: 'right', @@ -356,7 +356,7 @@ App.ServiceConfigHostPopoverSupport = Ember.Mixin.create({ serviceConfig: null, didInsertElement: function () { - this.$().popover({ + App.popover(this.$(), { title: this.get('serviceConfig.displayName'), content: this.get('serviceConfig.description'), placement: 'right', @@ -485,7 +485,7 @@ App.AddSlaveComponentGroupButton = Ember.View.extend({ slaveComponentName: null, didInsertElement: function () { - this.$().popover({ + App.popover(this.$(), { title: Em.I18n.t('installer.controls.addSlaveComponentGroupButton.title').format(this.get('slaveComponentName')), content: Em.I18n.t('installer.controls.addSlaveComponentGroupButton.content').format(this.get('slaveComponentName'), this.get('slaveComponentName'), this.get('slaveComponentName')), placement: 'right', http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/b51f0422/ambari-web/app/views/wizard/stack_upgrade/step2_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/wizard/stack_upgrade/step2_view.js b/ambari-web/app/views/wizard/stack_upgrade/step2_view.js index d2efff3..d026f06 100644 --- a/ambari-web/app/views/wizard/stack_upgrade/step2_view.js +++ b/ambari-web/app/views/wizard/stack_upgrade/step2_view.js @@ -22,6 +22,6 @@ var App = require('app'); App.StackUpgradeStep2View = Em.View.extend({ templateName: require('templates/wizard/stack_upgrade/step2'), didInsertElement: function(){ - $("[rel=popover]").popover({'placement': 'right', 'trigger': 'hover'}); + App.popover($("[rel=popover]"), {'placement': 'right', 'trigger': 'hover'}); } }); http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/b51f0422/ambari-web/app/views/wizard/step0_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/wizard/step0_view.js b/ambari-web/app/views/wizard/step0_view.js index 11bbcc3..f1de05c 100644 --- a/ambari-web/app/views/wizard/step0_view.js +++ b/ambari-web/app/views/wizard/step0_view.js @@ -29,7 +29,7 @@ App.WizardStep0View = Em.View.extend({ //todo: create property for placeholder(go to template) didInsertElement: function () { - $("[rel=popover]").popover({'placement': 'right', 'trigger': 'hover'}); + App.popover($("[rel=popover]"), {'placement': 'right', 'trigger': 'hover'}); this.get('controller').loadStep(); }, http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/b51f0422/ambari-web/app/views/wizard/step2_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/wizard/step2_view.js b/ambari-web/app/views/wizard/step2_view.js index e9cce9e..24d96e8 100644 --- a/ambari-web/app/views/wizard/step2_view.js +++ b/ambari-web/app/views/wizard/step2_view.js @@ -49,7 +49,7 @@ App.WizardStep2View = Em.View.extend({ didInsertElement: function () { //TODO: move it to separate function in Ember.View using reopenClass - $("[rel=popover]").popover({'placement': 'right', 'trigger': 'hover'}); + App.popover($("[rel=popover]"), {'placement': 'right', 'trigger': 'hover'}); //todo: move them to conroller this.set('controller.hostsError',null); http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/b51f0422/ambari-web/app/views/wizard/step6_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/wizard/step6_view.js b/ambari-web/app/views/wizard/step6_view.js index ac284df..deca4be 100644 --- a/ambari-web/app/views/wizard/step6_view.js +++ b/ambari-web/app/views/wizard/step6_view.js @@ -76,7 +76,7 @@ App.WizardStep6HostView = Em.View.extend({ return App.format.role(_component); }); components = components.join(" /\n"); - this.$().popover({ + App.popover(this.$(), { title: Em.I18n.t('installer.step6.wizardStep6Host.title').format(this.get('host.hostName')), content: components, placement: 'right',
