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

This commit is contained in:
Torkel Ödegaard 2014-06-03 19:07:59 -07:00
parent 7137a9986f
commit c48b3ded2f
4 changed files with 12 additions and 10 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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) { function buildTemplate(items, placement) {
if (!ul) { var upclass = placement === 'top' ? 'dropup' : '';
ul = [ var ul = [
'<ul class="dropdown-menu" role="menu" aria-labelledby="drop1">', '<ul class="dropdown-menu ' + upclass + '" role="menu" aria-labelledby="drop1">',
'</ul>' '</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');
} }
}; };

View File

@ -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();
}); });