notifications_list_ctrl.ts 838 B

12345678910111213141516171819202122232425262728293031323334
  1. ///<reference path="../../headers/common.d.ts" />
  2. import angular from 'angular';
  3. import _ from 'lodash';
  4. import coreModule from '../../core/core_module';
  5. import config from 'app/core/config';
  6. export class AlertNotificationsListCtrl {
  7. notifications: any;
  8. /** @ngInject */
  9. constructor(private backendSrv, private $scope) {
  10. this.loadNotifications();
  11. }
  12. loadNotifications() {
  13. this.backendSrv.get(`/api/alert-notifications`).then(result => {
  14. this.notifications = result;
  15. });
  16. }
  17. deleteNotification(id) {
  18. this.backendSrv.delete(`/api/alert-notifications/${id}`).then(() => {
  19. this.notifications = this.notifications.filter(notification => {
  20. return notification.id !== notificationId;
  21. });
  22. });
  23. }
  24. }
  25. coreModule.controller('AlertNotificationsListCtrl', AlertNotificationsListCtrl);