-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #470 from spenceralger/limit_pie_to_count_metric
[pie] only allow count agg
- Loading branch information
Showing
6 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Gets all fields of a given type. | ||
// You may also pass "*" to get all types | ||
// Or an array of types to get all fields of that type | ||
define(function (require) { | ||
var _ = require('lodash'); | ||
|
||
require('modules') | ||
.get('kibana') | ||
.filter('aggFilter', function () { | ||
return function (aggs, names) { | ||
if (!names) return aggs; | ||
if (!_.isArray(names)) names = [names]; | ||
if (_.contains(names, '*')) return aggs; | ||
|
||
var filters = names.map(function (name) { | ||
var filter = { | ||
match: true, | ||
name: name | ||
}; | ||
|
||
if (name.charAt(0) === '!') { | ||
filter.match = false; | ||
filter.name = name.substr(1); | ||
} | ||
return filter; | ||
}); | ||
|
||
return aggs.filter(function (agg) { | ||
for (var i = 0; i < filters.length; i++) { | ||
var filter = filters[i]; | ||
if ((agg.name === filter.name) === filter.match) return true; | ||
} | ||
}); | ||
}; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters