Commit 5e73a923 by Sofia Papagiannaki Committed by GitHub

DashboardImport: Fix variable interpolation when property contains multiple…

DashboardImport: Fix variable interpolation when property contains multiple variable expressions (#26574)
parent ca9418ea
......@@ -11,7 +11,7 @@ import (
"github.com/grafana/grafana/pkg/services/dashboards"
)
var varRegex = regexp.MustCompile(`(\$\{.+\})`)
var varRegex = regexp.MustCompile(`(\$\{.+?\})`)
type ImportDashboardCommand struct {
Dashboard *simplejson.Json
......
......@@ -58,7 +58,7 @@ func TestDashboardImport(t *testing.T) {
}
],
"test": {
"prop": "${DS_NAME}"
"prop": "${DS_NAME}_${DS_NAME}"
}
}`))
......@@ -73,7 +73,7 @@ func TestDashboardImport(t *testing.T) {
So(err, ShouldBeNil)
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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment