Merge pull request #7636 from ycombinator/notifier-on-page-load
Show notifier on page load, if notifier params are in query string
This commit is contained in:
commit
4f2cd1f7d4
|
@ -17,6 +17,7 @@ import 'ui/vislib';
|
|||
import 'ui/agg_response';
|
||||
import 'ui/agg_types';
|
||||
import 'ui/timepicker';
|
||||
import Notifier from 'ui/notify/notifier';
|
||||
import 'leaflet';
|
||||
|
||||
routes.enable();
|
||||
|
@ -44,3 +45,5 @@ chrome
|
|||
moment.tz.setDefault(tz);
|
||||
}
|
||||
});
|
||||
|
||||
modules.get('kibana').run(Notifier.pullMessageFromUrl);
|
||||
|
|
|
@ -188,6 +188,23 @@ Notifier.applyConfig = function (config) {
|
|||
// to be notified when the first fatal error occurs, push a function into this array.
|
||||
Notifier.fatalCallbacks = [];
|
||||
|
||||
Notifier.pullMessageFromUrl = ($location) => {
|
||||
const queryString = $location.search();
|
||||
if (!queryString.notif_msg) {
|
||||
return;
|
||||
}
|
||||
const message = queryString.notif_msg;
|
||||
const config = queryString.notif_loc ? { location: queryString.notif_loc } : {};
|
||||
const level = queryString.notif_lvl || 'info';
|
||||
|
||||
$location.search('notif_msg', null);
|
||||
$location.search('notif_loc', null);
|
||||
$location.search('notif_lvl', null);
|
||||
|
||||
const notifier = new Notifier(config);
|
||||
notifier[level](message);
|
||||
};
|
||||
|
||||
// simply a pointer to the global notif list
|
||||
Notifier.prototype._notifs = notifs;
|
||||
|
||||
|
|
Loading…
Reference in a new issue