alert_tab_ctrl.ts 946 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ///<reference path="../../../headers/common.d.ts" />
  2. import _ from 'lodash';
  3. import $ from 'jquery';
  4. import angular from 'angular';
  5. export class AlertTabCtrl {
  6. panel: any;
  7. panelCtrl: any;
  8. /** @ngInject */
  9. constructor($scope) {
  10. $scope.alertTab = this;
  11. this.panelCtrl = $scope.ctrl;
  12. this.panel = this.panelCtrl.panel;
  13. }
  14. convertThresholdsToAlerts() {
  15. if (this.panel.grid && this.panel.grid.threshold1) {
  16. this.panel.alerting.warnLevel = '< ' + this.panel.grid.threshold1;
  17. }
  18. if (this.panel.grid && this.panel.grid.threshold2) {
  19. this.panel.alerting.critLevel = '< ' + this.panel.grid.threshold2;
  20. }
  21. }
  22. }
  23. /** @ngInject */
  24. export function graphAlertEditor() {
  25. 'use strict';
  26. return {
  27. restrict: 'E',
  28. scope: true,
  29. templateUrl: 'public/app/plugins/panel/graph/partials/tab_alerting.html',
  30. controller: AlertTabCtrl,
  31. //bindToController: true,
  32. //controllerAs: 'ctrl',
  33. };
  34. }