-
Notifications
You must be signed in to change notification settings - Fork 890
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
Add VisLayer error toasts when rendering vis #3649
Add VisLayer error toasts when rendering vis #3649
Conversation
d013852
to
242510f
Compare
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## feature/feature-anywhere #3649 +/- ##
============================================================
- Coverage 66.49% 66.45% -0.05%
============================================================
Files 3243 3244 +1
Lines 62400 62435 +35
Branches 9630 9640 +10
============================================================
- Hits 41494 41489 -5
- Misses 18598 18632 +34
- Partials 2308 2314 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 9 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Confirmed with @opensearch-project/opensearch-ux on the finalized wording for the aggregate detailed error message.
|
c739b3a
to
246ba94
Compare
title: i18n.translate('visualizations.renderVisTitle', { | ||
defaultMessage: `Error loading data on the ${this.vis.title} chart`, | ||
}), | ||
toastMessage: ' ', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the toast empty? Can you add a screenshot of the toast to the PR? it will be helpful to see what this looks like. Also you might want to add an id to the toast if you want to prevent he toast from being displayed again should the same expression run again before the toast is dismissed (But be careful to keep the ID specific to he vis since the id is global to the dashboard)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also a little confused why the toast is empty here. In this case there was no vis layer errors, why is there a default message still with "error loading data on the chart"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for the toast message being empty here is because it is reserved for showing up in the modal details (the danger callout text). Added a screenshot of the toast to description.
I'll add an ID to the toast after rebasing and pulling in the upstream changes that include the ID as an option.
Note this is all happening inside an if (err !== undefined)
block. This is only true when one or more VisLayers had an error. I'll add a comment in there too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: after checking #3752 it doesn't include updating ErrorToastOptions
which is needed for adding an ID to addError
fn used for displaying error toasts. I will leave this empty for now and we can add later if that is decided to be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the ID so it can be handled for addError
scenarios. See commit 739ddaa
Confirmed that the toast only shows up once on multiple re-renders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the ID here coming from the plugin resource ID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the visualize_embeddable ID such that it's unique within the dashboard. This enforces that there will only be one toast per vis on a dashboard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you do any testing what the toast would look like or have seen before if we have dozens of detector per the viz and they all have some error, will the toast be scrollable at some point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't individually tested that but yes, it will be scrollable. It is designed to hold very long text (error stack traces)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to reopen the thread, I'm just trying to understand whether our toast interface needs to be improved. The mocks make sense to me, where we have only a title in the toast. But why do we need to pass a whitespace character as toastMessage
? It seems like we should be able to omit that property altogether, or else pass undefined, null, or at least an empty string. Do we need to open an issue to improve the addError
method?
Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Tyler Ohlsen <[email protected]>
2ae63b0
to
2a8ac75
Compare
Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Tyler Ohlsen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one change so that the context here isnt lost in future, but otherwise the change looks good :) Also do you know why the tests are failing?
Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Tyler Ohlsen <[email protected]>
Fixed. Failure seemed to be some issue when switching to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. I had one question about what seems like an annoyance in the toasts interface and one suggestion for future refactoring, but looks good to me.
title: i18n.translate('visualizations.renderVisTitle', { | ||
defaultMessage: `Error loading data on the ${this.vis.title} chart`, | ||
}), | ||
toastMessage: ' ', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to reopen the thread, I'm just trying to understand whether our toast interface needs to be improved. The mocks make sense to me, where we have only a title in the toast. But why do we need to pass a whitespace character as toastMessage
? It seems like we should be able to omit that property altogether, or else pass undefined, null, or at least an empty string. Do we need to open an issue to improve the addError
method?
const matchingVisLayers = visLayersWithErrors.filter( | ||
(visLayer) => visLayer.pluginResource.type === type | ||
); | ||
if (index !== 0) msgDetails += '\n\n\n'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style nit, no need to change: this is basically a join
operation on an array of strings - we could refactor this message composition so that each of the forEach
loops are just mapping operations that return arrays of strings and then join them together to form the final message rather than just concatenating everything together as we go.
Description
When rendering a visualization, we want to push a toast notification with error details if there was any failures fetching associated
VisLayer
s. This PR adds that by aggregating any failures and usingnotifications
service to add an error toast infetchVisLayers()
.We override the
stack
value of the error, such that when it is parsed and read in thenotifications
addError()
fn, it is shown properly to be the aggregate details in string form.It also makes
message
inVisLayerError
a required field (instead of optional as before), which means expression functions that are generating these errors should populate a human-readable message here so it can be propagated and shown in the details modal.Example screenshots:
Issues Resolved
Partially resolves #3580 but bulk will be covered in View Events PR #3415.
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr