diff --git a/panels/histogram/module.js b/panels/histogram/module.js index 1f9b02286b0..b45a82d67d5 100644 --- a/panels/histogram/module.js +++ b/panels/histogram/module.js @@ -86,13 +86,15 @@ angular.module('kibana.histogram', []) // Populate scope when we have results results.then(function(results) { $scope.panel.loading = false; - $scope.hits = results.hits.total; if(_segment == 0) { + $scope.hits = 0; $scope.data = []; query_id = $scope.query_id = new Date().getTime(); } if($scope.query_id === query_id) { + $scope.hits += results.hits.total; + _.each(results.facets, function(v, k) { // Null values at each end of the time range ensure we see entire range if(_.isUndefined($scope.data[k]) || _segment == 0) { @@ -122,6 +124,7 @@ angular.module('kibana.histogram', []) $scope.data[k] = series.data }); + eventBus.broadcast($scope.$id,$scope.panel.group,'hits',$scope.hits) $scope.$emit('render') if(_segment < $scope.panel.index.length-1) { $scope.get_data(_segment+1,query_id) diff --git a/panels/hits/editor.html b/panels/hits/editor.html index e8719de08fb..d4833703c26 100644 --- a/panels/hits/editor.html +++ b/panels/hits/editor.html @@ -1,11 +1,17 @@
-
- The hits panel shows a simple count of how many records match your filtered query. If multiple queries are sent from a single panel the first query will be displayed +
+ +
+
+ With query running disabled, this panel receives its hit count from a histogram panel. If multiple queries are running this will show the total of all queries. +
+
+ This shows a simple count of how many records match your filtered query. If multiple queries are sent from a single panel the first query will be displayed
-
+
Query
diff --git a/panels/hits/module.js b/panels/hits/module.js index 35b740012b8..cb697fb76b4 100644 --- a/panels/hits/module.js +++ b/panels/hits/module.js @@ -6,15 +6,24 @@ angular.module('kibana.hits', []) query : "*", group : "default", style : { "font-size": '36pt', "font-weight": "bold" }, + run_query : false } _.defaults($scope.panel,_d) $scope.init = function () { - eventBus.register($scope,'time', function(event,time){set_time(time)}); + $scope.hits = 0; + eventBus.register($scope,'time', function(event,time){ + if($scope.panel.run_query) + set_time(time) + }); eventBus.register($scope,'query', function(event, query) { $scope.panel.query = _.isArray(query) ? query[0] : query; - $scope.get_data(); + if($scope.panel.run_query) + $scope.get_data(); }); + eventBus.register($scope,'hits', function(event, hits) { + $scope.hits = hits; + }) // Now that we're all setup, request the time from our group eventBus.broadcast($scope.$id,$scope.panel.group,'get_time') }