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

[Discover] Inline data fetching errors #152311

Merged
merged 19 commits into from
Mar 20, 2023

Conversation

davismcphee
Copy link
Contributor

@davismcphee davismcphee commented Feb 28, 2023

Summary

Note: If your team's review is requested on this PR related to notification service changes, it's likely because somewhere in your codebase NotificationsSetup was being passed to a function/component requiring NotificationsStart or vice versa. The interfaces were previously identical so it didn't matter, but an additional function was added to NotificationsStart in this PR that created type errors which needed to be resolved.

This PR updates Discover to use inline error messages for data fetching errors instead of toasts.

For most error messages, the title and full message will be displayed inline as well as a "Show details" button which opens the standard error dialog. For errors which have special handling and render custom content instead of just the error message, the custom content will be rendered in the callout body for the "No results" state, or rendered in a popover when clicking the "Show details" button for the banner-style error display.

No results with regular error message:
no_results

Banner-style with regular error message:
inline

Banner-style with regular error message in mobile:
inline_mobile

Standard error dialog:
error_dialog

No results with overridden content:
no_results_override

Banner-style with overridden content modal:
modal

Resolves #149488.

Checklist

For maintainers

@davismcphee davismcphee added Feature:Discover Discover Application Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. labels Feb 28, 2023
@davismcphee davismcphee self-assigned this Feb 28, 2023
@davismcphee davismcphee force-pushed the discover-inline-search-errors branch 5 times, most recently from 5a0ce83 to 3ed0bfb Compare March 7, 2023 14:07
@davismcphee davismcphee marked this pull request as ready for review March 7, 2023 15:21
@davismcphee davismcphee requested review from a team as code owners March 7, 2023 15:21
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@davismcphee davismcphee requested review from a team as code owners March 7, 2023 15:21
Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

Fleet change 🚀

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

Service addition in dashboard LGTM! Code only review.

Copy link
Contributor

@pgayvallet pgayvallet 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 Core changes

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

👍 it's much better this way! quick first question, this PR doesn't change the saved search embeddable handling currently, this will be a follow up, right? (just tested an embeddable fetching in offline mode, there ain't any message displayed about this state)

Copy link
Contributor

@yuliacech yuliacech left a comment

Choose a reason for hiding this comment

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

Management team changes LGTM, quickly tested locally that Index Management works as expected

@kc13greiner kc13greiner self-requested a review March 8, 2023 18:09
Copy link
Contributor

@kc13greiner kc13greiner left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +37 to +49
if (error.constructor.name === 'HttpFetchError' || error instanceof BfetchRequestError) {
const defaultMsg = i18n.translate('data.errors.fetchError', {
defaultMessage: 'Check your network connection and try again.',
});

return {
title: i18n.translate('data.search.httpErrorTitle', {
defaultMessage: 'Unable to connect to the Kibana server',
}),
body: error.message || defaultMsg,
};
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm just wondering how to get to the defaultMessage since it sounds more helpful than "Failed to fetch":
Bildschirmfoto 2023-03-09 um 16 53 02

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was also curious about this. I think we should discuss it and decide if it might be more useful to always show the defaultMessage for these errors. Or maybe at least showing the defaultMessage + the error message.

text: toMountPoint(e.message || defaultMsg, {
theme$: this.deps.theme.theme$,
}),
title: overrideDisplay.title,
Copy link
Member

@kertal kertal Mar 9, 2023

Choose a reason for hiding this comment

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

It's unrelated to this PR, but just a thought, it would be interesting if when this is called (which is no longer the case in Discover 🥳 ) could lead to the storm of toast in certain situations

E.g. here:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I imagine calling data.search.showError too much probably is responsible for some of the toast storms. It might be a candidate to consider throttling too.

Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

Design changes LGTM 🥳

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Transform changes LGTM.

@davismcphee davismcphee force-pushed the discover-inline-search-errors branch from b60c1aa to e74ef63 Compare March 20, 2023 18:58
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 445 446 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/core-notifications-browser 23 27 +4
data 2573 2577 +4
total +8

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dashboard 386.7KB 386.7KB +36.0B
discover 395.6KB 397.5KB +1.9KB
indexManagement 525.5KB 525.5KB -10.0B
total +1.9KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 350.9KB 351.0KB +112.0B
data 403.7KB 403.8KB +88.0B
total +200.0B
Unknown metric groups

API count

id before after diff
@kbn/core-notifications-browser 35 39 +4
data 3269 3273 +4
total +8

ESLint disabled line counts

id before after diff
securitySolution 433 436 +3

Total ESLint disabled count

id before after diff
securitySolution 513 516 +3

History

  • 💛 Build #114066 was flaky b60c1aa71c60676ab4ec889741c10370992509c3
  • 💚 Build #113220 succeeded 42197c7bd68030defa6ac6c5831e8c8ea0c46d50
  • 💛 Build #112388 was flaky 3ed0bfb612dc579fcb6e44025ef015c5452b7e6f
  • 💚 Build #112191 succeeded 5a0ce83ad2c821c654db4b9ce980ff5bd4dce689
  • 💔 Build #111911 failed 913c3e8252fcf32c3c148cdc249c6228438da794
  • 💔 Build #111864 failed 777c1d52ac1fbd565d022136361a072147f9d683

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

cc @davismcphee

@davismcphee davismcphee merged commit 26f0f52 into elastic:main Mar 20, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Mar 20, 2023
@davismcphee davismcphee deleted the discover-inline-search-errors branch March 20, 2023 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Discover Discover Application release_note:enhancement Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Discover] Inline toast error message in Discover main