Skip to content

display toast when saved query can not be loaded#56643

Closed
nreese wants to merge 1 commit intoelastic:masterfrom
nreese:url_saved_query
Closed

display toast when saved query can not be loaded#56643
nreese wants to merge 1 commit intoelastic:masterfrom
nreese:url_saved_query

Conversation

@nreese
Copy link
Copy Markdown
Contributor

@nreese nreese commented Feb 3, 2020

When working to replace AppState in the Maps application I noticed 2 problems with how savedQuery were synced to the URL.

  1. If the saved query id does not exist, then the error is displayed in console and the saved query is not loaded. No feedback is provided to the user that the saved query failed to load
  2. If the URL _a parameter does not have savedQuery parameter, then adding one has not effect.

This PR fixes these problems by causing savedQueryService.getSavedQuery to throw when the saved object can not be loaded. The PR also changes the logic from $scope.savedQuery && isNewId to !$scope.savedQuery || isNewId

@nreese nreese added release_note:fix Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v8.0.0 v7.7.0 labels Feb 3, 2020
@nreese nreese requested review from a team as code owners February 3, 2020 16:10
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@nreese nreese mentioned this pull request Feb 3, 2020
const getSavedQuery = async (id: string): Promise<SavedQuery> => {
const response = await savedObjectsClient.get<SerializedSavedQueryAttributes>('query', id);
return parseSavedQueryObject(response);
const savedObject = await savedObjectsClient.get<SerializedSavedQueryAttributes>('query', id);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non blocker for this PR, but: should the services be showing toasts or should we rather return an error and the application using it can decide whether it wants to show a toast or handle the error in some other way.

Copy link
Copy Markdown
Contributor

@lizozom lizozom Feb 3, 2020

Choose a reason for hiding this comment

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

@ppisljar FYI I'm migrating this part into #56643 #56160

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

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

lizozom pushed a commit to lizozom/kibana that referenced this pull request Feb 3, 2020
Fix bug where saved query clean does not reset query
lizozom pushed a commit that referenced this pull request Feb 6, 2020
* Clean up discover

* Clean up visualize

* Clean up dashboard

* use-default-behaviors

* ts

* Discover interval changing

* timerange for interval definition in editor

* ts

* Revert most of changes to dashboard app because of changes in #55443

* Fix spaces

* Revert editor to scope PR!

* typo

* keep savedQuery state in create search bar

* update saved query to save it with the state

* revert all dashboard changes

* saved queries

* @kertal code review

* fix applying filters from histogram

* @Dosant code review

* Merge changes from #56643 to handle saved query errors

Fix bug where saved query clean does not reset query

* change string path

* if

* Extract useFilterManager and useTimefilter

* Split useSavedQuery and restore capability of changing saved query in URL

* Added some tests

* context view

* Remove useMemo

* spaces

* Support filter intial values
Improve useSavedQuery hook in terface

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
lizozom pushed a commit to lizozom/kibana that referenced this pull request Feb 6, 2020
* Clean up discover

* Clean up visualize

* Clean up dashboard

* use-default-behaviors

* ts

* Discover interval changing

* timerange for interval definition in editor

* ts

* Revert most of changes to dashboard app because of changes in elastic#55443

* Fix spaces

* Revert editor to scope PR!

* typo

* keep savedQuery state in create search bar

* update saved query to save it with the state

* revert all dashboard changes

* saved queries

* @kertal code review

* fix applying filters from histogram

* @Dosant code review

* Merge changes from elastic#56643 to handle saved query errors

Fix bug where saved query clean does not reset query

* change string path

* if

* Extract useFilterManager and useTimefilter

* Split useSavedQuery and restore capability of changing saved query in URL

* Added some tests

* context view

* Remove useMemo

* spaces

* Support filter intial values
Improve useSavedQuery hook in terface

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
lizozom pushed a commit that referenced this pull request Feb 6, 2020
* Clean up discover

* Clean up visualize

* Clean up dashboard

* use-default-behaviors

* ts

* Discover interval changing

* timerange for interval definition in editor

* ts

* Revert most of changes to dashboard app because of changes in #55443

* Fix spaces

* Revert editor to scope PR!

* typo

* keep savedQuery state in create search bar

* update saved query to save it with the state

* revert all dashboard changes

* saved queries

* @kertal code review

* fix applying filters from histogram

* @Dosant code review

* Merge changes from #56643 to handle saved query errors

Fix bug where saved query clean does not reset query

* change string path

* if

* Extract useFilterManager and useTimefilter

* Split useSavedQuery and restore capability of changing saved query in URL

* Added some tests

* context view

* Remove useMemo

* spaces

* Support filter intial values
Improve useSavedQuery hook in terface

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@nreese
Copy link
Copy Markdown
Contributor Author

nreese commented Feb 10, 2020

Closing, changes have been added to search bar with #56160. Maps is getting updated to stateful search bar with #57282

@nreese nreese closed this Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:fix Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v7.7.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants