2017-12-20 05:33:33 -06:00
|
|
|
import { coreModule } from 'app/core/core';
|
2017-06-02 07:00:42 -05:00
|
|
|
|
|
|
|
export class AlertNotificationsListCtrl {
|
2016-06-16 07:29:20 -05:00
|
|
|
notifications: any;
|
2017-06-02 07:00:42 -05:00
|
|
|
navModel: any;
|
2016-06-15 03:48:04 -05:00
|
|
|
|
|
|
|
/** @ngInject */
|
2017-09-21 09:40:18 -05:00
|
|
|
constructor(private backendSrv, navModelSrv) {
|
2016-06-15 03:48:04 -05:00
|
|
|
this.loadNotifications();
|
2017-12-20 05:33:33 -06:00
|
|
|
this.navModel = navModelSrv.getNav('alerting', 'channels', 0);
|
2016-06-15 03:48:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
loadNotifications() {
|
2016-07-14 06:32:16 -05:00
|
|
|
this.backendSrv.get(`/api/alert-notifications`).then(result => {
|
2016-06-16 07:29:20 -05:00
|
|
|
this.notifications = result;
|
|
|
|
});
|
2016-06-15 03:48:04 -05:00
|
|
|
}
|
2016-06-16 08:21:44 -05:00
|
|
|
|
2016-07-25 09:26:28 -05:00
|
|
|
deleteNotification(id) {
|
|
|
|
this.backendSrv.delete(`/api/alert-notifications/${id}`).then(() => {
|
|
|
|
this.notifications = this.notifications.filter(notification => {
|
2016-07-27 03:15:21 -05:00
|
|
|
return notification.id !== id;
|
2016-06-16 08:21:44 -05:00
|
|
|
});
|
2016-07-25 09:26:28 -05:00
|
|
|
});
|
2016-06-16 08:21:44 -05:00
|
|
|
}
|
2016-06-15 03:48:04 -05:00
|
|
|
}
|
|
|
|
|
2017-12-20 05:33:33 -06:00
|
|
|
coreModule.controller('AlertNotificationsListCtrl', AlertNotificationsListCtrl);
|