Просмотр исходного кода

Merge branch 'master' of github.com:elasticsearch/kibana

Torkel Ödegaard 12 лет назад
Родитель
Сommit
58fef5d398

+ 6 - 3
src/app/app.js

@@ -136,9 +136,12 @@ function (angular, $, _, appLevelRequire) {
               var $scope = this;
               $scope.requireContext(deps, function () {
                 var deps = _.toArray(arguments);
-                $scope.$apply(function () {
-                  fn.apply($scope, deps);
-                });
+                // Check that this is a valid scope.
+                if($scope.$id) {
+                  $scope.$apply(function () {
+                    fn.apply($scope, deps);
+                  });
+                }
               });
             };
           }]);

+ 5 - 0
src/app/directives/addPanel.js

@@ -12,6 +12,11 @@ function (angular, app, _) {
       return {
         restrict: 'A',
         link: function($scope, elem) {
+
+          $scope.$on("$destroy",function() {
+            elem.remove();
+          });
+
           $scope.$watch('panel.type', function() {
             var _type = $scope.panel.type;
             $scope.reset_panel(_type);

+ 7 - 2
src/app/directives/kibanaPanel.js

@@ -13,7 +13,6 @@ function (angular) {
 
         '<div class="row-fluid panel-extra"><div class="panel-extra-container">' +
 
-
           '<span class="extra row-button" ng-show="panel.editable != false">' +
             '<span ng-click="remove_panel_from_row(row,panel)" class="pointer">'+
             '<i class="icon-remove pointer" bs-tooltip="\'Remove\'"></i></span>'+
@@ -61,16 +60,22 @@ function (angular) {
         link: function($scope, elem, attr) {
           // once we have the template, scan it for controllers and
           // load the module.js if we have any
+          var newScope = $scope.$new();
 
           // compile the module and uncloack. We're done
           function loadModule($module) {
             $module.appendTo(elem);
             elem.wrap(container);
             /* jshint indent:false */
-            $compile(elem.contents())($scope);
+            $compile(elem.contents())(newScope);
             elem.removeClass("ng-cloak");
           }
 
+          newScope.$on('$destroy',function(){
+            elem.unbind();
+            elem.remove();
+          });
+
           $scope.$watch(attr.type, function (name) {
             elem.addClass("ng-cloak");
             // load the panels module file, then render it in the dom.

+ 2 - 2
src/app/panels/histogram/module.js

@@ -528,7 +528,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
       restrict: 'A',
       template: '<div></div>',
       link: function(scope, elem) {
-        var data;
+        var data, plot;
 
         scope.$on('refresh',function(){
           scope.get_data();
@@ -700,7 +700,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
               data[i].data = _d;
             }
 
-            scope.plot = $.plot(elem, data, options);
+            plot = $.plot(elem, data, options);
 
           } catch(e) {
             // Nothing to do here

+ 3 - 0
src/app/services/dashboard.js

@@ -134,6 +134,9 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
     // here before telling the panels to refresh
     this.refresh = function() {
       if(self.current.index.interval !== 'none') {
+        if(_.isUndefined(filterSrv)) {
+          return;
+        }
         if(filterSrv.idsByType('time').length > 0) {
           var _range = filterSrv.timeRange('last');
           kbnIndex.indices(_range.from,_range.to,

+ 17 - 0
src/vendor/angular/angular.js

@@ -8464,6 +8464,21 @@ function $RootScopeProvider(){
         } else {
           this.$$childHead = this.$$childTail = child;
         }
+
+        // RASHID: Fix for chrome GC bug
+        child.$on('$destroy', function() {
+          if(Child)
+            Child.prototype = null;
+          // Async so that the $broadcast('$destroy') can traverse the rest
+          setTimeout(function() {
+            child.__proto__ = {};
+            for(var i in child)
+              child[i] = null;
+            child = null;
+            return null;
+          });
+        });
+
         return child;
       },
 
@@ -8893,6 +8908,8 @@ function $RootScopeProvider(){
         // see: https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
         this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =
             this.$$childTail = null;
+        parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =
+            this.$$childTail = null;
       },
 
       /**

+ 2 - 2
src/vendor/jquery/jquery.flot.js

@@ -2438,9 +2438,9 @@ Licensed under the MIT license.
                 radius = series.points.radius,
                 symbol = series.points.symbol;
 
-            // If the user sets the line width to 0, we change it to a very 
+            // If the user sets the line width to 0, we change it to a very
             // small value. A line width of 0 seems to force the default of 1.
-            // Doing the conditional here allows the shadow setting to still be 
+            // Doing the conditional here allows the shadow setting to still be
             // optional even with a lineWidth of 0.
 
             if( lw == 0 )