vendure-ecommerce/vendure

Stateful Admin UI Alerts backend

Opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
I would like to make use of the Admin Ui Alerts / notifications feature in our plugins more, but it currently requires quite a bit of work to set up for each plugin.

I would like some of my plugins to push notifications to the admin in a generic way, where the admin can just click seen or something like this. Similar to how GitHub notifications work.

Use case example: Order failed to sync to Order Picking platform. Admin needs to look into address details.

Describe the solution you'd like
I would like all my customizations to be able to do something like adminAlertService.create(ctx, message, link, requiresPermisson) in the backend.

I imagine we have a simple entity named admin-alert.entity.ts and an Admin query adminAlerts() the gets the open/new alerts for the current administrator.

Describe alternatives you've considered
Make it as a plugin. This is possible, but each of our plugins would need some configurable strategy createAlert() to not be dependent on the alert-plugin. When it's in core, we don't need such a strategy.

❓ The question is really: Does this belong in Vendure Core? I would be willing to implement it, but I am still a bit in doubt if this should be in there.

This is a feature I've been thinking about for a while, and I share your considerations about where exactly it belongs.

In core:

  • pro: all plugins can use it without depending on an external plugin
  • con: it could be considered out of scope since it specifically relates to the admin ui. Although the counter-argument here is that it is a general-purpose notification system for any admin interface, which is pretty strong.

In plugin:

  • pro: keeps core lean
  • con: more difficult for plugins to use. One pattern we could use is to have plugins export any notifications they want to expose, and then at the config level we pass those to the alert plugin. Similar to how email handlers or admin ui extensions work currently.