apache / apache/superset

[SIP-96] Proposal for adding a notification feature

Open
#24,271 34 comments 12 reactions 1 assignee Claimed by @mattitoo View on GitHub
extension-candidate sip
Dominant language
Python
Stars
74.8k
Forks
18.3k
Avg merge
2d 7h
Merged PRs (30d)
692

Description

**Motivation**
As maintainer of a Superset Instance, I want to be able to message my users, so I can inform them about possible downtimes, data troubles or other causes.
This can of course be achieved in various channels (Mail, Slack, Teams, etc) but it also makes sense to do this in the actual tool used, in this case right inside Superset.

**Proposed Change**
Luckily, Superset already has a messaging capability built in: so-called Toasts, which are displayed after certain actions like saving, refreshing dashboards and so on.
We have created a “management interface” for such toasts, in which new messages (we call them notifications) can be configured:

Bildschirmfoto 2023-05-30 um 15 37 25

Bildschirmfoto 2023-05-30 um 15 37 39

Following parameters can be set:
·       Active
·       Name or Summary
·       Category (currently 3 categories, these manage the color of the notification: Info=blue, Warning=yellow, Alert=red)
·       Message: The message to be displayed.
·       Time Range: The range in which the notification should be displayed
·       Use daily timeframe: If active, the notification is only shown when the current time is inside the start and end time
·       Re-trigger: Minimum of 5 Minutes to reduce the load on the database due to querying for new messages for each user
·       Duration: How long until the notification disappears (it can always be closed via the ‘x’)
·       Roles: Which roles should see that notification

For each user, the internal database is queried at login and at a certain interval to see if she/he has new notifications pending.

Example notification in action:
Bildschirmfoto 2023-05-30 um 15 57 20

NOTE: This should be behind a feature flag like “ENABLE_UI_NOTIFICATIONS”

**New or Changed Public Interfaces**
Extends internal database to include two additional schemas: public.notification and public.notification.roles

Bildschirmfoto 2023-05-30 um 15 49 42

Extends API to include endpoints for management of Notifications

Bildschirmfoto 2023-05-30 um 15 51 10

Adds an entry in the Settings menu

Bildschirmfoto 2023-05-30 um 15 56 22

Adds new permission for notification management

Bildschirmfoto 2023-05-30 um 15 57 09

**Migration Plan and Compatibility**
Database migration necessary to include new tables

**Rejected Alternatives**
Using another method of displaying notifications, e.g. as a banner on top of Superset or below the menu bar. Rejected in favor of using existing and proven methods already built in.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.