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:
parent
529ffe61e7
commit
e01a3e0ea5
@ -6,8 +6,12 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/grafana/grafana/pkg/expr"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var grafanaDatasources = []string{expr.DatasourceType, "datasource"}
|
||||||
|
|
||||||
type listPluginResponse struct {
|
type listPluginResponse struct {
|
||||||
Items []struct {
|
Items []struct {
|
||||||
Slug string `json:"slug"`
|
Slug string `json:"slug"`
|
||||||
@ -41,6 +45,8 @@ func GetCompatibleDatasources(baseUrl string) ([]string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
supported = append(supported, grafanaDatasources...)
|
||||||
|
|
||||||
sort.Strings(supported)
|
sort.Strings(supported)
|
||||||
return supported, nil
|
return supported, nil
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
var tsDatasourcesTemplate = `
|
var tsDatasourcesTemplate = `
|
||||||
// Code generated by go generate; DO NOT EDIT.
|
// Code generated by go generate; DO NOT EDIT.
|
||||||
|
|
||||||
export const supportedDatasources = new Set<string>([
|
export const supportedDatasources = new Set<string>([
|
||||||
{{- range . }}
|
{{- range . }}
|
||||||
'{{ printf "%s" . }}',
|
'{{ printf "%s" . }}',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -3,6 +3,7 @@ package generate_datasources
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -31,6 +32,14 @@ func TestCanGetCompatibleDatasources(t *testing.T) {
|
|||||||
datasources, err := GetCompatibleDatasources(server.URL)
|
datasources, err := GetCompatibleDatasources(server.URL)
|
||||||
|
|
||||||
require.NoError(t, err)
|
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
|
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) {
|
func (_m *FakePublicDashboardService) FindEnabledPublicDashboardAndDashboardByAccessToken(ctx context.Context, accessToken string) (*models.PublicDashboard, *dashboards.Dashboard, error) {
|
||||||
ret := _m.Called(ctx, accessToken)
|
ret := _m.Called(ctx, accessToken)
|
||||||
|
|
||||||
|
@ -56,6 +56,12 @@ describe('getUnsupportedDashboardDatasources', () => {
|
|||||||
{
|
{
|
||||||
datasource: { type: 'prometheus' } as DataSourceRef,
|
datasource: { type: 'prometheus' } as DataSourceRef,
|
||||||
} as DataQuery,
|
} as DataQuery,
|
||||||
|
{
|
||||||
|
datasource: { type: '__expr__' } as DataSourceRef,
|
||||||
|
} as DataQuery,
|
||||||
|
{
|
||||||
|
datasource: { type: 'datasource' } as DataSourceRef,
|
||||||
|
} as DataQuery,
|
||||||
] as DataQuery[],
|
] as DataQuery[],
|
||||||
} as PanelModel;
|
} as PanelModel;
|
||||||
const panelArray: PanelModel[] = [pm];
|
const panelArray: PanelModel[] = [pm];
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
// Code generated by go generate; DO NOT EDIT.
|
// Code generated by go generate; DO NOT EDIT.
|
||||||
|
|
||||||
export const supportedDatasources = new Set<string>([
|
export const supportedDatasources = new Set<string>([
|
||||||
|
'__expr__',
|
||||||
'aquaqanalytics-kdbbackend-datasource',
|
'aquaqanalytics-kdbbackend-datasource',
|
||||||
'cloudwatch',
|
'cloudwatch',
|
||||||
|
'datasource',
|
||||||
'dlopes7-appdynamics-datasource',
|
'dlopes7-appdynamics-datasource',
|
||||||
'doitintl-bigquery-datasource',
|
'doitintl-bigquery-datasource',
|
||||||
'elasticsearch',
|
'elasticsearch',
|
||||||
@ -19,6 +21,7 @@ export const supportedDatasources = new Set<string>([
|
|||||||
'grafana-dynatrace-datasource',
|
'grafana-dynatrace-datasource',
|
||||||
'grafana-es-open-distro-datasource',
|
'grafana-es-open-distro-datasource',
|
||||||
'grafana-github-datasource',
|
'grafana-github-datasource',
|
||||||
|
'grafana-gitlab-datasource',
|
||||||
'grafana-honeycomb-datasource',
|
'grafana-honeycomb-datasource',
|
||||||
'grafana-iot-sitewise-datasource',
|
'grafana-iot-sitewise-datasource',
|
||||||
'grafana-jira-datasource',
|
'grafana-jira-datasource',
|
||||||
|
Loading…
Reference in New Issue
Block a user