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

Convert notify.warning calls to use toastNotifications #20767

Merged
merged 17 commits into from
Jul 20, 2018

Conversation

cjcenizal
Copy link
Contributor

@cjcenizal cjcenizal commented Jul 13, 2018

This PR introduces the following changes:

  • Removes routeBasedNotifier which wasn't being used.
  • Replaces the courierNotifier with toasts, and removes the ShardFailure and SearchTimeout classes because they're not longer used.
  • Uses toasts in region map, tile map, Graph, and vega visualizations.
  • Uses toasts to show index pattern warnings.
  • Uses toasts to show redirectWhenMissing warning.
  • Uses a variety of toasts and banners to show warnings in ML.
  • Uses toasts to show warnings in Monitoring.
  • Removes custom and warning types from notifier.

Index pattern

image

Region map

image

Courier

image

image

Redirect when missing

image

Graph

image

Monitoring

image

image

@elasticmachine
Copy link
Contributor

💔 Build Failed

@cjcenizal cjcenizal changed the title [WIP] Converts notify.warning calls to use toastNotifications Converts notify.warning calls to use toastNotifications Jul 17, 2018
@cjcenizal cjcenizal added chore Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.0.0 v6.4.0 labels Jul 17, 2018
@cjcenizal
Copy link
Contributor Author

cjcenizal commented Jul 17, 2018

@spalger Could you take a look at the code relating to routeBasedNotifier, courierNotifier, the ShardFailure and SearchTimeout errors, index pattern, redirectWhenMissing, and the notifier in general? This PR will aid in EUIfying the chrome, btw.

@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?

@cjcenizal cjcenizal changed the title Converts notify.warning calls to use toastNotifications Convert notify.warning calls to use toastNotifications Jul 17, 2018
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@@ -38,8 +38,16 @@ export function checkLicense(Private, kbnBaseUrl) {
const message = features.message;
const exists = _.find(notify._notifs, (item) => item.content === message);
Copy link
Member

Choose a reason for hiding this comment

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

This duplication check no longer works.
when jumping between pages we now get multiple banners.
screen shot 2018-07-17 at 07 10 44

Copy link
Contributor Author

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?

@cjcenizal cjcenizal force-pushed the notify-warning-toasts branch from 684e48f to 73e2399 Compare July 17, 2018 06:16
@elasticmachine
Copy link
Contributor

💔 Build Failed

@snide
Copy link
Contributor

snide commented Jul 17, 2018

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.

@cchaos
Copy link
Contributor

cchaos commented Jul 17, 2018

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?

Copy link
Contributor

@spalger spalger left a 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!!

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

courierNotifier.warning(new ShardFailure(response));
toastNotifications.addWarning({
title: 'Shard failure',
text: `${response._shards.failed} of ${response._shards.total} shards failed`,
Copy link
Contributor

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).

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

@timroes timroes left a 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!

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

ML changes LGTM

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@pickypg pickypg left a 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(',')}`
});
Copy link
Contributor

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',
});
Copy link
Contributor

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`,
Copy link
Contributor

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>
),
});
}
Copy link
Contributor

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

notify.warning('Invalid URL - the url must contain a {{gquery}} string');
toastNotifications.addWarning({
title: 'Invalid URL',
text: 'The url must contain a {{gquery}} string',
Copy link
Contributor

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.

toastNotifications.addWarning({
title: 'No data sources',
text: <p>Go to <a href={url}>Management &gt; Index Patterns</a> and create an index pattern</p>,
});
}

Copy link
Contributor

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]]);
Copy link
Contributor

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]]);
Copy link
Contributor

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);
}
Copy link
Contributor

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.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@cjcenizal
Copy link
Contributor Author

Failure:

01:01:48    │ proc  [ftr]        └- ✖ fail: "management scripted fields creating and using Painless numeric scripted fields should see scripted field value in Discover"
01:01:48    │ proc  [ftr]        │        tryForTime timeout: [POST http://localhost:9515/session/500caaac3ccb3785de8657b0c9bd4388/element / {"using":"css selector","value":".visualization"}] no such element: Unable to locate element: {"method":"css selector","selector":".visualization"}

@cjcenizal
Copy link
Contributor Author

Retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@cjcenizal
Copy link
Contributor Author

Looks like this is a legit failure.

@cjcenizal
Copy link
Contributor Author

Retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@cjcenizal cjcenizal merged commit ab0e2ba into elastic:master Jul 20, 2018
@cjcenizal cjcenizal deleted the notify-warning-toasts branch July 20, 2018 22:11
cjcenizal added a commit to cjcenizal/kibana that referenced this pull request Jul 20, 2018
* 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.
cjcenizal added a commit that referenced this pull request Jul 20, 2018
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v6.4.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants