瀏覽代碼

AMBARI-2931. Popover stuck after routing to another page. (atkach via yusaku)

Yusaku Sako 11 年之前
父節點
當前提交
b51f04229e

+ 14 - 1
ambari-web/app/utils/helper.js

@@ -350,4 +350,17 @@ App.format = {
   taskStatus:function (_taskStatus) {
     return _taskStatus.toLowerCase();
   }
-};
+};
+
+/**
+ * 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');
+  });
+}

+ 3 - 3
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',

+ 1 - 1
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'});
   }
 });

+ 1 - 1
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();
   },
 

+ 1 - 1
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);

+ 1 - 1
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',