alerts_ctrl.ts 642 B

1234567891011121314151617181920212223242526272829
  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. import alertDef from './alert_def';
  7. export class AlertPageCtrl {
  8. alerts: any;
  9. /** @ngInject */
  10. constructor(private backendSrv) {
  11. this.loadAlerts();
  12. }
  13. loadAlerts() {
  14. this.backendSrv.get('/api/alerts').then(result => {
  15. this.alerts = _.map(result, alert => {
  16. alert.iconCss = alertDef.getCssForState(alert.state);
  17. return alert;
  18. });
  19. });
  20. }
  21. }
  22. coreModule.controller('AlertPageCtrl', AlertPageCtrl);