Skip to content

Commit f5f2d19

Browse files
ziomeckaKatarzyna Ziomek-Zdanowicz
and
Katarzyna Ziomek-Zdanowicz
authored
7911 Add graphql datasource plugin (#47)
* 7911 Update FN_README * 7911 Add graphql plugin * 7911 Add graphql plugin Co-authored-by: Katarzyna Ziomek-Zdanowicz <[email protected]>
1 parent b1c800d commit f5f2d19

23 files changed

+1254
-1
lines changed

FN_README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,22 @@
33
## How to work with it?
44

55
We created our fork of [snakey-panel](https://github.com/IsmaelMasharo/sankey-panel) ---> [our fork](https://github.com/fluxninja/sankey-panel) and if we want to add some changes to it we need to:
6+
67
- git clone our fork
78
- add changes we want
89
- build plugin using `yarn build` (if you want to test something use `yarn dev` because the normal build removes all console.logs)
910
- copy-paste builded version of plugin into grafana `public/app/plugins/panel/sankey-panel-0.5.0`
1011
- refresh grafana
1112

13+
# [Grafadruid-druid datasource plugin](./public/app/plugins/datasource//grafadruid-druid-datasource/)
14+
15+
https://github.com/grafadruid/druid-grafana/tree/master/src
16+
17+
# [Graphql datasource plugin](./public/app/plugins//datasource//fifemon-graphql-datasource/)
18+
19+
https://github.com/fifemon/graphql-datasource/tree/v1.3.0/src
20+
21+
Release: v1.3.0
1222

1323
# Troubleshooting
1424

@@ -18,11 +28,11 @@ Smart IDEs (such as VSCode or IntelliJ) require special configuration for TypeSc
1828
A collection of settings for each editor can be found under the (link)[https://yarnpkg.com/getting-started/editor-sdks#vscode]
1929

2030
Generally speaking: the editor SDKs and settings can be generated using `yarn dlx @yarnpkg/sdks` (or yarn sdks if you added @yarnpkg/sdks to your dependencies):
31+
2132
- Use yarn sdks vscode vim to generate both the base SDKs and the settings for the specified supported editors.
2233
- Use yarn sdks base to generate the base SDKs and then manually tweak the configuration of unsupported editors.
2334
- Use yarn sdks to update all installed SDKs and editor settings.
2435

25-
2636
### VSCode
2737

2838
To support features like go-to-definition a plugin like ZipFS is needed.

pkg/plugins/backendplugin/coreplugin/registry.go

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const (
3838
Loki = "loki"
3939
OpenTSDB = "opentsdb"
4040
Druid = "grafadruid-druid-datasource"
41+
Graphql = "fifemon-graphql-datasource"
4142
Prometheus = "prometheus"
4243
Tempo = "tempo"
4344
TestData = "testdata"

pkg/plugins/pfs/corelist/loadlist_gen.go

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func coreTreeList(rt *thema.Runtime) pfs.TreeList {
4646
makeTreeOrPanic("public/app/plugins/datasource/cloudwatch", "cloudwatch", rt),
4747
makeTreeOrPanic("public/app/plugins/datasource/dashboard", "dashboard", rt),
4848
makeTreeOrPanic("public/app/plugins/datasource/elasticsearch", "elasticsearch", rt),
49+
makeTreeOrPanic("public/app/plugins/datasource/fifemon-graphql-datasource", "fifemon_graphql_datasource", rt),
4950
makeTreeOrPanic("public/app/plugins/datasource/grafadruid-druid-datasource", "grafadruid_druid_datasource", rt),
5051
makeTreeOrPanic("public/app/plugins/datasource/grafana", "grafana", rt),
5152
makeTreeOrPanic("public/app/plugins/datasource/grafana-azure-monitor-datasource", "grafana_azure_monitor_datasource", rt),

pkg/services/publicdashboards/supported_datasources_gen.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/app/features/plugins/built_in_plugins.ts

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const postgresPlugin = async () =>
2525
await import(/* webpackChunkName: "postgresPlugin" */ 'app/plugins/datasource/postgres/module');
2626
const grafadruidDruidDatasourcePlugin = async () =>
2727
await import(/* webpackChunkName: "druidPlugin" */ 'app/plugins/datasource/grafadruid-druid-datasource/module');
28+
const fifemonGraphqlDatasourcePlugin = async () =>
29+
await import(/* webpackChunkName: "graphqlPlugin" */ 'app/plugins/datasource/fifemon-graphql-datasource/module');
2830
const prometheusPlugin = async () =>
2931
await import(/* webpackChunkName: "prometheusPlugin" */ 'app/plugins/datasource/prometheus/module');
3032
const mssqlPlugin = async () =>
@@ -116,6 +118,7 @@ const builtInPlugins: any = {
116118
'app/plugins/datasource/postgres/module': postgresPlugin,
117119
'app/plugins/datasource/mssql/module': mssqlPlugin,
118120
'app/plugins/datasource/grafadruid-druid-datasource/module': grafadruidDruidDatasourcePlugin,
121+
'app/plugins/datasource/fifemon-graphql-datasource/module': fifemonGraphqlDatasourcePlugin,
119122
'app/plugins/datasource/prometheus/module': prometheusPlugin,
120123
'app/plugins/datasource/testdata/module': testDataDSPlugin,
121124
'app/plugins/datasource/cloud-monitoring/module': cloudMonitoringPlugin,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import { DataSourceHttpSettings } from '@grafana/ui';
3+
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
4+
import { MyDataSourceOptions } from './types';
5+
6+
export type Props = DataSourcePluginOptionsEditorProps<MyDataSourceOptions>;
7+
export const ConfigEditor = (props: Props) => {
8+
const { options, onOptionsChange } = props;
9+
10+
return (
11+
<>
12+
<DataSourceHttpSettings
13+
defaultUrl="http://localhost:9999"
14+
dataSourceConfig={options}
15+
onChange={onOptionsChange}
16+
showAccessOptions={true}
17+
/>
18+
</>
19+
);
20+
};

0 commit comments

Comments
 (0)