From 89ca15f3a1c2d2f8fe2cc2711eb1bc536fa14d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 11 Aug 2016 18:25:41 +0200 Subject: [PATCH] feat(thresholds): lots of progress on thresholds --- .../app/features/alerting/alert_tab_ctrl.ts | 51 ++++++------ .../features/alerting/partials/alert_tab.html | 6 +- public/app/plugins/panel/graph/graph.js | 18 +---- public/app/plugins/panel/graph/module.ts | 2 +- public/app/plugins/panel/graph/thresholds.ts | 81 ++++++++++++------- public/sass/_variables.dark.scss | 10 ++- public/sass/_variables.light.scss | 5 +- public/sass/components/_panel_graph.scss | 76 +++++++++-------- 8 files changed, 140 insertions(+), 109 deletions(-) diff --git a/public/app/features/alerting/alert_tab_ctrl.ts b/public/app/features/alerting/alert_tab_ctrl.ts index a91fa5e0724..25ea009f80f 100644 --- a/public/app/features/alerting/alert_tab_ctrl.ts +++ b/public/app/features/alerting/alert_tab_ctrl.ts @@ -76,26 +76,6 @@ export class AlertTabCtrl { })); } - evaluatorTypeChanged(evaluator) { - // ensure params array is correct length - switch (evaluator.type) { - case "lt": - case "gt": { - evaluator.params = [evaluator.params[0]]; - break; - } - case "within_range": - case "outside_range": { - evaluator.params = [evaluator.params[0], evaluator.params[1]]; - break; - } - case "no_value": { - evaluator.params = []; - } - } - - this.thresholdUpdated(); - } notificationAdded() { var model = _.findWhere(this.notifications, {name: this.addNotificationSegment.value}); @@ -200,10 +180,35 @@ export class AlertTabCtrl { this.initModel(); } - thresholdUpdated() { - if (ThresholdMapper.alertToGraphThresholds(this.panel)) { - this.panelCtrl.render(); + evaluatorParamsChanged() { + ThresholdMapper.alertToGraphThresholds(this.panel); + this.panelCtrl.render(); + } + + severityChanged() { + ThresholdMapper.alertToGraphThresholds(this.panel); + this.panelCtrl.render(); + } + + evaluatorTypeChanged(evaluator) { + // ensure params array is correct length + switch (evaluator.type) { + case "lt": + case "gt": { + evaluator.params = [evaluator.params[0]]; + break; + } + case "within_range": + case "outside_range": { + evaluator.params = [evaluator.params[0], evaluator.params[1]]; + break; + } + case "no_value": { + evaluator.params = []; + } } + + this.evaluatorParamsChanged(); } test() { diff --git a/public/app/features/alerting/partials/alert_tab.html b/public/app/features/alerting/partials/alert_tab.html index 892cc32e6d3..e9f7e2aa556 100644 --- a/public/app/features/alerting/partials/alert_tab.html +++ b/public/app/features/alerting/partials/alert_tab.html @@ -34,7 +34,7 @@
Severity
-
@@ -59,9 +59,9 @@
- + - +