NotificationsListCtrl.ts 755 B

12345678910111213141516171819202122232425262728
  1. import { coreModule } from 'app/core/core';
  2. export class AlertNotificationsListCtrl {
  3. notifications: any;
  4. navModel: any;
  5. /** @ngInject */
  6. constructor(private backendSrv, navModelSrv) {
  7. this.loadNotifications();
  8. this.navModel = navModelSrv.getNav('alerting', 'channels', 0);
  9. }
  10. loadNotifications() {
  11. this.backendSrv.get(`/api/alert-notifications`).then(result => {
  12. this.notifications = result;
  13. });
  14. }
  15. deleteNotification(id) {
  16. this.backendSrv.delete(`/api/alert-notifications/${id}`).then(() => {
  17. this.notifications = this.notifications.filter(notification => {
  18. return notification.id !== id;
  19. });
  20. });
  21. }
  22. }
  23. coreModule.controller('AlertNotificationsListCtrl', AlertNotificationsListCtrl);