mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 11:20:27 -06:00
feat(alerting): serialize whole target obj from dashboard
This commit is contained in:
parent
25f6ec8b53
commit
ddd826616b
@ -57,7 +57,10 @@ func (cmd *SaveDashboardCommand) GetAlertModels() *[]AlertRule {
|
||||
target := simplejson.NewFromAny(targetsObj)
|
||||
|
||||
if target.Get("refId").MustString() == alert.QueryRefId {
|
||||
alert.Query = target.Get("target").MustString()
|
||||
targetJson, err := target.MarshalJSON()
|
||||
if err == nil {
|
||||
alert.Query = string(targetJson)
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ func TestAlertModel(t *testing.T) {
|
||||
fmt.Println(v.Query)
|
||||
}
|
||||
|
||||
So(alerts[0].Query, ShouldEqual, "statsd.fakesite.counters.session_start.desktop.count")
|
||||
So(alerts[0].Query, ShouldEqual, "{\"hide\":false,\"refId\":\"A\",\"target\":\"statsd.fakesite.counters.session_start.desktop.count\"}")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user