diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index 5c3dd19bd87..105e0849e5d 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -102,18 +102,14 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro datasources[ds.Name] = dsMap } - // add grafana backend data source - grafanaDatasourceMeta, _ := plugins.DataSources["grafana"] - datasources["-- Grafana --"] = map[string]interface{}{ - "type": "grafana", - "name": "-- Grafana --", - "meta": grafanaDatasourceMeta, - } - - // add mixed backend data source - datasources["-- Mixed --"] = map[string]interface{}{ - "type": "mixed", - "meta": plugins.DataSources["mixed"], + for _, ds := range plugins.DataSources { + if ds.AlwaysDisplay { + datasources[ds.Name] = map[string]interface{}{ + "type": ds.Type, + "name": ds.Name, + "meta": plugins.DataSources[ds.Id], + } + } } if defaultDatasource == "" { diff --git a/pkg/plugins/datasource_plugin.go b/pkg/plugins/datasource_plugin.go index aa092c2bc20..8427a1e8633 100644 --- a/pkg/plugins/datasource_plugin.go +++ b/pkg/plugins/datasource_plugin.go @@ -4,12 +4,13 @@ import "encoding/json" type DataSourcePlugin struct { FrontendPluginBase - Annotations bool `json:"annotations"` - Metrics bool `json:"metrics"` - Alerting bool `json:"alerting"` - BuiltIn bool `json:"builtIn"` - Mixed bool `json:"mixed"` - App string `json:"app"` + Annotations bool `json:"annotations"` + Metrics bool `json:"metrics"` + Alerting bool `json:"alerting"` + BuiltIn bool `json:"builtIn"` + Mixed bool `json:"mixed"` + AlwaysDisplay bool `json:"alwaysDisplay"` + App string `json:"app"` } func (p *DataSourcePlugin) Load(decoder *json.Decoder, pluginDir string) error { diff --git a/public/app/plugins/datasource/grafana/plugin.json b/public/app/plugins/datasource/grafana/plugin.json index 906ef0e9bf1..69522e6e63a 100644 --- a/public/app/plugins/datasource/grafana/plugin.json +++ b/public/app/plugins/datasource/grafana/plugin.json @@ -1,9 +1,10 @@ { "type": "datasource", - "name": "Grafana", + "name": "-- Grafana --", "id": "grafana", "builtIn": true, "annotations": true, + "alwaysDisplay": true, "metrics": true } diff --git a/public/app/plugins/datasource/mixed/plugin.json b/public/app/plugins/datasource/mixed/plugin.json index b8c08446cb3..632d8a8e079 100644 --- a/public/app/plugins/datasource/mixed/plugin.json +++ b/public/app/plugins/datasource/mixed/plugin.json @@ -1,9 +1,10 @@ { "type": "datasource", - "name": "Mixed datasource", + "name": "-- Mixed --", "id": "mixed", "builtIn": true, "mixed": true, + "alwaysDisplay": true, "metrics": true }