Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 60302b397 -> 5170cd766


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

Branch: refs/heads/branch-2.1
Commit: 5170cd76697c08fdf0571619f3bbe5c6cbe2a50f
Parents: 60302b3
Author: Alex Antonenko <hiv...@gmail.com>
Authored: Wed Jun 24 00:10:20 2015 +0300
Committer: Alex Antonenko <hiv...@gmail.com>
Committed: Tue Jul 21 13:16:20 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/5170cd76/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 b48b4b8..db18a9b 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/5170cd76/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 bd5a50b..364d1c5 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -153,10 +153,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',

Reply via email to