Add alwaysDisplayed option to datasource plugins, this will allow it to show up as an option to select when adding queries to a panel without actually adding it as a datasource.

pull/8095/head
Chris Burkhart 9 years ago
parent 07466b6725
commit d12dc2bfa7
  1. 20
      pkg/api/frontendsettings.go
  2. 1
      pkg/plugins/datasource_plugin.go
  3. 3
      public/app/plugins/datasource/grafana/plugin.json
  4. 3
      public/app/plugins/datasource/mixed/plugin.json

@ -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 == "" {

@ -9,6 +9,7 @@ type DataSourcePlugin struct {
Alerting bool `json:"alerting"`
BuiltIn bool `json:"builtIn"`
Mixed bool `json:"mixed"`
AlwaysDisplay bool `json:"alwaysDisplay"`
App string `json:"app"`
}

@ -1,9 +1,10 @@
{
"type": "datasource",
"name": "Grafana",
"name": "-- Grafana --",
"id": "grafana",
"builtIn": true,
"annotations": true,
"alwaysDisplay": true,
"metrics": true
}

@ -1,9 +1,10 @@
{
"type": "datasource",
"name": "Mixed datasource",
"name": "-- Mixed --",
"id": "mixed",
"builtIn": true,
"mixed": true,
"alwaysDisplay": true,
"metrics": true
}

Loading…
Cancel
Save