Skip to content
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

Bugfix dashboard unpins filters #62301

Merged
merged 12 commits into from
Apr 12, 2020
Merged

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented Apr 2, 2020

Summary

Fixes #62126

Fixes following cases:

  1. Saving dashboard with pinned filter unpins it Do not save pinned filters with dashboard see Bugfix dashboard unpins filters #62301 (comment)
  2. When navigating with global filter to dashboard with same saved filter, filter becomes unpinned
  3. When navigating from listing to dashboard with saved filter, back button didn't work

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@Dosant Dosant added release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v7.8.0 v8.0.0 Feature:Dashboard Dashboard related features Feature:Filters Feature:StateManagement labels Apr 3, 2020
@Dosant Dosant marked this pull request as ready for review April 3, 2020 10:32
@Dosant Dosant requested a review from a team April 3, 2020 10:32
@Dosant Dosant requested a review from a team as a code owner April 3, 2020 10:32
@Dosant Dosant requested review from flash1293 and lizozom April 3, 2020 10:32
@Dosant Dosant added bug Fixes for quality problems that affect the customer experience regression labels Apr 3, 2020
Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested and couldn't find anything behaving strange (everything like in the description).

I just want to raise the point that this is not the behavior in Visualize - there pinned filters are just ignored when saving the visualization. In Discover it's currently unpinning the filter when saving a saved search and saving it along with the search (seems similar to the behavior of dashboard before this change).

This means this PR will change 2 different behaviors in different apps to 3 different behaviors in different apps - that doesn't seem right to me.

As pinned/non-pinned filters are already confusing enough I think we should at least make them behave consistent in all of the apps - then it doesn't matter to me too much what exactly the behavior is.

I think the following is the most sane (at least to me, but that might be highly subjective):

  • Don't save pinned filters ever - when saving a saved object, only non-pinned filters are considered
  • Don't unpin filters automatically in any case (that's definitely buggy behavior)
  • When carrying a pinned filter over from another app/saved object and the current saved object has the same filter in a non-pinned status, display both of them separately (pinned and non-pinned side by side). Otherwise we might accidentally save a saved object without this filter because we magically transformed a non-pinned filter in a pinned filter

This follows just one simple rule: Never change the filter status automatically - if a filter changes from pinned to unpinned or vice versa, it was always because of an explicit user action.

Sorry for hijacking this PR, we can also move this discussion somewhere else. Also cc @timroes

test/functional/apps/dashboard/dashboard_filter_bar.js Outdated Show resolved Hide resolved
@Dosant
Copy link
Contributor Author

Dosant commented Apr 3, 2020

@flash1293,

yee.. have to admit I didn't look into discover and visualize and was focused on fixing a regression in dashboard (my bad) which seemed to be like a really unpleasant one.

I think the following is the most sane (at least to me, but that might be highly subjective):
Don't save pinned filters ever - when saving a saved object, only non-pinned filters are considered

I think behaviour in this pr is better, because we save state closer to what user sees on ui and likely what user expects to see when opening saved stuff again

Don't unpin filters automatically in any case (that's definitely buggy behavior)

Yes, that is terrible. Agree. This is fixed in this pr in dashboard. We can follow up on that in discover in separate pr for 7.7 fix?

When carrying a pinned filter over from another app/saved object and the current saved object has the same filter in a non-pinned status, display both of them separately (pinned and non-pinned side by side). Otherwise we might accidentally save a saved object without this filter because we magically transformed a non-pinned filter in a pinned filter

Afaik how FilterManager works - this is not trivial and risky change. Not something I'd do without careful considerations.

I think (subjectively) current behaviour in dashboard is pretty good one :) Happy with the result from user standpoint

@Dosant Dosant requested a review from timroes April 3, 2020 15:24
flash1293
flash1293 previously approved these changes Apr 3, 2020
Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also happy with the behavior in this PR, @Dosant - you make a good point about saving what the user is currently seeing in terms of data. If it would work like this in Discover and Visualize as well, I think it would be totally fine.

With my "most sane" behavior I tried to rethink it from the beginning, but it's definitely not worth going through major changes just for the sake of it.

If we are following up with a discover fix introducing the same change there, it's definitely a LGTM from me (AFAIK Visualize was always an outlier in this regard).

Still interested in @timroes opinion on this :)

