[discover] pass field counts to field chooser

This commit is contained in:
Spencer Alger 2015-05-06 11:59:39 -07:00
parent a8f8eaaea4
commit 4b2f3a0cce
3 changed files with 5 additions and 3 deletions

View file

@ -17,6 +17,7 @@ define(function (require) {
scope: {
columns: '=',
data: '=',
fieldCounts: '=',
state: '=',
indexPattern: '=',
indexPatternList: '=',

View file

@ -347,7 +347,6 @@ define(function (require) {
}
var rows = $scope.rows;
var counts = $scope.fieldCounts || ($scope.fieldCounts = {});
var indexPattern = $scope.searchSource.get('index');
// merge the rows and the hits, use a new array to help watchers
@ -357,11 +356,12 @@ define(function (require) {
notify.event('resort rows', function () {
rows.sort(sortFn);
rows = $scope.rows = rows.slice(0, totalSize);
counts = $scope.fieldCounts = {};
$scope.fieldCounts = {};
});
}
notify.event('flatten hit and count fields', function () {
var counts = $scope.fieldCounts;
$scope.rows.forEach(function (hit) {
// skip this work if we have already done it and we are NOT sorting.
// ---

View file

@ -64,7 +64,8 @@
<disc-field-chooser
columns="state.columns"
refresh="refreshFieldList"
data="rows"
rows="rows"
field-counts="fieldCounts"
filter="filterQuery"
index-pattern="searchSource.get('index')"
index-pattern-list="opts.indexPatternList"