-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Filter editors #11375
Merged
Merged
Filter editors #11375
Changes from all commits
Commits
Show all changes
105 commits
Select commit
Hold shift + click to select a range
62a9188
Add terms filter
lukasolson b42732b
First stab at inline filter editors
lukasolson d0c83dd
Merge remote-tracking branch 'upstream/master' into filter-editors
lukasolson adb8b57
Cleanup
lukasolson dbcbf23
Move endpoint to server
lukasolson c6ebede
Merge branch 'master' into filter-editors
lukasolson 74fd6aa
Add delete button to filter editor
lukasolson 4c8af2b
Add sort prefix first utility
lukasolson cfdb4c2
Sort ui-select items by prefix first
lukasolson b44f423
Add sortPrefixFirst tests
lukasolson 6269933
Merge branch 'master' into filter-editors
lukasolson f5de43c
Use small text input instead of styles
lukasolson f883caf
Merge branch 'master' into filter-editors
lukasolson f1ed5b4
More keyboard-driven filter creation
lukasolson a8f8d21
Merge branch 'master' into filter-editors
lukasolson d4498ee
Merge branch 'master' into filter-editors
lukasolson cb7b350
Add custom dsl edit support
lukasolson 784925c
Add more actions
lukasolson cf684ac
Add alias support
lukasolson 8f4dd11
Simplify label
lukasolson 942d477
Merge branch 'master' into filter-editors
lukasolson 35ef626
Allow freeform entries
lukasolson 3cadcd4
Fix visualize
lukasolson 5fd9bff
Support for dashboard
lukasolson 7a9377f
Move styles to less and fix visual issues
lukasolson 7fca941
Merge branch 'master' into filter-editors
lukasolson af7364c
Rename map_match to map_phrase
lukasolson 32231e0
Detect scripted filters for filter editors
lukasolson 7e50ce0
Simplify range map
lukasolson 120c217
Use match_phrase instead of terms
lukasolson 5987e7b
Fix scripted exists
lukasolson f402050
Support scripted phrases
lukasolson 87aa348
Don't show DSL editor for new filters
lukasolson df25b78
Disable save unless valid
lukasolson f51626f
Merge branch 'master' into filter-editors
lukasolson 35edd89
Fix error when searching for numbers
lukasolson 5af844a
Return correct error and dont suggest values for numbers
lukasolson 68ba6d8
Only suggest filterable fields
lukasolson 95e66dc
Clear params on field change
lukasolson b78015b
Clear suggestions on field change
lukasolson 6f5dd66
Cache response
lukasolson 1f5165f
Preserve selected params
lukasolson 456e4b3
Fix multiple selection
lukasolson fb93283
Don't overflow on multiselect
lukasolson 32a0e97
Show tooltip on long values
lukasolson 2a2edec
Use different input for different types
lukasolson 14d360e
Show all actions again
lukasolson 4f3dbc8
Move dsl editor to directive
lukasolson 62f1e32
Update filter query dsl editor
lukasolson 833ff23
Clean up code
lukasolson e7cba21
Move filter field select into own directive
lukasolson 322175f
Move filter operator select into own directive
lukasolson 33041cc
Move utils to separate file
lukasolson 2b62d33
Move field options to field directive
lukasolson 94502e2
Move operator options to operator directive
lukasolson 0a9d9a8
Move params under operator type
lukasolson 410a76b
Move params editor into own directive
lukasolson 86e0181
Merge branch 'master' into filter-editors
lukasolson 3ab569f
Move param editors to own directives
lukasolson 1da04a9
Don't highlight values
lukasolson 3f831e3
Don't use unnecessary onChange
lukasolson 42689a9
Use text input if no suggestions
lukasolson 79ac016
Remove unused updateFilter
lukasolson 6ee2d9b
Merge branch 'master' into filter-editors
lukasolson 49ae873
Enhance params editors
lukasolson 5f45dc4
Update save filter api
lukasolson 13b9ac8
Update save filter api
lukasolson 25dbcf7
Fix a couple tests
lukasolson 4fd6bb4
Merge branch 'master' into filter-editors
lukasolson 770b3dc
Fix more tests
lukasolson 1e87b6f
Fix map phrase test
lukasolson 3eba161
test cleanup
lukasolson cd6edba
Merge remote-tracking branch 'upstream/master' into filter-editors
lukasolson 3ac0ab4
Hide editor on esc key
lukasolson a791298
Use first index pattern if none specified
lukasolson d54df02
Merge branch 'master' into filter-editors
lukasolson a02e12a
FilterEditorUtils test and fix range error
lukasolson 6ab2910
fix date phrase
lukasolson 5ecbf3f
Date format should allow date math values
lukasolson 434e046
Only show add filter button if there are index patterns
lukasolson da08291
Look up field from indexPatterns service rather than passed index pat…
lukasolson 4178ea2
Use basepath instead of relative path
lukasolson 70e1960
Feedback from bargs
lukasolson 2c8cf77
Merge branch 'filter-editors' of https://github.com/lukasolson/kibana…
stacey-gammon f7ecaf8
Merge branch 'master' into filter-editors
lukasolson 8f228ab
Don't show filter bar when ya shouldnt
lukasolson bc6390f
don't reload panel saved objects
stacey-gammon b612cdd
Show date math instead of formatted date
lukasolson bc50e25
Merge remote-tracking branch 'stacey/filter-suggestion' into filter-e…
lukasolson bc59261
Focus on params even when not ui-select
lukasolson ba26a0a
Merge branch 'master' into filter-editors
lukasolson 26db446
Hide editor on delete
lukasolson 148d154
Update styles to BEM format
lukasolson c2e0ec9
Update styles
lukasolson fd88d0a
Add more tests
lukasolson a5ee8a3
Don't show pin/disable
lukasolson 5baab3f
Merge branch 'master' into filter-editors
lukasolson 3173cf4
Fix bug where saving a filter edit without making changes messed up p…
lukasolson d1a1ebf
Update styles to camelcase
lukasolson 6cbff9f
Fix cutoff from top of screen for ui-select
lukasolson 9aaac8c
Add accessibility
lukasolson 2281298
Align to top
lukasolson fe0d62f
Align inputs and add placeholders
lukasolson d30467d
Dynamic input sizing
lukasolson 0759978
Fix dashboard panel test
lukasolson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
5 changes: 5 additions & 0 deletions
5
src/core_plugins/kibana/server/routes/api/suggestions/index.js
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,5 @@ | ||
import { registerValueSuggestions } from './register_value_suggestions'; | ||
|
||
export function registerSuggestionsApi(server) { | ||
registerValueSuggestions(server); | ||
} |
31 changes: 31 additions & 0 deletions
31
src/core_plugins/kibana/server/routes/api/suggestions/register_value_suggestions.js
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,31 @@ | ||
import handleESError from '../../../lib/handle_es_error'; | ||
|
||
export function registerValueSuggestions(server) { | ||
server.route({ | ||
path: '/api/kibana/suggestions/values/{index}', | ||
method: ['POST'], | ||
handler: function (req, reply) { | ||
const { index } = req.params; | ||
const { field, query } = req.payload; | ||
|
||
const { callWithRequest } = server.plugins.elasticsearch.getCluster('data'); | ||
const include = query ? `.*${query}.*` : undefined; | ||
const body = getBody({ field, include }); | ||
|
||
return callWithRequest(req, 'search', { index, body }) | ||
.then((res) => { | ||
const suggestions = res.aggregations.suggestions.buckets.map(bucket => bucket.key); | ||
return reply(suggestions); | ||
}) | ||
.catch(error => reply(handleESError(error))); | ||
} | ||
}); | ||
} | ||
|
||
function getBody(terms) { | ||
return { | ||
aggs: { | ||
suggestions: { terms } | ||
} | ||
}; | ||
} |
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,16 @@ | ||
export const existsFilter = { | ||
'meta': { | ||
'index': 'logstash-*', | ||
'negate': false, | ||
'disabled': false, | ||
'type': 'exists', | ||
'key': 'machine.os', | ||
'value': 'exists' | ||
}, | ||
'exists': { | ||
'field': 'machine.os' | ||
}, | ||
'$state': { | ||
'store': 'appState' | ||
} | ||
}; |
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,5 @@ | ||
export { phraseFilter } from './phrase_filter'; | ||
export { scriptedPhraseFilter } from './scripted_phrase_filter'; | ||
export { phrasesFilter } from './phrases_filter'; | ||
export { rangeFilter } from './range_filter'; | ||
export { existsFilter } from './exists_filter'; |
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,21 @@ | ||
export const phraseFilter = { | ||
meta: { | ||
negate: false, | ||
index: 'logstash-*', | ||
type: 'phrase', | ||
key: 'machine.os', | ||
value: 'ios', | ||
disabled: false | ||
}, | ||
query: { | ||
match: { | ||
'machine.os': { | ||
query: 'ios', | ||
type: 'phrase' | ||
} | ||
} | ||
}, | ||
$state: { | ||
store: 'appState' | ||
} | ||
}; |
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,34 @@ | ||
export const phrasesFilter = { | ||
meta: { | ||
index: 'logstash-*', | ||
type: 'phrases', | ||
key: 'machine.os.raw', | ||
value: 'win xp, osx', | ||
params: [ | ||
'win xp', | ||
'osx' | ||
], | ||
negate: false, | ||
disabled: false | ||
}, | ||
query: { | ||
bool: { | ||
should: [ | ||
{ | ||
match_phrase: { | ||
'machine.os.raw': 'win xp' | ||
} | ||
}, | ||
{ | ||
match_phrase: { | ||
'machine.os.raw': 'osx' | ||
} | ||
} | ||
], | ||
minimum_should_match: 1 | ||
} | ||
}, | ||
$state: { | ||
store: 'appState' | ||
} | ||
}; |
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,20 @@ | ||
export const rangeFilter = { | ||
'meta': { | ||
'index': 'logstash-*', | ||
'negate': false, | ||
'disabled': false, | ||
'alias': null, | ||
'type': 'range', | ||
'key': 'bytes', | ||
'value': '0 to 10' | ||
}, | ||
'range': { | ||
'bytes': { | ||
'gte': 0, | ||
'lt': 10 | ||
} | ||
}, | ||
'$state': { | ||
'store': 'appState' | ||
} | ||
}; |
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,23 @@ | ||
export const scriptedPhraseFilter = { | ||
'meta': { | ||
'negate': false, | ||
'index': 'logstash-*', | ||
'field': 'script string', | ||
'type': 'phrase', | ||
'key': 'script string', | ||
'value': 'i am a string', | ||
'disabled': false | ||
}, | ||
'script': { | ||
'script': { | ||
'inline': 'boolean compare(Supplier s, def v) {return s.get() == v;}compare(() -> { \'i am a string\' }, params.value);', | ||
'lang': 'painless', | ||
'params': { | ||
'value': 'i am a string' | ||
} | ||
} | ||
}, | ||
'$state': { | ||
'store': 'appState' | ||
} | ||
}; |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Some API tests would be good for this route.