@timroes
Copy link
Contributor

timroes commented Apr 3, 2020

Thanks for pinning me. Yeah due to some regressions in the past this behavior has driftet apart in different applications. The "correct" (in the sense of how we defined it do behave) behavior is, that pinned filters should always be ignored when saving. They are just your temporary state while navigating and should not be stored in any saved object. I know that this is currently buggy in a couple of applications.

@cchaos is also working on designs to separate pinned filters and unpinned filters properly, and in general have a better way around showing what's part of the saved object and what not. But until we have that, pinned filters should basically just not be saved.

@Dosant
Copy link
Contributor Author

Dosant commented Apr 3, 2020

@timroes, I'll adjust then this pr to not save pinned filter together with saved object.

@lizozom
Copy link
Contributor

lizozom commented Apr 5, 2020

@elasticmachine merge upstream

…-upins-filters

# Conflicts:
#	src/plugins/dashboard/public/application/lib/filter_utils.ts
#	src/plugins/dashboard/public/application/lib/update_saved_dashboard.ts
@Dosant Dosant removed the release_note:skip Skip the PR/issue when compiling release notes label Apr 6, 2020
@Dosant
Copy link
Contributor Author

Dosant commented Apr 6, 2020

@timroes, @flash1293, @lizozom please re-review. Change the behaviour to NOT save pinned filters at all (#62301 (comment)). Other 2 bugs stayed fixed

@Dosant Dosant requested a review from flash1293 April 6, 2020 14:28
@flash1293 flash1293 dismissed their stale review April 7, 2020 07:38

Reviewing new behavior

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and everything seems fine, LGTM.

The current behavior is not 100% what I had in mind before reviewing this PR (so thanks for making me aware of the nuances), but it's consistent and easy to learn.

I think the only problem to have this consistent now is the Discover behavior (unpinning filters when saving and when there is a pinned and unpinned version of the same filter) - I'm going to create a separate PR for that.

@Dosant
Copy link
Contributor Author

Dosant commented Apr 7, 2020

@elasticmachine merge upstream

@Dosant
Copy link
Contributor Author

Dosant commented Apr 8, 2020

@elasticmachine merge upstream

@Dosant
Copy link
Contributor Author

Dosant commented Apr 8, 2020

@elasticmachine merge upstream

@Dosant
Copy link
Contributor Author

Dosant commented Apr 10, 2020

Waiting for @lizozom approve.

fyi @flash1293, we changed implementation by moving it from dashboard code to filter manager: 94e360e

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lizozom
Copy link
Contributor

lizozom commented Apr 12, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@Dosant Dosant merged commit 1199c8c into elastic:master Apr 12, 2020
Dosant added a commit to Dosant/kibana that referenced this pull request Apr 12, 2020
Fixes following cases:

Saving dashboard with pinned filter unpins it. Do not save pinned filters with dashboard see elastic#62301 (comment)
When navigating with global filter to dashboard with same saved filter, filter becomes unpinned
When navigating from listing to dashboard with saved filter, back button didn't work

Co-authored-by: Elastic Machine <[email protected]>
Dosant added a commit to Dosant/kibana that referenced this pull request Apr 12, 2020
Fixes following cases:

Saving dashboard with pinned filter unpins it. Do not save pinned filters with dashboard see elastic#62301 (comment)
When navigating with global filter to dashboard with same saved filter, filter becomes unpinned
When navigating from listing to dashboard with saved filter, back button didn't work

Co-authored-by: Elastic Machine <[email protected]>
Dosant added a commit that referenced this pull request Apr 12, 2020
Fixes following cases:

Saving dashboard with pinned filter unpins it. Do not save pinned filters with dashboard see #62301 (comment)
When navigating with global filter to dashboard with same saved filter, filter becomes unpinned
When navigating from listing to dashboard with saved filter, back button didn't work

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
Dosant added a commit that referenced this pull request Apr 12, 2020
Fixes following cases:

Saving dashboard with pinned filter unpins it. Do not save pinned filters with dashboard see #62301 (comment)
When navigating with global filter to dashboard with same saved filter, filter becomes unpinned
When navigating from listing to dashboard with saved filter, back button didn't work

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Dashboard Dashboard related features Feature:Filters Feature:StateManagement regression release_note:fix v7.7.0 v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard unpins filters
6 participants