opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.69k stars 885 forks source link

Enhanced toast notifications #3059

Open ashwin-pc opened 1 year ago

ashwin-pc commented 1 year ago

Is your feature request related to a problem? Please describe.

Today toast notifications provided by the notifications service have a few drawback and limitations that can cause user frustration and require hacky solutions by individual plugins to overcome. Some of these issues are:

  1. It can easily overwhelm the user since they have very little controls to prevent frequent rerender errors from spewing out multiple toasts for the same event.
  2. Once dismissed or timed out, there is no way for the user to see past notifications
  3. No way to act on a notification

Describe the solution you'd like

There are a few ways we can address the different problems:

  1. Notification ID: Multiple notifications with the same ID will result inthe notification being displayed only once with the timeout being reset each time and the count displayed with some truncation limit (e.g. 99+)
  2. Notification Drawer: Notifications when emitted can be optionally be added to a notification drawer that the user can manually clear or take action from.
  3. Notification actions: Add a provision to add actions to toasts that the user can take to act on a notification directly

Describe alternatives you've considered

-

Additional context

Here is an example of how the dashboards plugin makes sure that no more than one notification is shown at a time.

https://github.com/ashwin-pc/OpenSearch-Dashboards/blob/0640b4646415b18da84414199d2331d6dfba4d61/src/plugins/dashboard/public/application/actions/replace_panel_flyout.tsx#L64-L79

ashwin-pc commented 1 year ago
  1. is resolved in #3752