mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardImport: Fix variable interpolation when property contains multiple variable expressions (#26574)
This commit is contained in:
parent
ca9418ea80
commit
5e73a92327
@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/dashboards"
|
"github.com/grafana/grafana/pkg/services/dashboards"
|
||||||
)
|
)
|
||||||
|
|
||||||
var varRegex = regexp.MustCompile(`(\$\{.+\})`)
|
var varRegex = regexp.MustCompile(`(\$\{.+?\})`)
|
||||||
|
|
||||||
type ImportDashboardCommand struct {
|
type ImportDashboardCommand struct {
|
||||||
Dashboard *simplejson.Json
|
Dashboard *simplejson.Json
|
||||||
|
@ -58,7 +58,7 @@ func TestDashboardImport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"test": {
|
"test": {
|
||||||
"prop": "${DS_NAME}"
|
"prop": "${DS_NAME}_${DS_NAME}"
|
||||||
}
|
}
|
||||||
}`))
|
}`))
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ func TestDashboardImport(t *testing.T) {
|
|||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
|
|
||||||
Convey("should render template", func() {
|
Convey("should render template", func() {
|
||||||
So(res.GetPath("test", "prop").MustString(), ShouldEqual, "my-server")
|
So(res.GetPath("test", "prop").MustString(), ShouldEqual, "my-server_my-server")
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("should not include inputs in output", func() {
|
Convey("should not include inputs in output", func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user