Repository: ambari Updated Branches: refs/heads/trunk 670ad6f4c -> 01a43eef3
AMBARI-15463 JS Error after config group switching. (ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/01a43eef Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/01a43eef Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/01a43eef Branch: refs/heads/trunk Commit: 01a43eef35106ea27dcf4412f1d876873675cf2c Parents: 670ad6f Author: ababiichuk <ababiic...@hortonworks.com> Authored: Thu Mar 17 15:53:32 2016 +0200 Committer: ababiichuk <ababiic...@hortonworks.com> Committed: Thu Mar 17 17:06:01 2016 +0200 ---------------------------------------------------------------------- .../app/templates/common/configs/controls.hbs | 5 +-- .../common/configs/overriddenProperty.hbs | 4 +-- .../common/configs/widgets/controls.hbs | 5 +-- .../common/configs/overriddenProperty_view.js | 5 --- ambari-web/app/views/common/controls_view.js | 32 ++++++++++++++++++++ 5 files changed, 35 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/01a43eef/ambari-web/app/templates/common/configs/controls.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/controls.hbs b/ambari-web/app/templates/common/configs/controls.hbs index b6439cb..ee67594 100644 --- a/ambari-web/app/templates/common/configs/controls.hbs +++ b/ambari-web/app/templates/common/configs/controls.hbs @@ -17,10 +17,7 @@ }} {{#if view.showSwitchToGroup}} - <a rel='SwitchGroupTooltip' {{bindAttr data-original-title="this.group.switchGroupTextShort" class="switchGroupAvailable:show:hide :action"}} - {{action selectConfigGroup group target="controller"}}> - {{group.switchGroupTextShort}} - </a> + {{view App.SwitchToGroupView controllerBinding="controller" groupBinding="this.group"}} {{else}} {{#if view.showIsFinal}} <a href="#" data-toggle="tooltip" http://git-wip-us.apache.org/repos/asf/ambari/blob/01a43eef/ambari-web/app/templates/common/configs/overriddenProperty.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/overriddenProperty.hbs b/ambari-web/app/templates/common/configs/overriddenProperty.hbs index 9500b90..954da75 100644 --- a/ambari-web/app/templates/common/configs/overriddenProperty.hbs +++ b/ambari-web/app/templates/common/configs/overriddenProperty.hbs @@ -29,9 +29,7 @@ {{/if}} {{#if view.isDefaultGroupSelected}} {{#if overriddenSCP.group}} - <a href="#" data-toggle="tooltip" {{bindAttr data-original-title="overriddenSCP.group.switchGroupTextFull" }} class="action" {{action selectConfigGroup overriddenSCP.group target="controller"}}> - {{overriddenSCP.group.switchGroupTextShort}} - </a> + {{view App.SwitchToGroupView controllerBinding="controller" groupBinding="overriddenSCP.group"}} {{/if}} {{else}} {{#if overriddenSCP.isEditable}} http://git-wip-us.apache.org/repos/asf/ambari/blob/01a43eef/ambari-web/app/templates/common/configs/widgets/controls.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/widgets/controls.hbs b/ambari-web/app/templates/common/configs/widgets/controls.hbs index d6278d9..9c6197b 100644 --- a/ambari-web/app/templates/common/configs/widgets/controls.hbs +++ b/ambari-web/app/templates/common/configs/widgets/controls.hbs @@ -96,10 +96,7 @@ {{#if controller.selectedConfigGroup.isDefault}} {{#if view.configGroup}} - <a href="#" data-toggle="tooltip" {{bindAttr data-original-title="view.configGroup.switchGroupTextFull" }} - class="action" {{action selectConfigGroup view.configGroup target="controller"}}> - {{view.configGroup.switchGroupTextShort}} - </a> + {{view App.SwitchToGroupView controllerBinding="controller" groupBinding="view.configGroup"}} {{/if}} {{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/01a43eef/ambari-web/app/views/common/configs/overriddenProperty_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/overriddenProperty_view.js b/ambari-web/app/views/common/configs/overriddenProperty_view.js index 2c72a1a..8623d71 100644 --- a/ambari-web/app/views/common/configs/overriddenProperty_view.js +++ b/ambari-web/app/views/common/configs/overriddenProperty_view.js @@ -43,7 +43,6 @@ App.ServiceConfigView.SCPOverriddenRowsView = Ember.View.extend({ }, setSwitchText: function () { - Em.$('body>.tooltip').remove(); if (this.get('isDefaultGroupSelected')) { var overrides = this.get('serviceConfigProperty.overrides'); if (!overrides) return; @@ -55,9 +54,6 @@ App.ServiceConfigView.SCPOverriddenRowsView = Ember.View.extend({ }); this.set('serviceConfigProperty.overrides', overrides); } - App.tooltip(this.$('[data-toggle=tooltip]'),{ - placement: 'top' - }); }, toggleFinalFlag: function (event) { @@ -80,6 +76,5 @@ App.ServiceConfigView.SCPOverriddenRowsView = Ember.View.extend({ } overrides = overrides.without(scpToBeRemoved); this.set('serviceConfigProperty.overrides', overrides); - Em.$('body>.tooltip').remove(); //some tooltips get frozen when their owner's DOM element is removed } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/01a43eef/ambari-web/app/views/common/controls_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js index d355ffe..75fad0e 100644 --- a/ambari-web/app/views/common/controls_view.js +++ b/ambari-web/app/views/common/controls_view.js @@ -1404,6 +1404,38 @@ App.CheckDBConnectionView = Ember.View.extend({ }); /** + * View for switch group text + * + * @type {Em.View} + */ +App.SwitchToGroupView = Em.View.extend({ + + group: null, + + tagName: 'a', + + classNames: ['action'], + + template: Ember.Handlebars.compile('{{ view.group.switchGroupTextShort }}'), + + didInsertElement: function() { + var self = this; + App.tooltip($(self.get('element')), { + placement: 'top', + title: self.get('group.switchGroupTextFull') + }); + }, + + willDestroyElement: function() { + $(this.get('element')).tooltip('destroy'); + }, + + click: function() { + this.get('controller').selectConfigGroup({context: this.get('group')}); + } +}); + +/** * View with input field used to repo-version URLs * @type {*} */