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

display toast when saved query can not be loaded #56643

Closed
wants to merge 1 commit into from

Conversation

nreese
Copy link
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 Visualization editors, elastic-charts and infrastructure 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
Contributor

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

@nreese nreese mentioned this pull request Feb 3, 2020
@@ -112,8 +112,12 @@ export const createSavedQueryService = (
};

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
Member

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
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
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
@nreese
Copy link
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 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.

5 participants