grafana/public/app/features/alerting/NotificationsListCtrl.ts

29 lines
755 B
TypeScript
Raw Normal View History

2017-12-20 05:33:33 -06:00
import { coreModule } from 'app/core/core';
export class AlertNotificationsListCtrl {
notifications: any;
navModel: any;
/** @ngInject */
constructor(private backendSrv, navModelSrv) {
this.loadNotifications();
2017-12-20 05:33:33 -06:00
this.navModel = navModelSrv.getNav('alerting', 'channels', 0);
}
loadNotifications() {
2016-07-14 06:32:16 -05:00
this.backendSrv.get(`/api/alert-notifications`).then(result => {
this.notifications = result;
});
}
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;
});
});
}
}
2017-12-20 05:33:33 -06:00
coreModule.controller('AlertNotificationsListCtrl', AlertNotificationsListCtrl);