ncrn
April 14, 2020, 3:48pm
1
Hello,
I want to warn user when they build a weird request, theapp-notifications-list zone would be perfect but I can’t figure out how to build propre notification, all I can do is :
But the notification does not disapear, even if I click on the right cross or left tick
Does anyone have tips ?
Grafana is in the middle of converting from React to Angular and we are also building new plugin libraries so there are two ways to do this.
The old AngularJS way (here is a plugin using it ):
See my previous answer:
Before you do that - did you know that there is already support for something similar in Grafana?
The easy way is:
Import appEvents: import { appEvents} from 'app/core/core';
Then emit an event with one of three values: alert-success, alert-warning or alert-error as the the first param and an array with two strings: title and description:
appEvents.emit('alert-success', ['Test notification sent', '']);
The other way gives you an extra parameter: timeout. Which is how long the toaster …
The other similar way is to use the new @grafana/data library - which is still in alpha.
Example here:
https://github.com/grafana/grafana/blob/master/public/app/plugins/datasource/graphite/query_ctrl.ts#L11
and here:
https://github.com/grafana/grafana/blob/master/public/app/plugins/datasource/graphite/query_ctrl.ts#L109
ncrn
May 19, 2020, 2:48pm
3
Hello Danielle
I apologize for my late answer, I don’t know why, but I do not recieve mail notification from the forum.
For the moment I’m on another project, but as soon as I go back on Grafana I’ll try your snippet
Thanks !