Commit 47bc78c7 by Rashid Khan

Added an option for the hits panel to receive its counter from the histogram panel

parent dfc9ad94
...@@ -86,13 +86,15 @@ angular.module('kibana.histogram', []) ...@@ -86,13 +86,15 @@ angular.module('kibana.histogram', [])
// Populate scope when we have results // Populate scope when we have results
results.then(function(results) { results.then(function(results) {
$scope.panel.loading = false; $scope.panel.loading = false;
$scope.hits = results.hits.total;
if(_segment == 0) { if(_segment == 0) {
$scope.hits = 0;
$scope.data = []; $scope.data = [];
query_id = $scope.query_id = new Date().getTime(); query_id = $scope.query_id = new Date().getTime();
} }
if($scope.query_id === query_id) { if($scope.query_id === query_id) {
$scope.hits += results.hits.total;
_.each(results.facets, function(v, k) { _.each(results.facets, function(v, k) {
// Null values at each end of the time range ensure we see entire range // Null values at each end of the time range ensure we see entire range
if(_.isUndefined($scope.data[k]) || _segment == 0) { if(_.isUndefined($scope.data[k]) || _segment == 0) {
...@@ -122,6 +124,7 @@ angular.module('kibana.histogram', []) ...@@ -122,6 +124,7 @@ angular.module('kibana.histogram', [])
$scope.data[k] = series.data $scope.data[k] = series.data
}); });
eventBus.broadcast($scope.$id,$scope.panel.group,'hits',$scope.hits)
$scope.$emit('render') $scope.$emit('render')
if(_segment < $scope.panel.index.length-1) { if(_segment < $scope.panel.index.length-1) {
$scope.get_data(_segment+1,query_id) $scope.get_data(_segment+1,query_id)
......
<div class="row-fluid" ng-controller="hits"> <div class="row-fluid" ng-controller="hits">
<div class="span11"> <div class="span2">
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 <strong>first query will be displayed</strong> <label class="small">Run Query</label><input type="checkbox" ng-model="panel.run_query" ng-checked="panel.run_query">
</div>
<div class="span9" ng-show='!panel.run_query'>
With query running disabled, this panel receives its hit count from a histogram panel. If multiple queries are running this <strong>will show the total of all queries</strong>.
</div>
<div class="span9" ng-show='panel.run_query'>
This shows a simple count of how many records match your filtered query. If multiple queries are sent from a single panel the <strong>first query will be displayed</strong>
</div> </div>
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<div class="span9"> <div class="span9" ng-show='panel.run_query'>
<form class="input-append"> <form class="input-append">
<h6>Query</h6> <h6>Query</h6>
<input type="text" style="width:85%" ng-model="panel.query"> <input type="text" style="width:85%" ng-model="panel.query">
......
...@@ -6,15 +6,24 @@ angular.module('kibana.hits', []) ...@@ -6,15 +6,24 @@ angular.module('kibana.hits', [])
query : "*", query : "*",
group : "default", group : "default",
style : { "font-size": '36pt', "font-weight": "bold" }, style : { "font-size": '36pt', "font-weight": "bold" },
run_query : false
} }
_.defaults($scope.panel,_d) _.defaults($scope.panel,_d)
$scope.init = function () { $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) { eventBus.register($scope,'query', function(event, query) {
$scope.panel.query = _.isArray(query) ? query[0] : query; $scope.panel.query = _.isArray(query) ? query[0] : query;
if($scope.panel.run_query)
$scope.get_data(); $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 // Now that we're all setup, request the time from our group
eventBus.broadcast($scope.$id,$scope.panel.group,'get_time') eventBus.broadcast($scope.$id,$scope.panel.group,'get_time')
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment