Repository navigation
[7.6.1] [Lens] Fix bugs in Lens filters (#56441) - #56648
Conversation
* [Lens] Fix bug where filters were not displayed * Fix elastic#55603 Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
|
@elasticmachine merge upstream |
|
Pinging @elastic/kibana-app (Team:KibanaApp) |
|
Sorry, haven't actually fixed the issues yet |
|
Figured out the issue: filterManager was making a copy of |
💔 Build FailedTest FailuresKibana Pipeline / kibana-xpack-agent / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/lens/smokescreen·ts.lens app lens smokescreen tests should allow editing saved visualizationsStandard OutStack TraceKibana Pipeline / kibana-xpack-agent / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/lens/smokescreen·ts.lens app lens smokescreen tests "after all" hook for "should allow creation of lens visualizations"Standard OutStack TraceKibana Pipeline / kibana-xpack-agent / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/lens.lens app "after all" hook in ""Standard OutStack Traceand 7 more failures, only showing the first 3. History
To update your PR or re-run it, just comment with: |
💔 Build FailedTest FailuresKibana Pipeline / kibana-xpack-agent / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/dashboard/feature_controls/dashboard_security·ts.dashboard feature controls dashboard security global dashboard all privileges, no embeddable application privileges landing page shows "Create new Dashboard" buttonStandard OutStack TraceKibana Pipeline / x-pack-intake-agent / X-Pack Jest Tests.x-pack/legacy/plugins/lens/public/app_plugin.Lens App renders the editor frameStandard OutStack TraceHistory
To update your PR or re-run it, just comment with: |
Dosant
left a comment
There was a problem hiding this comment.
Code lgtm
Tested that only pinned filters are preserved when navigating to lens and that global filters saved with lens vis are not shown on UI.
| }} | ||
| onSavedQueryUpdated={savedQuery => { | ||
| data.query.filterManager.setFilters(savedQuery.attributes.filters || state.filters); | ||
| data.query.filterManager.setFilters(savedQuery.attributes.filters || []); |
There was a problem hiding this comment.
Great as a fix for 7.6.1, but consider using #56160 for 7.7 to avoid similar issues 🙏
There was a problem hiding this comment.
The fix using that code is already in 7.7, but I couldn't backport it to 7.6
| const field = ({ name: 'myfield' } as unknown) as IFieldType; | ||
|
|
||
| args.data.query.filterManager.setFilters([esFilters.buildExistsFilter(field, indexPattern)]); | ||
| const filter = { |
There was a problem hiding this comment.
Nitpick: Not sure if it's valuable (treat this comment as learning opportunity for me :D ) but in the query tests below we construct filters using setting Filter Store:
const unpinned = esFilters.buildExistsFilter(field, indexPattern);
FilterManager.setFiltersStore([unpinned], esFilters.FilterStateStore.APP_STATE);
while here you construct the filter object. Maybe it's worth to unify it?
There was a problem hiding this comment.
I looked into this a bit more and specifically the exists filter has a different type definition than the other types. This is definitely worth highlighting to so I'm building the filters manually!
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
This commit started as a backport of [Lens] Fix bugs in Lens filters (#56441), but is no longer a strict backport because
setAppFiltersin the FilterManager code was added in #55158 which is not going into 7.6