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

Retain pinned filters when loading and clearing saved queries #54307

Merged
merged 7 commits into from
Jan 21, 2020

Conversation

Bargs
Copy link
Contributor

@Bargs Bargs commented Jan 8, 2020

Summary

Fixes #53258

When we originally implemented Saved Queries we had them overwrite pinned filters on load and on clear. This caused the issue in #53258. If you have a saved query loaded in Discover for example and you navigate to a different app and then back to Discover, that saved query will get get reloaded since app state is retained when navigating back and forth between apps. If you created a pinned filter in between visits to Discover, it will get removed when the saved query is reloaded.

This issue made me reconsider our previous decision. I think pinned filters should not be affected by loading or clearing a saved query, since they are pinned they should only be removed if the user explicitly asks for it. This solves the reported issue and I also think it makes the UI more intuitive.

I updated this for Discover, Visualize, Dashboard, Lens, and Maps.

@XavierM I looked at SIEM but it wasn't clear to me if you use global state and pinned filters at all. Do you?

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

- [ ] This was checked for cross-browser compatibility, including a check against IE11
- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
- [ ] Documentation was added for features that require explanation or tutorials

For maintainers

- [ ] This was checked for breaking API changes and was labeled appropriately

@Bargs Bargs added release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.0.0 v7.6.0 labels Jan 8, 2020
@Bargs Bargs requested review from TinaHeiligers and a team January 8, 2020 21:59
@Bargs Bargs requested a review from a team as a code owner January 8, 2020 21:59
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

lgtm for Maps changes
code review, tested in chrome

@XavierM
Copy link
Contributor

XavierM commented Jan 8, 2020

@Bargs I would have to add the global filter, I like the way you did it. if you interested, I can show you where we should add that.

@Bargs
Copy link
Contributor Author

Bargs commented Jan 9, 2020

@XavierM ok so you don't use global filters at the moment? In other words, there's nothing I should update for SIEM in this PR?

@Bargs Bargs added v7.7.0 and removed v7.6.0 labels Jan 15, 2020
@@ -239,7 +239,9 @@ export function App({
setState(s => ({ ...s, savedQuery }));
}}
onSavedQueryUpdated={savedQuery => {
data.query.filterManager.setFilters(savedQuery.attributes.filters || state.filters);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wylieconlon do you mind looking at the Lens changes to make sure I didn't screw anything up? It's just this file and the test file above.

@Bargs
Copy link
Contributor Author

Bargs commented Jan 17, 2020

@TinaHeiligers do you think you'd have bandwidth to review this next week?

@TinaHeiligers
Copy link
Contributor

TinaHeiligers commented Jan 17, 2020 via email

Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

The code looks good and the fix works locally.
LGTM

@Bargs
Copy link
Contributor Author

Bargs commented Jan 21, 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

@Bargs Bargs merged commit 8845608 into elastic:master Jan 21, 2020
Bargs pushed a commit to Bargs/kibana that referenced this pull request Jan 21, 2020
…c#54307)

When we originally implemented Saved Queries we had them overwrite pinned filters on load and on clear. This caused the issue in elastic#53258. If you have a saved query loaded in Discover for example and you navigate to a different app and then back to Discover, that saved query will get get reloaded since app state is retained when navigating back and forth between apps. If you created a pinned filter in between visits to Discover, it will get removed when the saved query is reloaded.

This issue made me reconsider our previous decision. I think pinned filters should not be affected by loading or clearing a saved query, since they are pinned they should only be removed if the user explicitly asks for it. This solves the reported issue and I also think it makes the UI more intuitive.
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 22, 2020
* master: (38 commits)
  [ML] Fix counters and percentages for array fields on the Data visualizer page (elastic#55209)
  [SIEM][Detection Engine] Tags being turned into null
  rules part deux (elastic#55507)
  [DOCS] Add tip for using elasticsearch-certutil http command (elastic#55357)
  [SIEM][Detection Engine] Critical blocker, fixes schema accepting values it should not (elastic#55488)
  [SIEM] Detections create prepackage rules (elastic#55403)
  [Reporting] Convert CSV Export libs to Typescript (elastic#55117)
  [Maps] show field type icons in data driven styling field select (elastic#55166)
  Adds event log for actions and alerting (elastic#45081)
  [SIEM][Detection Engine] Fixes critical blocker where signals on signals are not operating
  [SIEM][Detection Engine] Critical blocker, adds need REST prefix for cloud
  remove incorrect config (elastic#55427)
  Retain pinned filters when loading and clearing saved queries (elastic#54307)
  Resolver zoom, pan, and center controls (elastic#55221)
  Skip failing endpoint saga tests
  [skip-ci] Update migration guide to add rendering service example (elastic#54744)
  [DOCS] Updates to heat map page (elastic#55097)
  [Endpoint] Fix saga to start only after store is created and stopped on app unmount (elastic#55245)
  [Logs UI] Use the correct icons and labels in the feature cont… (elastic#55292)
  [Uptime] Handle locations with names but no geo data (elastic#55234)
  ...
Bargs pushed a commit that referenced this pull request Jan 22, 2020
#55473)

When we originally implemented Saved Queries we had them overwrite pinned filters on load and on clear. This caused the issue in #53258. If you have a saved query loaded in Discover for example and you navigate to a different app and then back to Discover, that saved query will get get reloaded since app state is retained when navigating back and forth between apps. If you created a pinned filter in between visits to Discover, it will get removed when the saved query is reloaded.

This issue made me reconsider our previous decision. I think pinned filters should not be affected by loading or clearing a saved query, since they are pinned they should only be removed if the user explicitly asks for it. This solves the reported issue and I also think it makes the UI more intuitive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loose of “pinned filter” when switching from dashboard to Discover (when using “Saved queries”)
6 participants