mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PublicDashboards: Refresh ds plugin supported list (#74947)
This commit is contained in:
parent
158c669d1a
commit
633605af4e
@ -164,10 +164,8 @@ guaranteed because plugin developers can override this functionality. The follow
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Altinity plugin for ClickHouse</li>
|
|
||||||
<li>ClickHouse</li>
|
<li>ClickHouse</li>
|
||||||
<li>Elasticsearch</li>
|
<li>Elasticsearch</li>
|
||||||
<li>Graphite</li>
|
|
||||||
<li>Infinity</li>
|
<li>Infinity</li>
|
||||||
<li>InfluxDB</li>
|
<li>InfluxDB</li>
|
||||||
<li>Loki</li>
|
<li>Loki</li>
|
||||||
@ -178,7 +176,6 @@ guaranteed because plugin developers can override this functionality. The follow
|
|||||||
<ul>
|
<ul>
|
||||||
<li>MongoDB</li>
|
<li>MongoDB</li>
|
||||||
<li>MySQL</li>
|
<li>MySQL</li>
|
||||||
<li>OpenTSDB</li>
|
|
||||||
<li>Oracle Database</li>
|
<li>Oracle Database</li>
|
||||||
<li>PostgreSQL</li>
|
<li>PostgreSQL</li>
|
||||||
<li>Prometheus</li>
|
<li>Prometheus</li>
|
||||||
@ -189,18 +186,26 @@ guaranteed because plugin developers can override this functionality. The follow
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
### Unconfirmed:
|
### Unsupported:
|
||||||
|
|
||||||
{{% admonition type="note" %}}
|
|
||||||
|
|
||||||
If you've confirmed one of these data sources work with public dashboards, let us know in our [Github](https://github.com/grafana/grafana/discussions/49253) discussion, and we'll mark it as confirmed!
|
|
||||||
|
|
||||||
{{% /admonition %}}
|
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>CloudWatch</li>
|
||||||
|
<li>Graphite</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### Unconfirmed:
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>Altinity plugin for ClickHouse</li>
|
||||||
<li>Amazon Athena</li>
|
<li>Amazon Athena</li>
|
||||||
<li>Amazon Redshift</li>
|
<li>Amazon Redshift</li>
|
||||||
<li>Amazon Timestream</li>
|
<li>Amazon Timestream</li>
|
||||||
@ -209,7 +214,6 @@ If you've confirmed one of these data sources work with public dashboards, let u
|
|||||||
<li>Azure Data Explorer Datasource</li>
|
<li>Azure Data Explorer Datasource</li>
|
||||||
<li>Azure Monitor</li>
|
<li>Azure Monitor</li>
|
||||||
<li>CSV</li>
|
<li>CSV</li>
|
||||||
<li>CloudWatch</li>
|
|
||||||
<li>DB2 Datasource</li>
|
<li>DB2 Datasource</li>
|
||||||
<li>Databricks</li>
|
<li>Databricks</li>
|
||||||
<li>Datadog</li>
|
<li>Datadog</li>
|
||||||
@ -231,12 +235,13 @@ If you've confirmed one of these data sources work with public dashboards, let u
|
|||||||
<li>OPC UA (Unified Architecture)</li>
|
<li>OPC UA (Unified Architecture)</li>
|
||||||
<li>Open Distro for Elasticsearch</li>
|
<li>Open Distro for Elasticsearch</li>
|
||||||
<li>OpenSearch</li>
|
<li>OpenSearch</li>
|
||||||
<li>Orbit</li>
|
<li>OpenTSDB</li>
|
||||||
<li>SAP HANA®</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>Orbit</li>
|
||||||
|
<li>SAP HANA®</li>
|
||||||
<li>Salesforce</li>
|
<li>Salesforce</li>
|
||||||
<li>Sentry</li>
|
<li>Sentry</li>
|
||||||
<li>ServiceNow</li>
|
<li>ServiceNow</li>
|
||||||
|
@ -12,6 +12,11 @@ import (
|
|||||||
|
|
||||||
var grafanaDatasources = []string{expr.DatasourceType, "datasource"}
|
var grafanaDatasources = []string{expr.DatasourceType, "datasource"}
|
||||||
|
|
||||||
|
// there are some datasources that have backend flag as true but don't call /ds/query endpoint
|
||||||
|
var unsupportedDataSourcesMap = map[string]bool{
|
||||||
|
"cloudwatch": true,
|
||||||
|
}
|
||||||
|
|
||||||
type listPluginResponse struct {
|
type listPluginResponse struct {
|
||||||
Items []struct {
|
Items []struct {
|
||||||
Slug string `json:"slug"`
|
Slug string `json:"slug"`
|
||||||
@ -40,7 +45,7 @@ func GetCompatibleDatasources(baseUrl string) ([]string, error) {
|
|||||||
// we only consider a datasource to be supported when alerting and backend are both true
|
// we only consider a datasource to be supported when alerting and backend are both true
|
||||||
var supported []string
|
var supported []string
|
||||||
for _, datasource := range datasources {
|
for _, datasource := range datasources {
|
||||||
if datasource.Alerting && datasource.Backend {
|
if datasource.Alerting && datasource.Backend && !unsupportedDataSourcesMap[datasource.Slug] {
|
||||||
supported = append(supported, datasource.Slug)
|
supported = append(supported, datasource.Slug)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,8 @@ import { NoUpsertPermissionsAlert } from '../ModalAlerts/NoUpsertPermissionsAler
|
|||||||
import { SaveDashboardChangesAlert } from '../ModalAlerts/SaveDashboardChangesAlert';
|
import { SaveDashboardChangesAlert } from '../ModalAlerts/SaveDashboardChangesAlert';
|
||||||
import { UnsupportedDataSourcesAlert } from '../ModalAlerts/UnsupportedDataSourcesAlert';
|
import { UnsupportedDataSourcesAlert } from '../ModalAlerts/UnsupportedDataSourcesAlert';
|
||||||
import { UnsupportedTemplateVariablesAlert } from '../ModalAlerts/UnsupportedTemplateVariablesAlert';
|
import { UnsupportedTemplateVariablesAlert } from '../ModalAlerts/UnsupportedTemplateVariablesAlert';
|
||||||
import {
|
import { dashboardHasTemplateVariables, generatePublicDashboardUrl } from '../SharePublicDashboardUtils';
|
||||||
dashboardHasTemplateVariables,
|
import { useGetUnsupportedDataSources } from '../useGetUnsupportedDataSources';
|
||||||
generatePublicDashboardUrl,
|
|
||||||
getUnsupportedDashboardDatasources,
|
|
||||||
} from '../SharePublicDashboardUtils';
|
|
||||||
|
|
||||||
import { Configuration } from './Configuration';
|
import { Configuration } from './Configuration';
|
||||||
import { EmailSharingConfiguration } from './EmailSharingConfiguration';
|
import { EmailSharingConfiguration } from './EmailSharingConfiguration';
|
||||||
@ -60,7 +57,8 @@ const ConfigPublicDashboard = () => {
|
|||||||
const dashboardState = useSelector((store) => store.dashboard);
|
const dashboardState = useSelector((store) => store.dashboard);
|
||||||
const dashboard = dashboardState.getModel()!;
|
const dashboard = dashboardState.getModel()!;
|
||||||
const dashboardVariables = dashboard.getVariables();
|
const dashboardVariables = dashboard.getVariables();
|
||||||
const unsupportedDataSources = getUnsupportedDashboardDatasources(dashboard.panels);
|
|
||||||
|
const { unsupportedDataSources } = useGetUnsupportedDataSources(dashboard);
|
||||||
|
|
||||||
const { data: publicDashboard, isFetching: isGetLoading } = useGetPublicDashboardQuery(dashboard.uid);
|
const { data: publicDashboard, isFetching: isGetLoading } = useGetPublicDashboardQuery(dashboard.uid);
|
||||||
const [update, { isLoading: isUpdateLoading }] = useUpdatePublicDashboardMutation();
|
const [update, { isLoading: isUpdateLoading }] = useUpdatePublicDashboardMutation();
|
||||||
|
@ -14,7 +14,8 @@ import { shareDashboardType } from '../../utils';
|
|||||||
import { NoUpsertPermissionsAlert } from '../ModalAlerts/NoUpsertPermissionsAlert';
|
import { NoUpsertPermissionsAlert } from '../ModalAlerts/NoUpsertPermissionsAlert';
|
||||||
import { UnsupportedDataSourcesAlert } from '../ModalAlerts/UnsupportedDataSourcesAlert';
|
import { UnsupportedDataSourcesAlert } from '../ModalAlerts/UnsupportedDataSourcesAlert';
|
||||||
import { UnsupportedTemplateVariablesAlert } from '../ModalAlerts/UnsupportedTemplateVariablesAlert';
|
import { UnsupportedTemplateVariablesAlert } from '../ModalAlerts/UnsupportedTemplateVariablesAlert';
|
||||||
import { dashboardHasTemplateVariables, getUnsupportedDashboardDatasources } from '../SharePublicDashboardUtils';
|
import { dashboardHasTemplateVariables } from '../SharePublicDashboardUtils';
|
||||||
|
import { useGetUnsupportedDataSources } from '../useGetUnsupportedDataSources';
|
||||||
|
|
||||||
import { AcknowledgeCheckboxes } from './AcknowledgeCheckboxes';
|
import { AcknowledgeCheckboxes } from './AcknowledgeCheckboxes';
|
||||||
|
|
||||||
@ -31,8 +32,8 @@ const CreatePublicDashboard = ({ isError }: { isError: boolean }) => {
|
|||||||
const hasWritePermissions = contextSrv.hasPermission(AccessControlAction.DashboardsPublicWrite);
|
const hasWritePermissions = contextSrv.hasPermission(AccessControlAction.DashboardsPublicWrite);
|
||||||
const dashboardState = useSelector((store) => store.dashboard);
|
const dashboardState = useSelector((store) => store.dashboard);
|
||||||
const dashboard = dashboardState.getModel()!;
|
const dashboard = dashboardState.getModel()!;
|
||||||
const unsupportedDataSources = getUnsupportedDashboardDatasources(dashboard.panels);
|
|
||||||
|
|
||||||
|
const { unsupportedDataSources } = useGetUnsupportedDataSources(dashboard);
|
||||||
const [createPublicDashboard, { isLoading: isSaveLoading }] = useCreatePublicDashboardMutation();
|
const [createPublicDashboard, { isLoading: isSaveLoading }] = useCreatePublicDashboardMutation();
|
||||||
|
|
||||||
const disableInputs = !hasWritePermissions || isSaveLoading || isError;
|
const disableInputs = !hasWritePermissions || isSaveLoading || isError;
|
||||||
|
@ -23,7 +23,7 @@ export const UnsupportedDataSourcesAlert = ({ unsupportedDataSources }: { unsupp
|
|||||||
sources may not function properly: {unsupportedDataSources}.
|
sources may not function properly: {unsupportedDataSources}.
|
||||||
</p>
|
</p>
|
||||||
<a
|
<a
|
||||||
href="https://grafana.com/docs/grafana/latest/dashboards/dashboard-public/"
|
href="https://grafana.com/docs/grafana/next/dashboards/dashboard-public/"
|
||||||
className={cx('text-link', styles.unsupportedDataSourceDescription)}
|
className={cx('text-link', styles.unsupportedDataSourceDescription)}
|
||||||
>
|
>
|
||||||
Read more about supported data sources
|
Read more about supported data sources
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { DataSourceRef, DataQuery } from '@grafana/data/src/types/query';
|
import { DataSourceRef, DataQuery } from '@grafana/data/src/types/query';
|
||||||
|
import { DataSourceWithBackend } from '@grafana/runtime';
|
||||||
import { updateConfig } from 'app/core/config';
|
import { updateConfig } from 'app/core/config';
|
||||||
|
import { mockDataSource } from 'app/features/alerting/unified/mocks';
|
||||||
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||||
import { VariableModel } from 'app/features/variables/types';
|
import { VariableModel } from 'app/features/variables/types';
|
||||||
|
|
||||||
@ -11,6 +13,29 @@ import {
|
|||||||
getUnsupportedDashboardDatasources,
|
getUnsupportedDashboardDatasources,
|
||||||
} from './SharePublicDashboardUtils';
|
} from './SharePublicDashboardUtils';
|
||||||
|
|
||||||
|
const mockDS = mockDataSource({
|
||||||
|
name: 'mock-ds',
|
||||||
|
type: 'mock-ds-type',
|
||||||
|
});
|
||||||
|
|
||||||
|
jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
|
||||||
|
return {
|
||||||
|
getDataSourceSrv: () => ({
|
||||||
|
get: () =>
|
||||||
|
Promise.resolve(
|
||||||
|
new DataSourceWithBackend({
|
||||||
|
...mockDS,
|
||||||
|
meta: {
|
||||||
|
...mockDS.meta,
|
||||||
|
alerting: true,
|
||||||
|
backend: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
describe('dashboardHasTemplateVariables', () => {
|
describe('dashboardHasTemplateVariables', () => {
|
||||||
it('false', () => {
|
it('false', () => {
|
||||||
let variables: VariableModel[] = [];
|
let variables: VariableModel[] = [];
|
||||||
@ -50,7 +75,7 @@ describe('publicDashboardPersisted', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('getUnsupportedDashboardDatasources', () => {
|
describe('getUnsupportedDashboardDatasources', () => {
|
||||||
it('itIsSupported', () => {
|
it('itIsSupported', async () => {
|
||||||
const pm = {
|
const pm = {
|
||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
@ -65,10 +90,11 @@ describe('getUnsupportedDashboardDatasources', () => {
|
|||||||
] as DataQuery[],
|
] as DataQuery[],
|
||||||
} as PanelModel;
|
} as PanelModel;
|
||||||
const panelArray: PanelModel[] = [pm];
|
const panelArray: PanelModel[] = [pm];
|
||||||
expect(getUnsupportedDashboardDatasources(panelArray)).toEqual([]);
|
const unsupportedDataSources = await getUnsupportedDashboardDatasources(panelArray);
|
||||||
|
expect(unsupportedDataSources).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('itIsNotSupported', () => {
|
it('itIsNotSupported', async () => {
|
||||||
const pm = {
|
const pm = {
|
||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
@ -77,6 +103,8 @@ describe('getUnsupportedDashboardDatasources', () => {
|
|||||||
] as DataQuery[],
|
] as DataQuery[],
|
||||||
} as PanelModel;
|
} as PanelModel;
|
||||||
const panelArray: PanelModel[] = [pm];
|
const panelArray: PanelModel[] = [pm];
|
||||||
expect(getUnsupportedDashboardDatasources(panelArray)).toEqual(['blah']);
|
const unsupportedDataSources = await getUnsupportedDashboardDatasources(panelArray);
|
||||||
|
|
||||||
|
expect(unsupportedDataSources).toEqual(['blah']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
import { DataSourceWithBackend } from '@grafana/runtime';
|
||||||
import { getConfig } from 'app/core/config';
|
import { getConfig } from 'app/core/config';
|
||||||
|
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||||
import { VariableModel } from 'app/features/variables/types';
|
import { VariableModel } from 'app/features/variables/types';
|
||||||
|
|
||||||
import { PanelModel } from '../../../state';
|
import { PanelModel } from '../../../state';
|
||||||
@ -50,14 +52,21 @@ export const publicDashboardPersisted = (publicDashboard?: PublicDashboard): boo
|
|||||||
/**
|
/**
|
||||||
* Get unique datasource names from all panels that are not currently supported by public dashboards.
|
* Get unique datasource names from all panels that are not currently supported by public dashboards.
|
||||||
*/
|
*/
|
||||||
export const getUnsupportedDashboardDatasources = (panels: PanelModel[]): string[] => {
|
export const getUnsupportedDashboardDatasources = async (panels: PanelModel[]): Promise<string[]> => {
|
||||||
let unsupportedDS = new Set<string>();
|
let unsupportedDS = new Set<string>();
|
||||||
|
|
||||||
for (const panel of panels) {
|
for (const panel of panels) {
|
||||||
for (const target of panel.targets) {
|
for (const target of panel.targets) {
|
||||||
let ds = target?.datasource?.type;
|
const dsType = target?.datasource?.type;
|
||||||
if (ds && !supportedDatasources.has(ds)) {
|
if (dsType) {
|
||||||
unsupportedDS.add(ds);
|
if (!supportedDatasources.has(dsType)) {
|
||||||
|
unsupportedDS.add(dsType);
|
||||||
|
} else {
|
||||||
|
const ds = await getDatasourceSrv().get(target.datasource);
|
||||||
|
if (!(ds instanceof DataSourceWithBackend)) {
|
||||||
|
unsupportedDS.add(dsType);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,13 @@
|
|||||||
|
|
||||||
export const supportedDatasources = new Set<string>([
|
export const supportedDatasources = new Set<string>([
|
||||||
'__expr__',
|
'__expr__',
|
||||||
|
'apache-iotdb-datasource',
|
||||||
'aquaqanalytics-kdbbackend-datasource',
|
'aquaqanalytics-kdbbackend-datasource',
|
||||||
'cloudwatch',
|
'axiomhq-axiom-datasource',
|
||||||
|
'cnos-cnosdb-datasource',
|
||||||
'datasource',
|
'datasource',
|
||||||
'dlopes7-appdynamics-datasource',
|
'dlopes7-appdynamics-datasource',
|
||||||
'doitintl-bigquery-datasource',
|
'dvelop-odata-datasource',
|
||||||
'elasticsearch',
|
'elasticsearch',
|
||||||
'frser-sqlite-datasource',
|
'frser-sqlite-datasource',
|
||||||
'grafadruid-druid-datasource',
|
'grafadruid-druid-datasource',
|
||||||
@ -20,11 +22,13 @@ export const supportedDatasources = new Set<string>([
|
|||||||
'grafana-db2-datasource',
|
'grafana-db2-datasource',
|
||||||
'grafana-dynatrace-datasource',
|
'grafana-dynatrace-datasource',
|
||||||
'grafana-es-open-distro-datasource',
|
'grafana-es-open-distro-datasource',
|
||||||
|
'grafana-falconlogscale-datasource',
|
||||||
'grafana-github-datasource',
|
'grafana-github-datasource',
|
||||||
'grafana-gitlab-datasource',
|
'grafana-gitlab-datasource',
|
||||||
'grafana-honeycomb-datasource',
|
'grafana-honeycomb-datasource',
|
||||||
'grafana-iot-sitewise-datasource',
|
'grafana-iot-sitewise-datasource',
|
||||||
'grafana-jira-datasource',
|
'grafana-jira-datasource',
|
||||||
|
'grafana-looker-datasource',
|
||||||
'grafana-mock-datasource',
|
'grafana-mock-datasource',
|
||||||
'grafana-mongodb-datasource',
|
'grafana-mongodb-datasource',
|
||||||
'grafana-newrelic-datasource',
|
'grafana-newrelic-datasource',
|
||||||
@ -46,6 +50,7 @@ export const supportedDatasources = new Set<string>([
|
|||||||
'grafana-x-ray-datasource',
|
'grafana-x-ray-datasource',
|
||||||
'graphite',
|
'graphite',
|
||||||
'hadesarchitect-cassandra-datasource',
|
'hadesarchitect-cassandra-datasource',
|
||||||
|
'influxdata-flightsql-datasource',
|
||||||
'influxdb',
|
'influxdb',
|
||||||
'innius-grpc-datasource',
|
'innius-grpc-datasource',
|
||||||
'kniepdennis-neo4j-datasource',
|
'kniepdennis-neo4j-datasource',
|
||||||
@ -55,13 +60,19 @@ export const supportedDatasources = new Set<string>([
|
|||||||
'mssql',
|
'mssql',
|
||||||
'mysql',
|
'mysql',
|
||||||
'nagasudhirpulla-api-datasource',
|
'nagasudhirpulla-api-datasource',
|
||||||
|
'needleinajaystack-haystack-datasource',
|
||||||
'opentsdb',
|
'opentsdb',
|
||||||
'postgres',
|
'postgres',
|
||||||
'prometheus',
|
'prometheus',
|
||||||
|
'quickwit-quickwit-datasource',
|
||||||
'redis-datasource',
|
'redis-datasource',
|
||||||
'sentinelone-dataset-datasource',
|
'sentinelone-dataset-datasource',
|
||||||
|
'sneller-sneller-datasource',
|
||||||
|
'spiceai-spicexyz-datasource',
|
||||||
|
'stackdriver',
|
||||||
'tdengine-datasource',
|
'tdengine-datasource',
|
||||||
'vertamedia-clickhouse-datasource',
|
'vertamedia-clickhouse-datasource',
|
||||||
'vertica-grafana-datasource',
|
'vertica-grafana-datasource',
|
||||||
|
'ydbtech-ydb-datasource',
|
||||||
'yesoreyeram-infinity-datasource',
|
'yesoreyeram-infinity-datasource',
|
||||||
]);
|
]);
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
import { DashboardModel } from 'app/features/dashboard/state';
|
||||||
|
|
||||||
|
import { getUnsupportedDashboardDatasources } from './SharePublicDashboardUtils';
|
||||||
|
|
||||||
|
export const useGetUnsupportedDataSources = (dashboard: DashboardModel) => {
|
||||||
|
const [unsupportedDataSources, setUnsupportedDataSources] = useState<string[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchUnsupportedDataSources = async () => {
|
||||||
|
return await getUnsupportedDashboardDatasources(dashboard.panels);
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchUnsupportedDataSources().then((dsList) => {
|
||||||
|
setUnsupportedDataSources(dsList);
|
||||||
|
});
|
||||||
|
}, [dashboard.panels]);
|
||||||
|
|
||||||
|
return { unsupportedDataSources };
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user