Repository navigation
Feat: Filter groups - #34889
Feat: Filter groups#34889
Conversation
53a1536 to
e59c643
Compare
💚 Build Succeeded |
e31dda1 to
19b397c
Compare
There was a problem hiding this comment.
This is unfortunately becoming a common pattern, where expression args need to be synced with the filter expression at render time. I made a helper but I'm not sure how to abstract it better
There was a problem hiding this comment.
Might consider creating a discuss issue and referencing it here and elsewhere...?
19b397c to
c45ad46
Compare
💚 Build Succeeded |
💚 Build Succeeded |
c45ad46 to
b697db0
Compare
💚 Build Succeeded |
b697db0 to
b4161ff
Compare
💚 Build Succeeded |
2132773 to
13995fe
Compare
|
Pinging @elastic/kibana-canvas |
|
@w33ble Can you provide some steps on how to use this? It's not clear to me how you name a group in order for it to display in the dropdown, and I'm also not sure what 'Create a group' does. Thanks for clarifying. One quick note, do you think this would be used frequently enough that the input could just be displayed all the time as opposed to being behind the plus icon? |
@ryankeairns hard to say. Seems like something that would get a bunch of use, but it's hard to tell. Having it show up by default would be easy though, just need to add it to the element expressions. I'll add more details to the description, sorry about that. |
multi-arg so multiple groups can be used, and the value is always an array test: add setFilter tests
timefilter, exacttly, dropdownControl, and timefilterControl
and keep the values in sync with expression via helper function
added via FunctionForm, which renders the associated argType
use it for the timepicker and dropdown UIs
it breaks the filter lookup code, and the value is almost always set from the UI control anyway
when collecting filter groups, also include groups in expressions
a84df84 to
a465ee2
Compare
|
@monfera good question. The other 2 blocker issues are fixed, but that one remains. #33605 still needs to get fixed, but it doesn't really stop this feature from working, so it's not actually a "blocker". The filter value also still doesn't reliably update all the time, which may or may not be related to that issue. I spent some time in the past trying to figure out why it happens but wasn't successful, sadly. |
💚 Build Succeeded |
💚 Build Succeeded |
Closes #23117
Blocked by #34823mergedAllow grouping of filters and group selection in the
filtersfunction.filtersfunction now accepts an argument, which is multi and has an unnamed alias. Use it to select which group(s) of filters you want to use, likefilters group1 | demodatafilterGroupargument, which is passed along to the filter expressionTesting
Grouping works with simple string matching (case sensitive). If you specify a group (or many groups) on the
filtersfunction, only filters that belong to the group(s) will be applied. If no group is provided, it behaves like global filters do now.The easiest way is to simply watch filter values update. Create 3 elements with the following expressions:
filtersfilters group1filters group2Now add a time picker or dropdown element (or both, or multiples of one or both... whatever you want). You will see filters applied to
#1, but not#2or#3.Now add a filter group to one (or several) or the time pickers and/or dropdowns. You can use the sidebar, as in the gif above, and you should see both "group1" and "group2" in the dropdown. If you add a different
filterGroupto any of the filter elements, that will show up in the dropdown as well.You can also add filterGroups to the expression, by adding
filterGroup=group1to thetimefilterControl/dropdownControlfunction, like in this example:Now that should show up in
#1(since that one is global) and#2. Change the value togroup2and it should show up in#1and#3. Change it to some other value and it will again only show up in#1.The value for
filterGroupcan be any string, and if you create other groups (ie. use a string other than "group1" and "group2"), they should show up in the dropdown on the sidebar as well.To check using multiple groups, set at least one filter on each of
group1andgroup2. Now update#3to this expression:filters group2 group1.#3should now show filters in bothgroup1andgroup2, and match#1(unless you've added more groups).Be sure to try using
filterswith multiple groups, and adding multiple filters to a group.Sidebar
The sidebar control for the groups will show a dropdown of all groups that exist on any filters, as well as any groups being consumed by any
filtersfunctions (even if they are nested), which makes it easy to pick existing groups from the sidebar. Users can also create new groups on the fly from the sidebar.If the element already uses a filter, and it's the only one, and you change it, the old group value will no longer show up in the list. You will have to manually add it back. This is also demonstrated in the gif above.