-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding kibana filter expression functions #94069
adding kibana filter expression functions #94069
Conversation
Pinging @elastic/kibana-app-services (Team:AppServices) |
4895426
to
4133707
Compare
4133707
to
14a0237
Compare
⏳ Build in-progress, with failures
Failed CI StepsHistory
To update your PR or re-run it, just comment with: |
ea2152d
to
a09746b
Compare
a09746b
to
3daaa59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM, except the lt
, lte
, gt
and gte
checks, see below.
}); | ||
|
||
it('returns an object with the correct structure', () => { | ||
const actual = fn(null, { field: { spec: { name: 'test' } } }, context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand this is copy-paste from similar tests in this plugin, but I've seen it a lot and wanted to suggest a small improvement. It is better to not create global module variables, like context
here and not use beforeEach
utility, which is specific to Jest. This can be done like so:
const actual = fn(null, { field: { spec: { name: 'test' } } }, context); | |
const context = setup(); | |
const actual = fn(null, { field: { spec: { name: 'test' } } }, context); |
Simply setup()
function that creates everything needed for each test case every time.
src/plugins/data/common/search/expressions/filters_to_ast.test.ts
Outdated
Show resolved
Hide resolved
}; | ||
}); | ||
|
||
it('returns an object with the correct structure', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, fn
and context
are defined outside of the text case, and the test case name just says that something should work "correctly", but it is not clear what should be correct, and it is not clear why fn
and context
are coming from out of the test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kibana app code changes LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Vadim Dalecky <[email protected]>
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
Summary
kibanaFilter
,rangeFilter
,existsFilter
andphraseFilter
expression functions were added which all generatekibanaFilter
type.filtersToAst
utility function was added which takes aFilter
or array of them and returns array of expressionskibana_context
expression function was updated to takekibanaFilter
type in as filters argument and all the places using it were updated.resolves #67896
Checklist
Delete any items that are not applicable to this PR.
For maintainers