mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 08:05:43 -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"
|
||||
)
|
||||
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user