How to create notification alerts with a react app

I am developing a Grafana App plugin, using react.

This app interacts with an api, to create and update entities in my database.
How can I create a notification, using the grafana system?
I’ve had a look at this

but the examples show only for angular apps, and are outdated.

PanelProps contains the eventBus, but I can’t find something similar in the AppProps

There are no type definitions available for app events, but you can still access them if you ignore the TypeScript errors by adding a comment @ts-ignore on the line before the import:

// @ts-ignore
import appEvents from 'grafana/app/core/app_events';

To show a notification, emit the AppEvents.alertSuccess:

import { AppEvents } from '@grafana/data';

appEvents.emit(AppEvents.alertSuccess, ['Hello']);
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.