diff --git a/public/app/features/alerting/alert_tab_ctrl.ts b/public/app/features/alerting/alert_tab_ctrl.ts index 7629a9ee8ce..dd035b8d4df 100644 --- a/public/app/features/alerting/alert_tab_ctrl.ts +++ b/public/app/features/alerting/alert_tab_ctrl.ts @@ -33,9 +33,6 @@ export class AlertTabCtrl { handlers = [{text: 'Grafana', value: 1}, {text: 'External', value: 0}]; conditionTypes = [ {text: 'Query', value: 'query'}, - {text: 'Other alert', value: 'other_alert'}, - {text: 'Time of day', value: 'time_of_day'}, - {text: 'Day of week', value: 'day_of_week'}, ]; alert: any; conditionModels: any; diff --git a/public/app/plugins/panel/graph/graph.js b/public/app/plugins/panel/graph/graph.js index 13172b06019..9dc359d676b 100755 --- a/public/app/plugins/panel/graph/graph.js +++ b/public/app/plugins/panel/graph/graph.js @@ -331,23 +331,51 @@ function (angular, $, moment, _, kbn, GraphTooltip, thresholds) { return; } + var gtLimit = Infinity; + var ltLimit = -Infinity; + for (var i = 0; i < panel.thresholds.length; i++) { var threshold = panel.thresholds[i]; - if (!_.isNumber(threshold.from)) { + if (!_.isNumber(threshold.value)) { continue; } - // fill - options.grid.markings.push({ - yaxis: {from: threshold.from, to: threshold.to}, - color: 'rgba(234, 112, 112, 0.10)', - }); + var limit; + switch(threshold.op) { + case '>': { + limit = gtLimit; + gtLimit = threshold.value; + break; + } + case '<': { + limit = ltLimit; + ltLimit = threshold.value; + break; + } + } - // line - options.grid.markings.push({ - yaxis: {from: threshold.from, to: threshold.from}, - color: '#ed2e18' - }); + var fillColor, lineColor; + switch(threshold.severity) { + case 'critical': { + fillColor = 'rgba(234, 112, 112, 0.12)'; + lineColor = 'rgba(237, 46, 24, 0.60)'; + break; + } + case 'warning': { + fillColor = 'rgba(235, 138, 14, 0.12)'; + lineColor = 'rgba(247, 149, 32, 0.60)'; + break; + } + case 'ok': { + fillColor = 'rgba(11, 237, 50, 0.090)'; + lineColor = 'rgba(6,163,69, 0.60)'; + break; + } + } + + // fill + options.grid.markings.push({yaxis: {from: threshold.value, to: limit}, color: fillColor}); + options.grid.markings.push({yaxis: {from: threshold.value, to: threshold.value}, color: lineColor}); } } diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index bed6ef9302c..94f656087c4 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -26,6 +26,7 @@ class GraphCtrl extends MetricsPanelCtrl { datapointsOutside: boolean; datapointsWarning: boolean; colors: any = []; + subTabIndex: number; panelDefaults = { // datasource name, null = default datasource @@ -142,7 +143,9 @@ class GraphCtrl extends MetricsPanelCtrl { 'log (base 32)': 32, 'log (base 1024)': 1024 }; + this.unitFormats = kbn.getUnitFormats(); + this.subTabIndex = 0; } onInitPanelActions(actions) { @@ -323,6 +326,15 @@ class GraphCtrl extends MetricsPanelCtrl { exportCsvColumns() { fileExport.exportSeriesListToCsvColumns(this.seriesList); } + + addThreshold() { + this.panel.thresholds.push({value: undefined, color: "rgba(255,0,0,0.2)"}); + } + + removeThreshold(index) { + this.panel.thresholds.splice(index, 1); + this.render(); + } } export {GraphCtrl, GraphCtrl as PanelCtrl} diff --git a/public/app/plugins/panel/graph/tab_display.html b/public/app/plugins/panel/graph/tab_display.html index c9f51dc5dde..a430cb78de2 100644 --- a/public/app/plugins/panel/graph/tab_display.html +++ b/public/app/plugins/panel/graph/tab_display.html @@ -1,103 +1,103 @@ -
-
-
Draw Modes
- - - - - - -
-
-
Mode Options
-
- -
- +
+ + +
+
+
Draw Modes
+ + + +
+
+
Mode Options
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
-
- -
- +
+
Hover info
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
- - -
- -
- -
-
-
-
-
Hover info
-
- -
- -
-
-
- -
- -
-
-
- -
- + +
+
Stacking & Null value
+ + + + +
+ +
+ +
-
-
Stacking & Null value
- - - - -
- -
- -
-
-
- -
- -
-
-
Series specific overrides Regex match example: /server[0-3]/i
-
-
-
    -
  • - -
  • - -
  • - alias or regex -
  • - -
  • - -
  • - -
  • +
    +
    +
    Series specific overrides Regex match example: /server[0-3]/i
    +
    +
    + +
    +
    + +
    +
    +
  • + +
- - -
+
+ + +
+ +
+
+
+ +
+ +
-
+ +
+
+
Thresholds
+
+
+ +
+ +
+
+ +
+ + +
+ +
+
+ +
+ +
+
+
+ + +
+