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

33 lines
804 B
TypeScript
Raw Normal View History

///<reference path="../../headers/common.d.ts" />
import {coreModule} from 'app/core/core';
export class AlertNotificationsListCtrl {
notifications: any;
navModel: any;
/** @ngInject */
constructor(private backendSrv, navModelSrv) {
this.loadNotifications();
2017-08-15 13:24:16 -05:00
this.navModel = navModelSrv.getNav('alerting', 'channels');
}
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;
});
});
}
}
coreModule.controller('AlertNotificationsListCtrl', AlertNotificationsListCtrl);