alert_log_ctrl.ts 781 B

123456789101112131415161718192021222324252627282930313233
  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 AlertLogCtrl {
  7. alertLogs: any;
  8. alert: any;
  9. alertId: any;
  10. /** @ngInject */
  11. constructor(private $route, private backendSrv) {
  12. if ($route.current.params.alertId) {
  13. this.alertId = $route.current.params.alertId;
  14. this.loadAlertLogs();
  15. }
  16. }
  17. loadAlertLogs() {
  18. this.backendSrv.get('/api/alerts/events/' + this.alertId).then(result => {
  19. this.alertLogs = result;
  20. });
  21. this.backendSrv.get('/api/alerts/' + this.alertId).then(result => {
  22. this.alert = result;
  23. });
  24. }
  25. }
  26. coreModule.controller('AlertLogCtrl', AlertLogCtrl);