Browse Source

Fix for graphite function selection menu that some times draws outside screen. It now displays upward (Fixes #293)

Torkel Ödegaard 11 years ago
parent
commit
c48b3ded2f

+ 1 - 0
CHANGELOG.md

@@ -16,6 +16,7 @@ vNext
   exists after the options are reloaded the current selected value is kept (Closes #447, Closes #412)
   exists after the options are reloaded the current selected value is kept (Closes #447, Closes #412)
 - Legend Current value did not display when value was zero, Fixes #460
 - Legend Current value did not display when value was zero, Fixes #460
 - Fix to series toggling bug that caused annotations to be hidden when toggling (hiding) series. Fixes #328
 - Fix to series toggling bug that caused annotations to be hidden when toggling (hiding) series. Fixes #328
+- Fix for graphite function selection menu that some times draws outside screen. It now displays upward (Fixes #293)
 
 
 # 1.5.4 (2014-05-13)
 # 1.5.4 (2014-05-13)
 ### New features and improvements
 ### New features and improvements

+ 1 - 1
src/app/directives/addGraphiteFunc.js

@@ -18,7 +18,7 @@ function (angular, app, _, $, gfunc) {
 
 
       var buttonTemplate = '<a  class="grafana-target-segment grafana-target-function dropdown-toggle"' +
       var buttonTemplate = '<a  class="grafana-target-segment grafana-target-function dropdown-toggle"' +
                               ' tabindex="1" gf-dropdown="functionMenu" data-toggle="dropdown"' +
                               ' tabindex="1" gf-dropdown="functionMenu" data-toggle="dropdown"' +
-                              ' data-placement="bottom"><i class="icon-plus"></i></a>';
+                              ' data-placement="top"><i class="icon-plus"></i></a>';
 
 
       return {
       return {
         link: function($scope, elem) {
         link: function($scope, elem) {

+ 9 - 8
src/app/directives/bootstrap-tagsinput.js

@@ -87,13 +87,12 @@ function (angular, $) {
     .module('kibana.directives')
     .module('kibana.directives')
     .directive('gfDropdown', function ($parse, $compile, $timeout) {
     .directive('gfDropdown', function ($parse, $compile, $timeout) {
 
 
-      function buildTemplate(items, ul) {
-        if (!ul) {
-          ul = [
-            '<ul class="dropdown-menu" role="menu" aria-labelledby="drop1">',
-            '</ul>'
-          ];
-        }
+      function buildTemplate(items, placement) {
+        var upclass = placement === 'top' ? 'dropup' : '';
+        var ul = [
+          '<ul class="dropdown-menu ' + upclass + '" role="menu" aria-labelledby="drop1">',
+          '</ul>'
+        ];
 
 
         angular.forEach(items, function (item, index) {
         angular.forEach(items, function (item, index) {
           if (item.divider) {
           if (item.divider) {
@@ -122,10 +121,12 @@ function (angular, $) {
         link: function postLink(scope, iElement, iAttrs) {
         link: function postLink(scope, iElement, iAttrs) {
           var getter = $parse(iAttrs.gfDropdown), items = getter(scope);
           var getter = $parse(iAttrs.gfDropdown), items = getter(scope);
           $timeout(function () {
           $timeout(function () {
-            var dropdown = angular.element(buildTemplate(items).join(''));
+            var placement = iElement.data('placement');
+            var dropdown = angular.element(buildTemplate(items, placement).join(''));
             dropdown.insertAfter(iElement);
             dropdown.insertAfter(iElement);
             $compile(iElement.next('ul.dropdown-menu'))(scope);
             $compile(iElement.next('ul.dropdown-menu'))(scope);
           });
           });
+
           iElement.addClass('dropdown-toggle').attr('data-toggle', 'dropdown');
           iElement.addClass('dropdown-toggle').attr('data-toggle', 'dropdown');
         }
         }
       };
       };

+ 1 - 1
src/app/directives/grafanaGraph.js

@@ -37,7 +37,7 @@ function (angular, $, kbn, moment, _) {
         // Receive render events
         // Receive render events
         scope.$on('render',function(event, renderData) {
         scope.$on('render',function(event, renderData) {
           data = renderData || data;
           data = renderData || data;
-          annotations = renderData.annotations;
+          annotations = data.annotations;
           render_panel();
           render_panel();
         });
         });