You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/06/23 23:13:32 UTC

[2/3] ambari git commit: AMBARI-12106. Versions list goes beyond browser window (alexantonenko)

AMBARI-12106. Versions list goes beyond browser window (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 16d86d582440e2339fc5538ebcce1a3eb1be6cbc
Parents: f7caec5
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Jun 24 00:10:20 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Jun 24 00:13:25 2015 +0300

----------------------------------------------------------------------
 .../templates/common/configs/config_history_flow.hbs |  2 +-
 .../app/views/common/configs/config_history_flow.js  | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/16d86d58/ambari-web/app/templates/common/configs/config_history_flow.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/config_history_flow.hbs b/ambari-web/app/templates/common/configs/config_history_flow.hbs
index ce8cba9..b70a502 100644
--- a/ambari-web/app/templates/common/configs/config_history_flow.hbs
+++ b/ambari-web/app/templates/common/configs/config_history_flow.hbs
@@ -62,7 +62,7 @@
               </button>
               <ul class="dropdown-menu">
                 {{#each serviceVersion in view.dropDownList}}
-                  <li {{bindAttr class=":pointer :dropdown-submenu serviceVersion.isDisplayed:not-allowed"}}>
+                  <li {{bindAttr class=":pointer :dropdown-submenu serviceVersion.isDisplayed:not-allowed"}} {{action computePosition on="mouseEnter" target="view" }}>
                     <div class="row-fluid version-in-dropdown " {{action doAction serviceVersion view.actionTypes.SWITCH target="view"}}>
                       <div class="span2">{{serviceVersion.versionText}}</div>
                       <div class="span6">{{serviceVersion.createdDate}}</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/16d86d58/ambari-web/app/views/common/configs/config_history_flow.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_history_flow.js b/ambari-web/app/views/common/configs/config_history_flow.js
index c23f609..9e89eae 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -152,10 +152,25 @@ App.ConfigHistoryFlowView = Em.View.extend({
     event.stopPropagation();
     this.set('showFullList', true);
   },
+
   hideFullList: function (event) {
     this.set('showFullList', !(this.get('serviceVersions.length') > this.VERSIONS_IN_DROPDOWN));
   },
 
+  computePosition: function(event) {
+    var $el = Em.$('.dropdown-menu', event.currentTarget);
+    // remove existing style - in case user scrolls the page
+    $el.removeAttr('style');
+    var elHeight = $el.outerHeight(),
+      parentHeight = $el.parent().outerHeight(),
+      pagePosition = window.innerHeight + window.pageYOffset,
+      elBottomPosition = $el.offset().top + elHeight,
+      shouldShowUp = elBottomPosition > pagePosition ;
+    if (shouldShowUp) {
+      $el.css('margin-top', -(elHeight - parentHeight));
+    }
+  },
+
   didInsertElement: function () {
     App.tooltip(this.$('[data-toggle=tooltip]'),{
       placement: 'bottom'