mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PublicDashboards: Added grafana special datasources to supported list (#64930)
This commit is contained in:
committed by
GitHub
parent
529ffe61e7
commit
e01a3e0ea5
@@ -6,8 +6,12 @@ import (
|
||||
"net/http"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"github.com/grafana/grafana/pkg/expr"
|
||||
)
|
||||
|
||||
var grafanaDatasources = []string{expr.DatasourceType, "datasource"}
|
||||
|
||||
type listPluginResponse struct {
|
||||
Items []struct {
|
||||
Slug string `json:"slug"`
|
||||
@@ -41,6 +45,8 @@ func GetCompatibleDatasources(baseUrl string) ([]string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
supported = append(supported, grafanaDatasources...)
|
||||
|
||||
sort.Strings(supported)
|
||||
return supported, nil
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
var tsDatasourcesTemplate = `
|
||||
// Code generated by go generate; DO NOT EDIT.
|
||||
|
||||
export const supportedDatasources = new Set<string>([
|
||||
export const supportedDatasources = new Set<string>([
|
||||
{{- range . }}
|
||||
'{{ printf "%s" . }}',
|
||||
{{- end }}
|
||||
|
||||
@@ -3,6 +3,7 @@ package generate_datasources
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -31,6 +32,14 @@ func TestCanGetCompatibleDatasources(t *testing.T) {
|
||||
datasources, err := GetCompatibleDatasources(server.URL)
|
||||
|
||||
require.NoError(t, err)
|
||||
assert.Len(t, datasources, 1)
|
||||
assert.Equal(t, "postgres", datasources[0])
|
||||
|
||||
expectedDatasources := []string{"postgres"}
|
||||
expectedDatasources = append(expectedDatasources, grafanaDatasources...)
|
||||
sort.Strings(expectedDatasources)
|
||||
|
||||
assert.Len(t, datasources, len(expectedDatasources))
|
||||
|
||||
for i := range expectedDatasources {
|
||||
assert.Equal(t, expectedDatasources[i], datasources[i])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ func (_m *FakePublicDashboardService) FindDashboard(ctx context.Context, orgId i
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// FindEnabledDashboardAndDashboardByAccessToken provides a mock function with given fields: ctx, accessToken
|
||||
// FindEnabledPublicDashboardAndDashboardByAccessToken provides a mock function with given fields: ctx, accessToken
|
||||
func (_m *FakePublicDashboardService) FindEnabledPublicDashboardAndDashboardByAccessToken(ctx context.Context, accessToken string) (*models.PublicDashboard, *dashboards.Dashboard, error) {
|
||||
ret := _m.Called(ctx, accessToken)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user