forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Transforms: Filter aggregation support (elastic#67591)
* [ML] WIP filter support * [ML] value selector * [ML] only supported filter aggs as options * [ML] WIP apply config * [ML] fix form persistence * [ML] refactor * [ML] support clone * [ML] validation, get es config * [ML] support "exists", fixes for the term form, validation * [ML] fix ts issues * [ML] don't perform request on adding incomplete agg * [ML] basic range number support * [ML] filter bool agg support * [ML] functional tests * [ML] getAggConfigFromEsAgg tests * [ML] fix unit tests * [ML] agg name update on config change, add unit tests * [ML] update snapshot * [ML] range selector enhancements * [ML] improve types * [ML] update step for range selector to support float numbers * [ML] range validation * [ML] term selector improvements * [ML] fix switch between advanced editor * [ML] prefix test ids * [ML] support helper text for aggs item
- Loading branch information
Showing
28 changed files
with
1,401 additions
and
141 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
47 changes: 47 additions & 0 deletions
47
x-pack/plugins/transform/public/app/common/pivot_aggs.test.ts
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,47 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { getAggConfigFromEsAgg } from './pivot_aggs'; | ||
import { | ||
FilterAggForm, | ||
FilterTermForm, | ||
} from '../sections/create_transform/components/step_define/common/filter_agg/components'; | ||
|
||
describe('getAggConfigFromEsAgg', () => { | ||
test('should throw an error for unsupported agg', () => { | ||
expect(() => getAggConfigFromEsAgg({ terms: {} }, 'test')).toThrowError(); | ||
}); | ||
|
||
test('should return a common config if the agg does not have a custom config defined', () => { | ||
expect(getAggConfigFromEsAgg({ avg: { field: 'region' } }, 'test_1')).toEqual({ | ||
agg: 'avg', | ||
aggName: 'test_1', | ||
dropDownName: 'test_1', | ||
field: 'region', | ||
}); | ||
}); | ||
|
||
test('should return a custom config for recognized aggregation type', () => { | ||
expect( | ||
getAggConfigFromEsAgg({ filter: { term: { region: 'sa-west-1' } } }, 'test_2') | ||
).toMatchObject({ | ||
agg: 'filter', | ||
aggName: 'test_2', | ||
dropDownName: 'test_2', | ||
field: 'region', | ||
AggFormComponent: FilterAggForm, | ||
aggConfig: { | ||
filterAgg: 'term', | ||
aggTypeConfig: { | ||
FilterAggFormComponent: FilterTermForm, | ||
filterAggConfig: { | ||
value: 'sa-west-1', | ||
}, | ||
}, | ||
}, | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.