Skip to content

Commit b4ed458

Browse files
ziomeckaKatarzyna Ziomek-Zdanowicz
authored andcommitted
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 c646c86 commit b4ed458

21 files changed

+1252
-1
lines changed

FN_README.md

Lines changed: 11 additions & 1 deletion
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const (
4747
Loki = "loki"
4848
OpenTSDB = "opentsdb"
4949
Druid = "grafadruid-druid-datasource"
50+
Graphql = "fifemon-graphql-datasource"
5051
Prometheus = "prometheus"
5152
Tempo = "tempo"
5253
TestData = "grafana-testdata-datasource"

public/app/features/plugins/built_in_plugins.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const postgresPlugin = async () =>
2121
await import(/* webpackChunkName: "postgresPlugin" */ 'app/plugins/datasource/postgres/module');
2222
const grafadruidDruidDatasourcePlugin = async () =>
2323
await import(/* webpackChunkName: "druidPlugin" */ 'app/plugins/datasource/grafadruid-druid-datasource/module');
24+
const fifemonGraphqlDatasourcePlugin = async () =>
25+
await import(/* webpackChunkName: "graphqlPlugin" */ 'app/plugins/datasource/fifemon-graphql-datasource/module');
2426
const prometheusPlugin = async () =>
2527
await import(/* webpackChunkName: "prometheusPlugin" */ 'app/plugins/datasource/prometheus/module');
2628
const mssqlPlugin = async () =>
@@ -92,6 +94,7 @@ const builtInPlugins: any = {
9294
'app/plugins/datasource/postgres/module': postgresPlugin,
9395
'app/plugins/datasource/mssql/module': mssqlPlugin,
9496
'app/plugins/datasource/grafadruid-druid-datasource/module': grafadruidDruidDatasourcePlugin,
97+
'app/plugins/datasource/fifemon-graphql-datasource/module': fifemonGraphqlDatasourcePlugin,
9598
'app/plugins/datasource/prometheus/module': prometheusPlugin,
9699
'app/plugins/datasource/testdata/module': testDataDSPlugin,
97100
'app/plugins/datasource/cloud-monitoring/module': cloudMonitoringPlugin,
Lines changed: 20 additions & 0 deletions
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)