From 50e53423790bd7a84f32651878026c51ca30822c Mon Sep 17 00:00:00 2001 From: Komalis <445842+Komalis@users.noreply.github.com> Date: Mon, 15 Mar 2021 17:29:11 +0100 Subject: [PATCH] InfluxDB: Support region annotations (#31526) --- public/app/plugins/datasource/influxdb/influx_series.ts | 6 ++++++ .../datasource/influxdb/partials/annotations.editor.html | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/influxdb/influx_series.ts b/public/app/plugins/datasource/influxdb/influx_series.ts index d46f185b38c..0a59c162a00 100644 --- a/public/app/plugins/datasource/influxdb/influx_series.ts +++ b/public/app/plugins/datasource/influxdb/influx_series.ts @@ -93,6 +93,7 @@ export default class InfluxSeries { _.each(this.series, (series) => { let titleCol: any = null; let timeCol: any = null; + let timeEndCol: any = null; const tagsCol: any = []; let textCol: any = null; @@ -116,6 +117,10 @@ export default class InfluxSeries { textCol = index; return; } + if (column === this.annotation.timeEndColumn) { + timeEndCol = index; + return; + } // legacy case if (!titleCol && textCol !== index) { titleCol = index; @@ -127,6 +132,7 @@ export default class InfluxSeries { annotation: this.annotation, time: +new Date(value[timeCol]), title: value[titleCol], + timeEnd: value[timeEndCol], // Remove empty values, then split in different tags for comma separated values tags: _.flatten( tagsCol diff --git a/public/app/plugins/datasource/influxdb/partials/annotations.editor.html b/public/app/plugins/datasource/influxdb/partials/annotations.editor.html index 48991426c1e..f6b6b5894c0 100644 --- a/public/app/plugins/datasource/influxdb/partials/annotations.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/annotations.editor.html @@ -5,7 +5,7 @@ -
Field mappings If your influxdb query returns more than one field you need to specify the column names below. An annotation event is composed of a title, tags, and an additional text field.
+
Field mappings If your influxdb query returns more than one field you need to specify the column names below. An annotation event is composed of a title, tags, and an additional text field. Optionally you can map the timeEnd column for region annotation usage.
@@ -16,6 +16,10 @@ Tags
+
+ TimeEnd + +
Title (deprecated)