Skip to content

Commit

Permalink
Don't prevent filterable rows from being filterable (elastic#11628)
Browse files Browse the repository at this point in the history
* Don't prevent filterable rows just because they don't have a field

* Don't allow filtering on unfilterable fields

* Move isFilterable to aggConfig
  • Loading branch information
lukasolson committed May 9, 2017
1 parent ab5133b commit f25f118
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/ui/public/directives/rows.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ module.directive('kbnRows', function ($compile, $rootScope, getAppState, Private
let $cellContent;

if (contents instanceof AggConfigResult) {
const field = contents.aggConfig.getField();
const isCellContentFilterable =
contents.type === 'bucket'
&& contents.aggConfig.getField()
&& contents.aggConfig.getField().filterable;
contents.aggConfig.isFilterable()
&& (!field || field.filterable);

if (isCellContentFilterable) {
$cell = createFilterableCell(contents);
Expand Down
6 changes: 5 additions & 1 deletion src/ui/public/vis/agg_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ export function VisAggConfigProvider(Private, fieldTypeFilter) {
return this.type.params.write(this);
};

AggConfig.prototype.isFilterable = function () {
return _.isFunction(this.type.createFilter);
};

AggConfig.prototype.createFilter = function (key) {
if (!_.isFunction(this.type.createFilter)) {
if (!this.isFilterable()) {
throw new TypeError('The "' + this.type.title + '" aggregation does not support filtering.');
}

Expand Down

0 comments on commit f25f118

Please sign in to comment.