Commit ad6837ee by bergquist

docs(plugins): small guide for developing plugins

parent 01d5bc73
...@@ -6,5 +6,25 @@ page_keywords: grafana, plugins, documentation, development ...@@ -6,5 +6,25 @@ page_keywords: grafana, plugins, documentation, development
# Plugin development # Plugin development
TODO From grafana 3.0 it's very easy to develop your own plugins and share them with other grafana users.
## What languages?
Since everything turns into javascript its up to you to choose which language you want. That said its proberbly a good idea to choose es6 or typescript since we use es6 classes in Grafana.
##Buildscript
You can use any buildsystem you like that support systemjs. All the built content should endup in a folder named dist and commited to the repository.
##Loading plugins
The easiset way to try your plugin with grafana is to [setup grafana for development](https://github.com/grafana/grafana/blob/master/DEVELOPMENT.md) and place your plugin in the /data/plugins folder in grafana. When grafana starts it will scan that folder for folders that contains a plugin.json file and mount them as plugins. If your plugin folder contains a folder named dist it will mount that folder instead of the plugin base folder.
## Examples / boilerplate
We currently have three different examples that you can fork to get started developing your grafana plugin.
- [generic-datasource](https://github.com/grafana/grafana/tree/master/examples/datasource-plugin-genericdatasource) (small datasource plugin for quering json data from backends)
- [panel-boilderplate-es5](https://github.com/grafana/grafana/tree/master/examples/panel-boilerplate-es5)
- [nginx-app](https://github.com/grafana/grafana/tree/master/examples/nginx-app)
## Publish your plugin
We are currently working on this.
...@@ -25,4 +25,5 @@ MetricsPanelCtrl inherits from PanelCtrl and adds some common features for datas ...@@ -25,4 +25,5 @@ MetricsPanelCtrl inherits from PanelCtrl and adds some common features for datas
## Implementing a MetricsPanelCtrl ## Implementing a MetricsPanelCtrl
If you choose to inherit from MetricsPanelCtrl you should implement a function called refreshData that will be called by grafana when its time for all panels to get new data. If you choose to inherit from MetricsPanelCtrl you should implement a function called refreshData that will take an datasource as inparameter when its time to get new data. Its recommended that the refreshData function calls the issueQueries in the base class but its not mandatory. An examples of such implementation can be found in our [example panel](https://github.com/grafana/grafana/blob/master/examples/panel-boilerplate-es5/module.js#L27-L38)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment