From 7293ee089414fab7b0a0236697ce14e54e2a0f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 24 Feb 2015 09:54:02 +0100 Subject: [PATCH 1/2] Changed default OpenTSDB downsample aggregator to avg, #1438 --- src/app/features/opentsdb/queryCtrl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/features/opentsdb/queryCtrl.js b/src/app/features/opentsdb/queryCtrl.js index a19b0211a9e..1e248c831d5 100644 --- a/src/app/features/opentsdb/queryCtrl.js +++ b/src/app/features/opentsdb/queryCtrl.js @@ -19,7 +19,7 @@ function (angular, _, kbn) { } if (!$scope.target.downsampleAggregator) { - $scope.target.downsampleAggregator = 'sum'; + $scope.target.downsampleAggregator = 'avg'; } $scope.$on('typeahead-updated', function() { From 97e5a04621a3135ed755cca0a347defb25726be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 5 Mar 2015 10:42:46 +0100 Subject: [PATCH 2/2] Fixed memory leak in bootstrap Typeahead code, Fixes #1497 --- src/app/directives/grafanaPanel.js | 8 -------- src/app/directives/templateParamSelector.js | 5 +++++ src/app/features/dashboard/dashboardCtrl.js | 17 ++++++++++------- src/vendor/bootstrap/bootstrap.js | 7 ++++++- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/app/directives/grafanaPanel.js b/src/app/directives/grafanaPanel.js index d73eb2bb0b9..71be4b787fe 100644 --- a/src/app/directives/grafanaPanel.js +++ b/src/app/directives/grafanaPanel.js @@ -37,14 +37,6 @@ function (angular, $, config) { var getter = $parse(attr.type), panelType = getter($scope); var newScope = $scope.$new(); - $scope.kbnJqUiDraggableOptions = { - revert: 'invalid', - helper: function() { - return $('
'); - }, - placeholder: 'keep' - }; - // compile the module and uncloack. We're done function loadModule($module) { $module.appendTo(elem); diff --git a/src/app/directives/templateParamSelector.js b/src/app/directives/templateParamSelector.js index 5ff6eaa0038..ad70bdf002e 100644 --- a/src/app/directives/templateParamSelector.js +++ b/src/app/directives/templateParamSelector.js @@ -75,6 +75,11 @@ function (angular, app, _, $) { $button.focus(); }); + $scope.$on('$destroy', function() { + $button.unbind(); + typeahead.destroy(); + }); + $compile(elem.contents())($scope); } }; diff --git a/src/app/features/dashboard/dashboardCtrl.js b/src/app/features/dashboard/dashboardCtrl.js index c88d6dfa725..ed7a8e95bac 100644 --- a/src/app/features/dashboard/dashboardCtrl.js +++ b/src/app/features/dashboard/dashboardCtrl.js @@ -31,13 +31,6 @@ function (angular, $, config, _) { $scope.setupDashboard(dashboardData); }; - $scope.registerWindowResizeEvent = function() { - angular.element(window).bind('resize', function() { - $timeout.cancel(resizeEventTimeout); - resizeEventTimeout = $timeout(function() { $scope.$broadcast('render'); }, 200); - }); - }; - $scope.setupDashboard = function(dashboardData) { $rootScope.performance.dashboardLoadStart = new Date().getTime(); $rootScope.performance.panelsInitialized = 0; @@ -127,5 +120,15 @@ function (angular, $, config, _) { $rootScope.$broadcast('render'); }; + $scope.registerWindowResizeEvent = function() { + angular.element(window).bind('resize', function() { + $timeout.cancel(resizeEventTimeout); + resizeEventTimeout = $timeout(function() { $scope.$broadcast('render'); }, 200); + }); + $scope.$on('$destroy', function() { + angular.element(window).unbind('resize'); + }); + }; + }); }); diff --git a/src/vendor/bootstrap/bootstrap.js b/src/vendor/bootstrap/bootstrap.js index ba7dbadeb12..0a427f05858 100644 --- a/src/vendor/bootstrap/bootstrap.js +++ b/src/vendor/bootstrap/bootstrap.js @@ -1956,7 +1956,7 @@ return items ? this.process(items) : this } - , process: function (items) { + , process: function (items) { var that = this items = $.grep(items, function (item) { @@ -2050,6 +2050,11 @@ .on('click', $.proxy(this.click, this)) .on('mouseenter', 'li', $.proxy(this.mouseenter, this)) .on('mouseleave', 'li', $.proxy(this.mouseleave, this)) + }, + + destroy: function () { + this.$element.off().removeData('typeahead'); + this.$menu.off(); } , eventSupported: function(eventName) {