diff --git a/CHANGELOG.md b/CHANGELOG.md index c796577ec66..d2461e1efd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ * **Templating**: Update panel repeats for variables that change on time refresh, closes [#5021](https://github.com/grafana/grafana/issues/5021) * **Elasticsearch**: Support to set Precision Threshold for Unique Count metric, closes [#4689](https://github.com/grafana/grafana/issues/4689) -# 3.1.1 (2016-08-01) +#b 3.1.1 (unreleased / v3.1.x branch) * **IFrame embedding**: Fixed issue of using full iframe height, fixes [#5605](https://github.com/grafana/grafana/issues/5606) * **Panel PNG rendering**: Fixed issue detecting render completion, fixes [#5605](https://github.com/grafana/grafana/issues/5606) * **Elasticsearch**: Fixed issue with templating query and json parse error, fixes [#5615](https://github.com/grafana/grafana/issues/5615) @@ -15,7 +15,6 @@ * **Graphite**: Fixed issue with mixed data sources and Graphite, fixes [#5617](https://github.com/grafana/grafana/issues/5617) * **Templating**: Fixed issue with template variable query was issued multiple times during dashboard load, fixes [#5637](https://github.com/grafana/grafana/issues/5637) * **Zoom**: Fixed issues with zoom in and out on embedded (iframed) panel, fixes [#4489](https://github.com/grafana/grafana/issues/4489), [#5666](https://github.com/grafana/grafana/issues/5666) -* **Templating**: Row/Panel repeat issue when saving dashboard caused dupes to appear, fixes [#5591](https://github.com/grafana/grafana/issues/5591) # 3.1.0 stable (2016-07-12) diff --git a/public/app/features/alerting/alert_tab_ctrl.ts b/public/app/features/alerting/alert_tab_ctrl.ts index dd035b8d4df..403a4a0fb8a 100644 --- a/public/app/features/alerting/alert_tab_ctrl.ts +++ b/public/app/features/alerting/alert_tab_ctrl.ts @@ -63,10 +63,13 @@ export class AlertTabCtrl { // set panel alert edit mode this.$scope.$on("$destroy", () => { - this.panelCtrl.editingAlert = false; + this.panelCtrl.editingThresholds = false; this.panelCtrl.render(); }); + // subscribe to graph threshold handle changes + this.panelCtrl.events.on('threshold-changed', this.graphThresholdChanged.bind(this)); + // build notification model this.notifications = []; this.alertNotifications = []; @@ -139,12 +142,19 @@ export class AlertTabCtrl { return memo; }, []); - this.panelCtrl.editingAlert = true; + if (this.alert.enabled) { + this.panelCtrl.editingThresholds = true; + } + this.syncThresholds(); this.panelCtrl.render(); } syncThresholds() { + if (this.panel.type !== 'graph') { + return; + } + var threshold: any = {}; if (this.panel.thresholds && this.panel.thresholds.length > 0) { threshold = this.panel.thresholds[0]; @@ -160,16 +170,13 @@ export class AlertTabCtrl { continue; } - if (value !== threshold.from) { - threshold.from = value; + if (value !== threshold.value) { + threshold.value = value; updated = true; } - if (condition.evaluator.type === '<' && threshold.to !== -Infinity) { - threshold.to = -Infinity; - updated = true; - } else if (condition.evaluator.type === '>' && threshold.to !== Infinity) { - threshold.to = Infinity; + if (condition.evaluator.type !== threshold.op) { + threshold.op = condition.evaluator.type; updated = true; } } @@ -178,6 +185,15 @@ export class AlertTabCtrl { return updated; } + graphThresholdChanged(evt) { + for (var condition of this.alert.conditions) { + if (condition.type === 'query') { + condition.evaluator.params[0] = evt.threshold.value; + break; + } + } + } + buildDefaultCondition() { return { type: 'query', diff --git a/public/app/plugins/panel/graph/graph.js b/public/app/plugins/panel/graph/graph.js index 40c57df0ec0..212d06f949a 100755 --- a/public/app/plugins/panel/graph/graph.js +++ b/public/app/plugins/panel/graph/graph.js @@ -182,9 +182,10 @@ function (angular, $, moment, _, kbn, GraphTooltip, thresholds) { } // give space to alert editing - if (ctrl.editingAlert) { + if (ctrl.editingThresholds) { if (!thresholdControls) { - elem.css('margin-right', '110px'); + var thresholdMargin = panel.thresholds.length > 1 ? '220px' : '110px'; + elem.css('margin-right', thresholdMargin); thresholdControls = new ThresholdControls(ctrl); } } else if (thresholdControls) { diff --git a/public/app/plugins/panel/graph/thresholds.ts b/public/app/plugins/panel/graph/thresholds.ts index 77ec585bb50..35dd34f35de 100644 --- a/public/app/plugins/panel/graph/thresholds.ts +++ b/public/app/plugins/panel/graph/thresholds.ts @@ -14,7 +14,7 @@ export class ThresholdControls { this.thresholds = this.panelCtrl.panel.thresholds; } - getHandleInnerHtml(type, op, value) { + getHandleInnerHtml(handleName, op, value) { if (op === '>') { op = '>'; } if (op === '<') { op = '<'; } @@ -22,21 +22,16 @@ export class ThresholdControls {