-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Convert notify.warning calls to use toastNotifications #20767
Conversation
💔 Build Failed |
@spalger Could you take a look at the code relating to @elastic/kibana-design Could you please review the changes to region map, tile map, Graph, and vega visualizations? @elastic/ml-ui Could you please review the changes to ML? @bmcconaghy Could you please take a look at the change to Monitoring? |
💔 Build Failed |
💔 Build Failed |
@@ -38,8 +38,16 @@ export function checkLicense(Private, kbnBaseUrl) { | |||
const message = features.message; | |||
const exists = _.find(notify._notifs, (item) => item.content === message); |
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.
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.
Thanks! I just pushed a fix could you try it again?
684e48f
to
73e2399
Compare
💔 Build Failed |
Hey @cjcenizal this is great. Thanks for doing this. Love seeing so much code deleted. Apologies if those screens are not up to date, but could you remove the icon usage in the toasts? The warning color alone should be enough to pass on the status of the alert. |
Just looking at the screenshots, there seems to be some inconsistencies with period usage. I think we decided to only use periods if there are more than 2 sentences. Also for the last example in the graph app, can you link the "index pattern" text to the index pattern management screen? |
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.
Checked out the parts you asked me to review, LGTM
Thanks for doing this!!
💔 Build Failed |
💚 Build Succeeded |
courierNotifier.warning(new ShardFailure(response)); | ||
toastNotifications.addWarning({ | ||
title: 'Shard failure', | ||
text: `${response._shards.failed} of ${response._shards.total} shards failed`, |
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.
One of the most annoying things with shard failures currently is, that you don't get any insights into the actual failures, and that's very often a painpoint in discuss questions, since users need to check the actual browser request, and dig through that JSON. In the long run we definitely should build this notification in a way, that you can get a list of actual errors from the individual charts. Since you were anyway touching this place, I thought I mention that right now, in case you feel like we should do it within that PR. But I am also totally fine having that in a different PR (but I think we should take care of that rather sooner than later).
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.
Great point Tim. I think this is outside of the scope for this PR, but I've updated #5957 with more information. Hopefully we can move on this sometime soon.
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.
Yes, it would be good to add more info about the shard failure. When you do, it might be good to put this information in something other than a toast because a toast times out after a few seconds.
In the meantime, the toast can simply be one line:
3 of 6 shards failed
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.
Visualization code looks good to me!
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.
ML changes LGTM
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.
LGTM
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.
Monitoring update LGTM! Looks so nice
title: `Couldn't show ${event.mismatches.length} ${event.mismatches.length > 1 ? 'results' : 'result'} on the map`, | ||
text: `You can fix this by ensuring that each of these terms can be matched to a corresponding shape ` | ||
+ `on that shape's join field:${event.mismatches.join(',')}` | ||
}); |
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.
Unable to show 3 results on map
Ensure that each term matches a shape on that shape's join field.
toastNotifications.addWarning({ | ||
title: 'The data shown may be incomplete', | ||
text: 'All or part of your request has timed out', | ||
}); |
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.
Use a title only:
Data might be incomplete because your request timed out
courierNotifier.warning(new ShardFailure(response)); | ||
toastNotifications.addWarning({ | ||
title: 'Shard failure', | ||
text: `${response._shards.failed} of ${response._shards.total} shards failed`, |
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.
Yes, it would be good to add more info about the shard failure. When you do, it might be good to put this information in something other than a toast because a toast times out after a few seconds.
In the meantime, the toast can simply be one line:
3 of 6 shards failed
{' '} for more information | ||
</Fragment> | ||
), | ||
}); | ||
} |
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.
Support for time intervals was removed
For more information, view the log* index pattern.
where "view the log* index pattern" is the link
x-pack/plugins/graph/public/app.js
Outdated
notify.warning('Invalid URL - the url must contain a {{gquery}} string'); | ||
toastNotifications.addWarning({ | ||
title: 'Invalid URL', | ||
text: 'The url must contain a {{gquery}} string', |
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.
In the description:
url -> URL
add ending period after string
The URL must contain a {{gquery}} string.
x-pack/plugins/graph/public/app.js
Outdated
toastNotifications.addWarning({ | ||
title: 'No data sources', | ||
text: <p>Go to <a href={url}>Management > Index Patterns</a> and create an index pattern</p>, | ||
}); | ||
} | ||
|
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.
No data source
Go to Management > Index Patterns and create an index pattern.
Notes:
sources -> source
add period after pattern
} | ||
|
||
if (selectedJobIds.length > 1 || mlJobSelectService.groupIds.length) { | ||
// if more than one job or a group has been loaded from the URL | ||
if (selectedJobIds.length > 1) { | ||
// if more than one job, select the first job from the selection. | ||
notify.warning('Only one job may be viewed at a time in this dashboard', { lifetime: 30000 }); | ||
toastNotifications.addWarning('Only one job may be viewed at a time in this dashboard'); | ||
mlJobSelectService.setJobIds([selectedJobIds[0]]); |
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.
You can only view one job at a time in this dashboard
mlJobSelectService.setJobIds([selectedJobIds[0]]); | ||
} else { | ||
// if a group has been loaded | ||
if (selectedJobIds.length > 0) { | ||
// if the group contains valid jobs, select the first | ||
notify.warning('Only one job may be viewed at a time in this dashboard', { lifetime: 30000 }); | ||
toastNotifications.addWarning('Only one job may be viewed at a time in this dashboard'); | ||
mlJobSelectService.setJobIds([selectedJobIds[0]]); |
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.
You can only view one job at a time in this dashboard
@@ -71,7 +71,7 @@ export function timeBasedIndexCheck(indexPattern, showNotification = false) { | |||
if (showNotification) { | |||
const message = `The index pattern ${indexPattern.title} is not time series based. \ | |||
Anomaly detection can only be run over indices which are time based.`; | |||
notify.warning(message, { lifetime: 0 }); | |||
toastNotifications.addWarning(message); | |||
} |
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 index pattern ${indexPattern.title} is not based on a time series.
Anomaly detection only runs over time-based indices.
💔 Build Failed |
Failure:
|
Retest |
💔 Build Failed |
Looks like this is a legit failure. |
Retest |
💔 Build Failed |
💚 Build Succeeded |
* Replace notify.warning with toastNotifications in region map, vega, index_pattern, redirect_when_missing, graph, monitoring, and ML * Link to index patterns from Graph toast. * Delete RouteBasedNotifier. * Remove courierNotifier and SearchTimeout and ShardFailure errors. * Remove warning and custom notifier types.
* Replace notify.warning with toastNotifications in region map, vega, index_pattern, redirect_when_missing, graph, monitoring, and ML * Link to index patterns from Graph toast. * Delete RouteBasedNotifier. * Remove courierNotifier and SearchTimeout and ShardFailure errors. * Remove warning and custom notifier types.
This PR introduces the following changes:
routeBasedNotifier
which wasn't being used.courierNotifier
with toasts, and removes theShardFailure
andSearchTimeout
classes because they're not longer used.redirectWhenMissing
warning.custom
andwarning
types from notifier.Index pattern
Region map
Courier
Redirect when missing
Graph
Monitoring