From ad6837ee47cb57a1d91e4b97f81fe9530e4fe35e Mon Sep 17 00:00:00 2001 From: bergquist Date: Fri, 4 Mar 2016 14:28:31 +0100 Subject: [PATCH] docs(plugins): small guide for developing plugins --- docs/sources/plugins/developing_plugins.md | 22 +++++++++++++++++++++- docs/sources/plugins/panels.md | 3 ++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/sources/plugins/developing_plugins.md b/docs/sources/plugins/developing_plugins.md index 50b0bd1aa2b..b235fa8d3de 100644 --- a/docs/sources/plugins/developing_plugins.md +++ b/docs/sources/plugins/developing_plugins.md @@ -6,5 +6,25 @@ page_keywords: grafana, plugins, documentation, 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. diff --git a/docs/sources/plugins/panels.md b/docs/sources/plugins/panels.md index 56527341b71..4f16662d784 100644 --- a/docs/sources/plugins/panels.md +++ b/docs/sources/plugins/panels.md @@ -25,4 +25,5 @@ MetricsPanelCtrl inherits from PanelCtrl and adds some common features for datas ## 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. \ No newline at end of file +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) +