mirror of
https://github.com/grafana/grafana.git
synced 2025-01-17 04:02:50 -06:00
InfluxDB: Update alias regex pattern (#87713)
* use frontend mode alias regex * remove comment
This commit is contained in:
parent
bbb4323f7e
commit
194039c429
@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
legendFormat = regexp.MustCompile(`\[\[([\@\/\w-]+)(\.[\@\/\w-]+)*\]\]*|\$([\@\w]+?)*`)
|
||||
legendFormat = regexp.MustCompile(`\$(\w+)|\[\[([\s\S]+?)\]\]`)
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -43,6 +43,7 @@ func TestFormatFrameName(t *testing.T) {
|
||||
{name: "[[col]] column alias", rowName: "rowName", column: "colName", tags: map[string]string{"key": "value"}, query: models.Query{Alias: "[[col]]", ResultFormat: "time_series"}, expected: "colName"},
|
||||
{name: "$col column alias", rowName: "rowName", column: "colName", tags: map[string]string{"key": "value"}, query: models.Query{Alias: "$col", ResultFormat: "time_series"}, expected: "colName"},
|
||||
{name: "[[tag_key]] tag alias", rowName: "rowName", column: "colName", tags: map[string]string{"key": "value"}, query: models.Query{Alias: "[[tag_key]]", ResultFormat: "time_series"}, expected: "value"},
|
||||
{name: "[[tag_key]] tag alias with space in tag", rowName: "rowName", column: "colName", tags: map[string]string{"ke y": "value"}, query: models.Query{Alias: "[[tag_ke y]]", ResultFormat: "time_series"}, expected: "value"},
|
||||
{name: "$tag_key tag alias", rowName: "rowName", column: "colName", tags: map[string]string{"key": "value"}, query: models.Query{Alias: "$tag_key", ResultFormat: "time_series"}, expected: "value"},
|
||||
{name: "[[m]] with additional text", rowName: "rowName", column: "colName", tags: map[string]string{"key": "value"}, query: models.Query{Alias: "[[m]] - something", ResultFormat: "time_series"}, expected: "rowName - something"},
|
||||
{name: "$m with additional text", rowName: "rowName", column: "colName", tags: map[string]string{"key": "value"}, query: models.Query{Alias: "$m - something", ResultFormat: "time_series"}, expected: "rowName - something"},
|
||||
|
Loading…
Reference in New Issue
Block a user