grafana / grafana-starter-datasource Goto Github PK
View Code? Open in Web Editor NEWA starter for Grafana data source plugins
License: Apache License 2.0
A starter for Grafana data source plugins
License: Apache License 2.0
Please demonstrate the idiomatic way of using template variables. Existing datasources (including the "reactified" builtins) use templateSrv
, which doesn't appear to be in @grafana/ui
(yet?).
Thank you!
I have been working through the excellent Build a Datasource Plugin tutorial. One thing that I have found confusing is the use of the LegacyForm
in the react components used in the tutorial. I am seeing these used in two places:
I have wanted to extend my forms to be more complex but I have been unable to find any documentation for how the LegacyForms are supposed to be used. I have found excellent documentation about the next generation of the UI components. I am assuming that an update to something more like what we see used in the I think I could replicate much of what is found in this QueryEditor.VariableQueryEditor
of the Add support for variables tutorial would be the right thing to do here.
Is there any context that I am missing around the use of the LegacyForms here? Would a PR with updates be welcome?
Thanks for the tutorials and the project generator, they have both been super helpful. :)
Hi,
I'm running Grafana 7.4.2 locally.
I've built a data source plugin using grafana-starter-datasource. I pointed Grafana to its dist
folder.
Grafana's defaults.ini:
# Directory where grafana will automatically scan and look for plugins
plugins = C:\src\grafana-starter-datasource\dist
When I run yarn watch
, everything works fine.
However, when I run yarn build
(in order to build a plugin to install to remote Grafana server), my data source stops working:
FooBar Datasource plugin failed
Error: [$injector:unpr] Unknown provider: tProvider <- t http://errors.angularjs.org/1.6.9/$injector/unpr?p0=tProvider%20%3C-%20t
This seems to be because of minification.
Unminified (208 KB), result of yarn watch
- works:
Minified (39 KB), result of yarn build
- doesn't work:
I noticed this happening only recently.
My dependencies (package.json
):
{
"name": "simple-datasource",
"version": "1.0.0",
"description": "Grafana Data Source Plugin Template",
"scripts": {
"build": "grafana-toolkit plugin:build",
"test": "grafana-toolkit plugin:test",
"dev": "grafana-toolkit plugin:dev",
"watch": "grafana-toolkit plugin:dev --watch",
"sign": "grafana-toolkit plugin:sign"
},
"author": "Grafana Labs",
"license": "Apache-2.0",
"devDependencies": {
"@grafana/data": "7.4.2",
"@grafana/runtime": "7.4.2",
"@grafana/toolkit": "7.4.2",
"@grafana/ui": "7.4.2",
"@testing-library/jest-dom": "5.4.0",
"@testing-library/react": "^10.0.2",
"@types/lodash": "latest",
},
"dependencies": {
"grafana": "^1.0.1"
}
"engines": {
"node": ">=14"
}
}
I've checked out master (9670d12), built it with yarn
and yarn dev
, and scp'ed it over to the grafana v6.7.3 plugins directory. Navigating to the plugin options or trying to add a datasource using the plugin results in the following error in the console:
Failed to import plugin module Error: "_grafana_ui__WEBPACK_IMPORTED_MODULE_2__.LegacyForms is undefined
Evaluating http://dlt-monitoring-grafana-1.datto.lan/public/plugins/myorgid-simple-datasource/module.js
Loading plugins/myorgid-simple-datasource/module"
gyp ERR! stack Error: 'make' failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/xxx/yyy/plugin/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (node:events:365:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 5.4.0-66-generic
gyp ERR! command "/home/xxx/.nvm/versions/node/v16.0.0/bin/node" "/home/xxx/zzz/plugin/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/xxx/yyyy/plugin/node_modules/node-sass
gyp ERR! node -v v16.0.0
gyp ERR! node-gyp -v v3.8
See error message above
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.