DataSourceApi: convert interface to abstract class (#16979)
* DataSourceApi as class * add diff signature * Prometheus: moved directUrl to jsonData
This commit is contained in:
committed by
Torkel Ödegaard
parent
5573d28582
commit
1d7bb2a763
@@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
@@ -86,12 +87,13 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *m.ReqContext) (map[string]interf
|
||||
defaultDatasource = ds.Name
|
||||
}
|
||||
|
||||
if ds.JsonData != nil {
|
||||
dsMap["jsonData"] = ds.JsonData
|
||||
} else {
|
||||
dsMap["jsonData"] = make(map[string]string)
|
||||
jsonData := ds.JsonData
|
||||
if jsonData == nil {
|
||||
jsonData = simplejson.New()
|
||||
}
|
||||
|
||||
dsMap["jsonData"] = jsonData
|
||||
|
||||
if ds.Access == m.DS_ACCESS_DIRECT {
|
||||
if ds.BasicAuth {
|
||||
dsMap["basicAuth"] = util.GetBasicAuthHeader(ds.BasicAuthUser, ds.DecryptedBasicAuthPassword())
|
||||
@@ -123,7 +125,7 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *m.ReqContext) (map[string]interf
|
||||
|
||||
if ds.Type == m.DS_PROMETHEUS {
|
||||
// add unproxied server URL for link to Prometheus web UI
|
||||
dsMap["directUrl"] = ds.Url
|
||||
jsonData.Set("directUrl", ds.Url)
|
||||
}
|
||||
|
||||
datasources[ds.Name] = dsMap
|
||||
|
||||
Reference in New Issue
Block a user