-
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
[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) |
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.
Tried to pull to test, but it didn't work for me. After trying to create new Lens vis and after navigated to Lens app, browser has stuck. .
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 Out
Stack Trace
Kibana 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 Out
Stack Trace
Kibana Pipeline / kibana-xpack-agent / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/lens.lens app "after all" hook in ""Standard Out
Stack Trace
and 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 Out
Stack Trace
Kibana Pipeline / x-pack-intake-agent / X-Pack Jest Tests.x-pack/legacy/plugins/lens/public/app_plugin.Lens App renders the editor frameStandard Out
Stack Trace
History
To update your PR or re-run it, just comment with: |
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 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.
@@ -239,7 +255,7 @@ export function App({ | |||
setState(s => ({ ...s, savedQuery })); | |||
}} | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix using that code is already in 7.7, but I couldn't backport it to 7.6
const args = defaultArgs; | ||
args.editorFrame = frame; | ||
|
||
const instance = mount(<App {...args} />); | ||
const indexPattern = ({ id: 'index1' } as unknown) as IIndexPattern; | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
setAppFilters
in the FilterManager code was added in #55158 which is not going into 7.6