Restructure plugin docs (#24381)

pull/24524/head
Marcus Olsson 5 years ago committed by GitHub
parent f88ec875a6
commit fc0c717bfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      docs/sources/developers/_index.md
  2. 3
      docs/sources/developers/cla.md
  3. 11
      docs/sources/developers/contribute.md
  4. 30
      docs/sources/developers/plugins/_index.md
  5. 7
      docs/sources/developers/plugins/authentication.md
  6. 9
      docs/sources/developers/plugins/backend.md
  7. 20
      docs/sources/developers/plugins/data-frames.md
  8. 24
      docs/sources/developers/plugins/legacy/_index.md
  9. 9
      docs/sources/developers/plugins/legacy/apps.md
  10. 9
      docs/sources/developers/plugins/legacy/data-sources.md
  11. 11
      docs/sources/developers/plugins/legacy/defaults-and-editor-mode.md
  12. 14
      docs/sources/developers/plugins/legacy/panels.md
  13. 11
      docs/sources/developers/plugins/legacy/review-guidelines.md
  14. 11
      docs/sources/developers/plugins/legacy/snapshot-mode.md
  15. 11
      docs/sources/developers/plugins/legacy/style-guide.md
  16. 21
      docs/sources/developers/plugins/metadata.md
  17. 4
      docs/sources/http_api/data_source.md
  18. 358
      docs/sources/menu.yaml
  19. 2
      docs/sources/plugins/_index.md
  20. 8
      docs/sources/plugins/developing/_index.md

@ -1,9 +1,4 @@
+++ +++
title = "Contribute" title = "Developers"
description = "Contribute"
type = "docs" type = "docs"
[menu.docs]
name = "Contribute"
identifier = "contribute"
weight = 20
+++ +++

@ -3,9 +3,6 @@ title = "Contributor License Agreement (CLA)"
description = "Contributor License Agreement (CLA)" description = "Contributor License Agreement (CLA)"
type = "docs" type = "docs"
aliases = ["/docs/grafana/latest/project/cla", "docs/contributing/cla.html"] aliases = ["/docs/grafana/latest/project/cla", "docs/contributing/cla.html"]
[menu.docs]
parent = "contribute"
weight = 1
+++ +++
# Grafana Labs Contributor License Agreement # Grafana Labs Contributor License Agreement

@ -1,19 +1,14 @@
+++ +++
title = "Developer resources" title = "Contribute to Grafana"
description = "Resources for Grafana developers"
keywords = ["grafana", "documentation", "developers", "resources"] keywords = ["grafana", "documentation", "developers", "resources"]
type = "docs" type = "docs"
[menu.docs]
name = "Grafana resources"
identifier = "Developer resources"
weight = 30
+++ +++
# Developer resources # Contribute to Grafana
This page lists resources for developers who want to contribute to the Grafana software ecosystem or build plugins for Grafana. This page lists resources for developers who want to contribute to the Grafana software ecosystem or build plugins for Grafana.
## ##
General resources General resources
These resources are useful for all developers. These resources are useful for all developers.

@ -1,21 +1,17 @@
+++ +++
title = "Build a plugin" title = "Build a plugin"
type = "docs" type = "docs"
[menu.docs]
parent = "developers"
identifier = "plugins"
weight = 3
+++ +++
# Build a plugin # Build a plugin
For more information on the types of plugins you can build, refer to the [Plugin Overview]({{< relref "../plugins/_index.md" >}}). For more information on the types of plugins you can build, refer to the [Plugin Overview]({{< relref "../../plugins/_index.md" >}}).
## Get started ## Get started
The easiest way to start developing Grafana plugins is to use the [Grafana Toolkit](https://www.npmjs.com/package/@grafana/toolkit). The easiest way to start developing Grafana plugins is to use the [Grafana Toolkit](https://www.npmjs.com/package/@grafana/toolkit).
Open the terminal, and run the following command in your [plugin directory]({{< relref "../installation/configuration/_index.md#plugins" >}}): Open the terminal, and run the following command in your [plugin directory]({{< relref "../../installation/configuration/_index.md#plugins" >}}):
```bash ```bash
npx @grafana/toolkit plugin:create my-grafana-plugin npx @grafana/toolkit plugin:create my-grafana-plugin
@ -23,8 +19,8 @@ npx @grafana/toolkit plugin:create my-grafana-plugin
If you want a more guided introduction to plugin development, check out our tutorials: If you want a more guided introduction to plugin development, check out our tutorials:
- [Build a panel plugin]({{< relref "../../../../tutorials/build-a-panel-plugin.md" >}}) - [Build a panel plugin]({{< relref "../../../../../tutorials/build-a-panel-plugin.md" >}})
- [Build a data source plugin]({{< relref "../../../../tutorials/build-a-data-source-plugin.md" >}}) - [Build a data source plugin]({{< relref "../../../../../tutorials/build-a-data-source-plugin.md" >}})
## Go further ## Go further
@ -34,8 +30,8 @@ Learn more about specific areas of plugin development.
Deepen your knowledge through a series of high-level overviews of plugin concepts. Deepen your knowledge through a series of high-level overviews of plugin concepts.
- [Data frames]({{< relref "../plugins/developing/dataframe.md" >}}) - [Data frames]({{< relref "data-frames.md" >}})
- [Authentication for data source plugins]({{< relref "../plugins/developing/auth-for-datasources.md" >}}) - [Authentication for data source plugins]({{< relref "authentication.md" >}})
### UI library ### UI library
@ -45,12 +41,12 @@ Explore the many UI components in our [Grafana UI library](https://developers.gr
If you're looking to build your first plugin, check out these introductory tutorials: If you're looking to build your first plugin, check out these introductory tutorials:
- [Build a panel plugin]({{< relref "../../../../tutorials/build-a-panel-plugin.md" >}}) - [Build a panel plugin]({{< relref "../../../../../tutorials/build-a-panel-plugin.md" >}})
- [Build a data source plugin]({{< relref "../../../../tutorials/build-a-data-source-plugin.md" >}}) - [Build a data source plugin]({{< relref "../../../../../tutorials/build-a-data-source-plugin.md" >}})
Ready to learn more? Check out our other tutorials: Ready to learn more? Check out our other tutorials:
- [Build a panel plugin with D3.js]({{< relref "../../../../tutorials/build-a-panel-plugin-with-d3.md" >}}) - [Build a panel plugin with D3.js]({{< relref "../../../../../tutorials/build-a-panel-plugin-with-d3.md" >}})
### API reference ### API reference
@ -58,13 +54,13 @@ Learn more about Grafana options and packages.
#### Metadata #### Metadata
- [Plugin metadata]({{< relref "../plugins/developing/plugin.json.md" >}}) - [Plugin metadata]({{< relref "metadata.md" >}})
#### Typescript #### Typescript
- [Grafana Data]({{< relref "../packages_api/data/_index.md" >}}) - [Grafana Data]({{< relref "../../packages_api/data/_index.md" >}})
- [Grafana Runtime]({{< relref "../packages_api/runtime/_index.md" >}}) - [Grafana Runtime]({{< relref "../../packages_api/runtime/_index.md" >}})
- [Grafana UI]({{< relref "../packages_api/ui/_index.md" >}}) - [Grafana UI]({{< relref "../../packages_api/ui/_index.md" >}})
#### Go #### Go

@ -1,10 +1,7 @@
+++ +++
title = "Authentication for Datasource Plugins" title = "Authentication for data source plugins"
type = "docs" type = "docs"
[menu.docs] aliases = ["/docs/grafana/latest/plugins/developing/auth-for-datasources/"]
name = "Authentication for Datasource Plugins"
parent = "developing"
weight = 3
+++ +++
# Authentication for data source plugins # Authentication for data source plugins

@ -1,14 +1,11 @@
+++ +++
title = "Developing Backend Plugins" title = "Backend plugins"
keywords = ["grafana", "plugins", "backend", "plugin", "backend-plugins", "documentation"] keywords = ["grafana", "plugins", "backend", "plugin", "backend-plugins", "documentation"]
type = "docs" type = "docs"
[menu.docs] aliases = ["/docs/grafana/latest/plugins/developing/backend-plugins-guide/"]
name = "Developing Backend Plugins"
parent = "developing"
weight = 5
+++ +++
# Backend Plugins # Backend plugins
Grafana added support for plugins in Grafana 3.0 and this enabled the Grafana community to create panel plugins and data source plugins. It was wildly successful and has made Grafana much more useful as you can integrate it with anything and do any type of custom visualization that you want. However, these plugin hooks are on the frontend only and we also want to provide hooks into the Grafana backend to allow the community to extend and improve Grafana in new ways. Grafana added support for plugins in Grafana 3.0 and this enabled the Grafana community to create panel plugins and data source plugins. It was wildly successful and has made Grafana much more useful as you can integrate it with anything and do any type of custom visualization that you want. However, these plugin hooks are on the frontend only and we also want to provide hooks into the Grafana backend to allow the community to extend and improve Grafana in new ways.

@ -1,13 +1,9 @@
+++ +++
title = "Introduction Data frames" title = "Data frames"
type = "docs" type = "docs"
[menu.docs]
name = "Data frames"
parent = "developing"
weight = 9
+++ +++
## Introduction to data frames # Data frames
Grafana supports a variety of different data sources, each with its own data model. To make this possible, Grafana consolidates the query results from each of these data sources into one unified data structure called a _data frame_. Grafana supports a variety of different data sources, each with its own data model. To make this possible, Grafana consolidates the query results from each of these data sources into one unified data structure called a _data frame_.
@ -17,7 +13,7 @@ The data frame structure is a concept that's borrowed from data analysis tools l
This document gives an overview of the data frame structure, and of how data is handled within Grafana. This document gives an overview of the data frame structure, and of how data is handled within Grafana.
### The data frame ## The data frame
A data frame is a columnar-oriented table structure, which means it stores data by column and not by row. To understand what this means, let’s look at the TypeScript definition used by Grafana: A data frame is a columnar-oriented table structure, which means it stores data by column and not by row. To understand what this means, let’s look at the TypeScript definition used by Grafana:
@ -61,25 +57,25 @@ Each field has three values, and each value in a field must share the same type.
One restriction on data frames is that all fields in the frame must be of the same length to be a valid data frame. One restriction on data frames is that all fields in the frame must be of the same length to be a valid data frame.
#### Field configuration ### Field configuration
Each field in a data frame contains optional information about the values in the field, such as units, scaling, and so on. Each field in a data frame contains optional information about the values in the field, such as units, scaling, and so on.
By adding field configurations to a data frame, Grafana can configure visualizations automatically. For example, you could configure Grafana to automatically set the unit provided by the data source. By adding field configurations to a data frame, Grafana can configure visualizations automatically. For example, you could configure Grafana to automatically set the unit provided by the data source.
### Transformations ## Transformations
Along with the type information, field configs enables _data transformations_ within Grafana. Along with the type information, field configs enables _data transformations_ within Grafana.
A data transformation is any function that accepts a data frame as input, and returns another data frame as output. By using data frames in your plugin, you get a range of transformations for free. A data transformation is any function that accepts a data frame as input, and returns another data frame as output. By using data frames in your plugin, you get a range of transformations for free.
### Data frames as time series ## Data frames as time series
A data frame with at least one time field is considered a _time series_. A data frame with at least one time field is considered a _time series_.
For more information on time series, refer to our [Introduction to time series](https://grafana.com/docs/grafana/latest/guides/timeseries/). For more information on time series, refer to our [Introduction to time series](https://grafana.com/docs/grafana/latest/guides/timeseries/).
#### Wide format ### Wide format
When a collection of time series share the same _time index_—the time fields in each time series are identical—they can be stored together, in a _wide_ format. By reusing the time field, we can reduce the amount of data being sent to the browser. When a collection of time series share the same _time index_—the time fields in each time series are identical—they can be stored together, in a _wide_ format. By reusing the time field, we can reduce the amount of data being sent to the browser.
@ -126,7 +122,7 @@ Dimensions: 2 fields by 2 rows
The wide format can typically be used when multiple time series are collected by the same process. In this case, every measurement is made at the same interval and will therefore share the same time values. The wide format can typically be used when multiple time series are collected by the same process. In this case, every measurement is made at the same interval and will therefore share the same time values.
#### Long format ### Long format
Some data sources return data in a _long_ format (also called _narrow_ format). This is common format returned by, for example, SQL databases. Some data sources return data in a _long_ format (also called _narrow_ format). This is common format returned by, for example, SQL databases.

@ -1,14 +1,12 @@
+++ +++
title = "Developer Guide" title = "Legacy plugins"
type = "docs" type = "docs"
aliases = ["/docs/grafana/latest/plugins/development/", "/docs/grafana/latest/plugins/datasources/", "/docs/grafana/latest/plugins/apps/", "/docs/grafana/latest/plugins/panels/"] aliases = ["/docs/grafana/latest/plugins/development/", "/docs/grafana/latest/plugins/datasources/", "/docs/grafana/latest/plugins/apps/", "/docs/grafana/latest/plugins/panels/", "/docs/grafana/latest/plugins/developing/development/"]
[menu.docs]
name = "Developer Guide"
parent = "developing"
weight = 1
+++ +++
# Developer Guide # Legacy plugins
> **Note**: Since Grafana 7.0, writing plugins using Angular is no longer recommended. If you're looking to build a new plugin, refer to [Plugins]({{< relref "../_index.md" >}}).
You can extend Grafana by writing your own plugins and then share them with other users in [our plugin repository](https://grafana.com/plugins). You can extend Grafana by writing your own plugins and then share them with other users in [our plugin repository](https://grafana.com/plugins).
@ -47,20 +45,20 @@ Grafana that can impact your plugin.
## Metadata ## Metadata
See the [coding styleguide]({{< relref "code-styleguide.md" >}}) for details on the metadata. See the [coding styleguide]({{< relref "style-guide.md" >}}) for details on the metadata.
## module.(js|ts) ## module.(js|ts)
This is the entry point for every plugin. This is the place where you should export This is the entry point for every plugin. This is the place where you should export
your plugin implementation. Depending on what kind of plugin you are developing you your plugin implementation. Depending on what kind of plugin you are developing you
will be expected to export different things. You can find what's expected for [datasource]({{< relref "datasources.md" >}}), [panels]({{< relref "panels.md" >}}) will be expected to export different things. You can find what's expected for [datasource]({{< relref "data-sources.md" >}}), [panels]({{< relref "panels.md" >}})
and [apps]({{< relref "apps.md" >}}) plugins in the documentation. and [apps]({{< relref "apps.md" >}}) plugins in the documentation.
The Grafana SDK is quite small so far and can be found here: The Grafana SDK is quite small so far and can be found here:
- [SDK file in Grafana](https://github.com/grafana/grafana/blob/master/public/app/plugins/sdk.ts) - [SDK file in Grafana](https://github.com/grafana/grafana/blob/master/public/app/plugins/sdk.ts)
The SDK contains three different plugin classes: PanelCtrl, MetricsPanelCtrl and QueryCtrl. For plugins of the panel type, the module.js file should export one of these. There are some extra classes for [data sources]({{< relref "datasources.md" >}}). The SDK contains three different plugin classes: PanelCtrl, MetricsPanelCtrl and QueryCtrl. For plugins of the panel type, the module.js file should export one of these. There are some extra classes for [data sources]({{< relref "data-sources.md" >}}).
Example: Example:
@ -128,7 +126,7 @@ We have three different examples that you can fork/download to get started devel
- [Getting Plugins to work in Snapshot Mode]({{< relref "snapshot-mode.md" >}}) - [Getting Plugins to work in Snapshot Mode]({{< relref "snapshot-mode.md" >}})
- [Plugin Defaults and Editor Mode]({{< relref "defaults-and-editor-mode.md" >}}) - [Plugin Defaults and Editor Mode]({{< relref "defaults-and-editor-mode.md" >}})
- [Grafana Plugin Code Styleguide]({{< relref "code-styleguide.md" >}}) - [Grafana Plugin Code Styleguide]({{< relref "style-guide.md" >}})
- [Grafana Apps]({{< relref "apps.md" >}}) - [Grafana Apps]({{< relref "apps.md" >}})
- [Grafana Data Sources]({{< relref "datasources.md" >}}) - [Grafana Data Sources]({{< relref "data-sources.md" >}})
- [plugin.json Schema]({{< relref "plugin.json.md" >}}) - [plugin.json Schema]({{< relref "metadata.md" >}})

@ -1,14 +1,11 @@
+++ +++
title = "Developing App Plugins" title = "Legacy app plugins"
keywords = ["grafana", "plugins", "documentation"] keywords = ["grafana", "plugins", "documentation"]
type = "docs" type = "docs"
[menu.docs] aliases = ["/docs/grafana/latest/plugins/developing/apps/"]
name = "Developing App Plugins"
parent = "developing"
weight = 4
+++ +++
# Grafana Apps # Legacy app plugins
App plugins are a Grafana plugin that can bundle data source and panel plugins within one package. They also enable the plugin author to create custom pages within Grafana. The custom pages enable the plugin author to include things like documentation, sign-up forms, or to control other services with HTTP requests. App plugins are a Grafana plugin that can bundle data source and panel plugins within one package. They also enable the plugin author to create custom pages within Grafana. The custom pages enable the plugin author to include things like documentation, sign-up forms, or to control other services with HTTP requests.

@ -1,14 +1,11 @@
+++ +++
title = "Developing Datasource Plugins" title = "Legacy data source plugins"
keywords = ["grafana", "plugins", "documentation"] keywords = ["grafana", "plugins", "documentation"]
type = "docs" type = "docs"
[menu.docs] aliases = ["/docs/grafana/latest/plugins/developing/datasources/"]
name = "Developing Datasource Plugins"
parent = "developing"
weight = 5
+++ +++
# Data Sources # Legacy data source plugins
Data source plugins enable people to develop plugins for any database that Data source plugins enable people to develop plugins for any database that
communicates over HTTP. Its up to the plugin to transform the data into communicates over HTTP. Its up to the plugin to transform the data into

@ -1,13 +1,10 @@
+++ +++
title = "Plugin Defaults and Editor Mode" title = "Legacy defaults and editor mode"
type = "docs" type = "docs"
[menu.docs] aliases = ["/docs/grafana/latest/plugins/developing/defaults-and-editor-mode/"]
name = "Plugin Defaults and Editor Mode"
parent = "developing"
weight = 3
+++ +++
# Plugin Defaults and Editor Mode # Legacy defaults and editor mode
Most plugins allow users to customize the behavior by changing settings on an editor tab. These setting fields are saved in the dashboard json. Most plugins allow users to customize the behavior by changing settings on an editor tab. These setting fields are saved in the dashboard json.
@ -59,7 +56,7 @@ If you want your users to be able to change these panel values then you need to
## Editor Mode ## Editor Mode
Editor mode is when a user clicks Edit on a panel. Every panel has a general tab where you change the title and width and some panels have more inbuilt tabs like the Metrics tab or Time Range tab. A panel plugin can add its own tab(s) so that a user can customize the panel. Editor mode is when a user clicks Edit on a panel. Every panel has a general tab where you change the title and width and some panels have more inbuilt tabs like the Metrics tab or Time Range tab. A panel plugin can add its own tab(s) so that a user can customize the panel.
Grafana conventions mean all you need to do is to hook up an Angular template with input fields and Grafana will automatically save the values to the dashboard json and load them on dashboard load. Grafana conventions mean all you need to do is to hook up an Angular template with input fields and Grafana will automatically save the values to the dashboard json and load them on dashboard load.

@ -1,21 +1,16 @@
+++ +++
title = "Developing Panel Plugins" title = "Legacy panel plugins"
keywords = ["grafana", "plugins", "panel", "documentation"] keywords = ["grafana", "plugins", "panel", "documentation"]
type = "docs" type = "docs"
[menu.docs] aliases = ["/docs/grafana/latest/plugins/developing/panels/"]
name = "Developing Panel Plugins"
parent = "developing"
weight = 4
+++ +++
# Legacy panel plugins
# Panels
Panels are the main building blocks of dashboards. Panels are the main building blocks of dashboards.
## Panel development ## Panel development
### Scrolling ### Scrolling
The grafana dashboard framework controls the panel height. To enable a scrollbar within the panel the PanelCtrl needs to set the scrollable static variable: The grafana dashboard framework controls the panel height. To enable a scrollbar within the panel the PanelCtrl needs to set the scrollable static variable:
@ -27,10 +22,7 @@ export class MyPanelCtrl extends PanelCtrl {
In this case, make sure the template has a single `<div>...</div>` root. The plugin loader will modify that element adding a scrollbar. In this case, make sure the template has a single `<div>...</div>` root. The plugin loader will modify that element adding a scrollbar.
### Examples ### Examples
- [clock-panel](https://github.com/grafana/clock-panel) - [clock-panel](https://github.com/grafana/clock-panel)
- [singlestat-panel](https://github.com/grafana/grafana/tree/master/public/app/plugins/panel/singlestat) - [singlestat-panel](https://github.com/grafana/grafana/tree/master/public/app/plugins/panel/singlestat)

@ -1,13 +1,10 @@
+++ +++
title = "Plugin Review Guidelines" title = "Legacy review guidelines"
type = "docs" type = "docs"
[menu.docs] aliases = ["/docs/grafana/latest/plugins/developing/plugin-review-guidelines/"]
name = "Plugin Review Guidelines"
parent = "developing"
weight = 2
+++ +++
# Plugin Review Guidelines # Legacy review guidelines
The Grafana team reviews all plugins that are published on Grafana.com. There are two areas we review, the metadata for the plugin and the plugin functionality. The Grafana team reviews all plugins that are published on Grafana.com. There are two areas we review, the metadata for the plugin and the plugin functionality.
@ -157,7 +154,7 @@ A basic guide for data sources can be found [here](http://docs.grafana.org/plugi
If possible, any passwords or secrets should be be saved in the `secureJsonData` blob. To encrypt sensitive data, the Grafana server's proxy feature must be used. The Grafana server has support for token authentication (OAuth) and HTTP Header authentication. If the calls have to be sent directly from the browser to a third-party API, this will not be possible and sensitive data will not be encrypted. If possible, any passwords or secrets should be be saved in the `secureJsonData` blob. To encrypt sensitive data, the Grafana server's proxy feature must be used. The Grafana server has support for token authentication (OAuth) and HTTP Header authentication. If the calls have to be sent directly from the browser to a third-party API, this will not be possible and sensitive data will not be encrypted.
Read more here about how [authentication for data sources]({{< relref "auth-for-datasources.md" >}}) works. Read more here about how [authentication for data sources]({{< relref "../authentication.md" >}}) works.
If using the proxy feature, the Config page should use the `secureJsonData` blob like this: If using the proxy feature, the Config page should use the `secureJsonData` blob like this:

@ -1,17 +1,14 @@
+++ +++
title = "Snapshot Mode" title = "Legacy snapshot mode"
type = "docs" type = "docs"
[menu.docs] aliases = ["/docs/grafana/latest/plugins/developing/snapshot-mode/"]
name = "Snapshot Mode"
parent = "developing"
weight = 6
+++ +++
# Getting Plugins to work in Snapshot Mode # Legacy snapshot mode
{{< imgbox img="/img/docs/Grafana-snapshot-example.png" caption="A dashboard using snapshot data and not live data." >}} {{< imgbox img="/img/docs/Grafana-snapshot-example.png" caption="A dashboard using snapshot data and not live data." >}}
Grafana has this great feature where you can [save a snapshot of your dashboard]({{< relref "../../reference/share_dashboard.md" >}}). Instead of sending a screenshot of a dashboard to someone, you can send them a working, interactive Grafana dashboard with the snapshot data embedded inside it. The snapshot can be saved on your Grafana server and is available to all your co-workers. Raintank also hosts a [snapshot server](http://snapshot.raintank.io/) if you want to send the snapshot to someone who does not have access to your Grafana server. Grafana has this great feature where you can [save a snapshot of your dashboard]({{< relref "../../../reference/share_dashboard.md" >}}). Instead of sending a screenshot of a dashboard to someone, you can send them a working, interactive Grafana dashboard with the snapshot data embedded inside it. The snapshot can be saved on your Grafana server and is available to all your co-workers. Raintank also hosts a [snapshot server](http://snapshot.raintank.io/) if you want to send the snapshot to someone who does not have access to your Grafana server.
{{< imgbox img="/img/docs/animated_gifs/snapshots.gif" caption="Selecting a snapshot" >}} {{< imgbox img="/img/docs/animated_gifs/snapshots.gif" caption="Selecting a snapshot" >}}

@ -1,13 +1,10 @@
+++ +++
title = "Plugin Code Styleguide" title = "Legacy code style guide"
type = "docs" type = "docs"
[menu.docs] aliases = ["/docs/grafana/latest/plugins/developing/code-styleguide/"]
name = "Plugin Code Styleguide"
parent = "developing"
weight = 2
+++ +++
# Grafana Plugin Code Styleguide # Legacy code style guide
This guide has two parts. The first part describes the metadata and the second part is a styleguide for HTML/CSS and JavaScript in Grafana plugins and applies if you are using ES6 in your plugin. If using TypeScript then the [Angular TypeScript styleguide](https://angular.io/styleguide) is recommended. This guide has two parts. The first part describes the metadata and the second part is a styleguide for HTML/CSS and JavaScript in Grafana plugins and applies if you are using ES6 in your plugin. If using TypeScript then the [Angular TypeScript styleguide](https://angular.io/styleguide) is recommended.
@ -30,7 +27,7 @@ grafana-piechart-panel
mtanda-histogram-panel mtanda-histogram-panel
``` ```
The full file format for plugin.json is described [here]({{< relref "plugin.json.md" >}}). The full file format for plugin.json is described [here]({{< relref "metadata.md" >}}).
Minimal plugin.json: Minimal plugin.json:

@ -1,22 +1,19 @@
+++ +++
title = "plugin.json Schema" title = "plugin.json"
keywords = ["grafana", "plugins", "documentation"] keywords = ["grafana", "plugins", "documentation"]
type = "docs" type = "docs"
[menu.docs] aliases = ["/docs/grafana/latest/plugins/developing/plugin.json/"]
name = "plugin.json Schema"
parent = "developing"
weight = 8
+++ +++
# Plugin.json # plugin.json
The plugin.json file is mandatory for all plugins. When Grafana starts it will scan the plugin folders and mount every folder that contains a plugin.json file unless the folder contains a subfolder named `dist`. In that case grafana will mount the `dist` folder instead. The plugin.json file is mandatory for all plugins. When Grafana starts it will scan the plugin folders and mount every folder that contains a plugin.json file unless the folder contains a subfolder named `dist`. In that case grafana will mount the `dist` folder instead.
## Plugin.json Schema ## Schema
| Property | Description | | Property | Description |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | |-----------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| id | Unique name of the plugin. See [naming conventions described in styleguide]({{< relref "code-styleguide.md" >}}) | | id | Unique name of the plugin. |
| type | One of `app`, `datasource`, `panel` | | type | One of `app`, `datasource`, `panel` |
| name | Human-readable name of the plugin | | name | Human-readable name of the plugin |
| dependencies.grafanaVersion | Required Grafana version for this plugin | | dependencies.grafanaVersion | Required Grafana version for this plugin |
@ -26,11 +23,11 @@ The plugin.json file is mandatory for all plugins. When Grafana starts it will s
| info.description | Description of plugin. Used for search on grafana.com | | info.description | Description of plugin. Used for search on grafana.com |
| info.keywords | Array of plugin keywords. Used for search on grafana.com | | info.keywords | Array of plugin keywords. Used for search on grafana.com |
| info.links | An array of link objects to be displayed on this plugin's project page in the form `{name: 'foo', url: 'http://example.com'}` | | info.links | An array of link objects to be displayed on this plugin's project page in the form `{name: 'foo', url: 'http://example.com'}` |
| info.logos.small | Link to the "small" version of the plugin logo, which must be an SVG image. "Large" and "small" logos can be the same image. | | info.logos.small | Link to the "small" version of the plugin logo, which must be an SVG image. "Large" and "small" logos can be the same image. |
| info.logos.large | Link to the "large" version of the plugin logo, which must be an SVG image. "Large" and "small" logos can be the same image. | | info.logos.large | Link to the "large" version of the plugin logo, which must be an SVG image. "Large" and "small" logos can be the same image. |
| info.screenshots | An array of screenshot objects in the form `{name: 'bar', path: 'img/screenshot.png'}` | | info.screenshots | An array of screenshot objects in the form `{name: 'bar', path: 'img/screenshot.png'}` |
| info.updated | Date when this plugin was built. Use `%TODAY%` for Grafana to autopopulate this value. | | info.updated | Date when this plugin was built. Use `%TODAY%` for Grafana to autopopulate this value. |
| info.version | Project version of this commit. Use `%VERSION%` for Grafana to autopopulate this value. | | info.version | Project version of this commit. Use `%VERSION%` for Grafana to autopopulate this value. |
## Plugin.json Example ## Plugin.json Example

@ -226,7 +226,7 @@ Content-Type: application/json
} }
``` ```
> NOTE: `password` and `basicAuthPassword` should be defined under `secureJsonData` in order to be stored securely as an encrypted blob in the database. Then, the encrypted fields are listed under `secureJsonFields` section in the response. See also the [Encrypting Sensitive Data]({{< relref "../plugins/developing/auth-for-datasources.md/#encrypting-sensitive-data">}}) documentation for more details. > NOTE: `password` and `basicAuthPassword` should be defined under `secureJsonData` in order to be stored securely as an encrypted blob in the database. Then, the encrypted fields are listed under `secureJsonFields` section in the response. See also the [Encrypting Sensitive Data]({{< relref "../developers/plugins/authentication.md/#encrypting-sensitive-data">}}) documentation for more details.
**Example Graphite Request with basic auth enabled**: **Example Graphite Request with basic auth enabled**:
@ -376,7 +376,7 @@ Content-Type: application/json
} }
``` ```
> NOTE: Similar to [creating a data source](#create-a-data-source), `password` and `basicAuthPassword` should be defined under `secureJsonData` in order to be stored securely as an encrypted blob in the database. Then, the encrypted fields are listed under `secureJsonFields` section in the response. See also the [Encrypting Sensitive Data]({{< relref "../plugins/developing/auth-for-datasources.md/#encrypting-sensitive-data">}}) documentation for more details. > NOTE: Similar to [creating a data source](#create-a-data-source), `password` and `basicAuthPassword` should be defined under `secureJsonData` in order to be stored securely as an encrypted blob in the database. Then, the encrypted fields are listed under `secureJsonFields` section in the response. See also the [Encrypting Sensitive Data]({{< relref "../developers/plugins/authentication.md/#encrypting-sensitive-data">}}) documentation for more details.
## Delete an existing data source by id ## Delete an existing data source by id

@ -31,166 +31,166 @@
- name: Administration - name: Administration
link: /administration/ link: /administration/
children: children:
- name: Configuration - name: Configuration
link: /installation/configuration/ link: /installation/configuration/
- name: Configure Docker image - name: Configure Docker image
link: /installation/configure-docker/ link: /installation/configure-docker/
- name: Security - name: Security
link: /installation/security/ link: /installation/security/
- name: Authentication - name: Authentication
link: /auth/ link: /auth/
children: children:
- link: /auth/overview/ - link: /auth/overview/
name: Overview name: Overview
- link: /auth/auth-proxy/ - link: /auth/auth-proxy/
name: Auth Proxy name: Auth Proxy
- link: /auth/ldap/ - link: /auth/ldap/
name: LDAP name: LDAP
- link: /auth/enhanced_ldap/ - link: /auth/enhanced_ldap/
name: Enhanced LDAP name: Enhanced LDAP
- link: /auth/generic-oauth/ - link: /auth/generic-oauth/
name: Generic OAuth name: Generic OAuth
- link: /auth/google/ - link: /auth/google/
name: Google name: Google
- link: /auth/azuread/ - link: /auth/azuread/
name: Azure AD name: Azure AD
- link: /auth/github/ - link: /auth/github/
name: GitHub name: GitHub
- link: /auth/gitlab/ - link: /auth/gitlab/
name: GitLab name: GitLab
- link: /auth/okta/ - link: /auth/okta/
name: Okta name: Okta
- link: /auth/saml/ - link: /auth/saml/
name: SAML name: SAML
- link: /auth/team-sync/ - link: /auth/team-sync/
name: Team Sync name: Team Sync
- name: Permissions - name: Permissions
link: /permissions/ link: /permissions/
children: children:
- link: /permissions/overview/ - link: /permissions/overview/
name: Overview name: Overview
- link: /permissions/organization_roles/ - link: /permissions/organization_roles/
name: Organization Roles name: Organization Roles
- link: /permissions/dashboard_folder_permissions/ - link: /permissions/dashboard_folder_permissions/
name: Dashboard and Folder name: Dashboard and Folder
- link: /permissions/datasource_permissions/ - link: /permissions/datasource_permissions/
name: Data source name: Data source
- name: Grafana CLI - name: Grafana CLI
link: /administration/cli/ link: /administration/cli/
- name: Internal metrics - name: Internal metrics
link: /administration/metrics/ link: /administration/metrics/
- name: Provisioning - name: Provisioning
link: /administration/provisioning/ link: /administration/provisioning/
- name: Set up Grafana for high availability - name: Set up Grafana for high availability
link: /tutorials/ha_setup/ link: /tutorials/ha_setup/
- name: Troubleshooting - name: Troubleshooting
link: /installation/troubleshooting/ link: /installation/troubleshooting/
- name: Panels - name: Panels
link: /features/panels/ link: /features/panels/
children: children:
- link: /features/panels/panels/ - link: /features/panels/panels/
name: Overview name: Overview
- link: /features/panels/graph/ - link: /features/panels/graph/
name: Graph name: Graph
- link: /features/panels/table_panel/ - link: /features/panels/table_panel/
name: Table name: Table
- link: /features/panels/stat/ - link: /features/panels/stat/
name: Stat name: Stat
- link: /features/panels/gauge/ - link: /features/panels/gauge/
name: Gauge name: Gauge
- link: /features/panels/bar_gauge/ - link: /features/panels/bar_gauge/
name: Bar gauge name: Bar gauge
- link: /features/panels/logs/ - link: /features/panels/logs/
name: Logs name: Logs
- link: /features/panels/singlestat/ - link: /features/panels/singlestat/
name: Singlestat name: Singlestat
- link: /features/panels/heatmap/ - link: /features/panels/heatmap/
name: Heatmap name: Heatmap
- link: /features/panels/alertlist/ - link: /features/panels/alertlist/
name: Alert list name: Alert list
- link: /features/panels/dashlist/ - link: /features/panels/dashlist/
name: Dashboard list name: Dashboard list
- link: /features/panels/text/ - link: /features/panels/text/
name: Text name: Text
- name: Dashboards - name: Dashboards
link: /features/dashboard/ link: /features/dashboard/
children: children:
- link: /features/dashboard/dashboards/ - link: /features/dashboard/dashboards/
name: Overview name: Overview
- link: /reference/annotations/ - link: /reference/annotations/
name: Annotations name: Annotations
- link: /reference/dashboard_folders/ - link: /reference/dashboard_folders/
name: Folders name: Folders
- link: /reference/playlist/ - link: /reference/playlist/
name: Playlist name: Playlist
- link: /reference/search/ - link: /reference/search/
name: Search name: Search
- link: /reference/share_dashboard/ - link: /reference/share_dashboard/
name: Sharing a dashboard name: Sharing a dashboard
- link: /reference/share_panel/ - link: /reference/share_panel/
name: Sharing a panel name: Sharing a panel
- link: /reference/timerange/ - link: /reference/timerange/
name: Time range name: Time range
- link: /reference/export_import/ - link: /reference/export_import/
name: Export and import name: Export and import
- link: /features/dashboard/links/ - link: /features/dashboard/links/
name: Navigation links name: Navigation links
- link: /reference/datalinks/ - link: /reference/datalinks/
name: Data links name: Data links
- link: /reference/dashboard_history/ - link: /reference/dashboard_history/
name: Dashboard version history name: Dashboard version history
- name: Keyboard Shortcuts - name: Keyboard Shortcuts
link: /features/shortcuts/ link: /features/shortcuts/
- name: Reporting - name: Reporting
link: /features/reporting/ link: /features/reporting/
- link: /reference/dashboard/ - link: /reference/dashboard/
name: JSON Model name: JSON Model
- link: /reference/scripting/ - link: /reference/scripting/
name: Scripted dashboards name: Scripted dashboards
- name: Data sources - name: Data sources
link: /features/datasources/ link: /features/datasources/
children: children:
- link: /features/datasources/add-a-data-source/ - link: /features/datasources/add-a-data-source/
name: Add data source name: Add data source
- link: /features/datasources/cloudwatch/ - link: /features/datasources/cloudwatch/
name: AWS Cloudwatch name: AWS Cloudwatch
- link: /features/datasources/azuremonitor/ - link: /features/datasources/azuremonitor/
name: Azure Monitor name: Azure Monitor
- link: /features/datasources/elasticsearch/ - link: /features/datasources/elasticsearch/
name: Elasticsearch name: Elasticsearch
- link: /features/datasources/stackdriver/ - link: /features/datasources/stackdriver/
name: Google Stackdriver name: Google Stackdriver
- link: /features/datasources/graphite/ - link: /features/datasources/graphite/
name: Graphite name: Graphite
- link: /features/datasources/influxdb/ - link: /features/datasources/influxdb/
name: InfluxDB name: InfluxDB
- link: /features/datasources/loki/ - link: /features/datasources/loki/
name: Loki name: Loki
- link: /features/datasources/mssql/ - link: /features/datasources/mssql/
name: Microsoft SQL Server name: Microsoft SQL Server
- link: /features/datasources/mixed/ - link: /features/datasources/mixed/
name: MixedData name: MixedData
- link: /features/datasources/mysql/ - link: /features/datasources/mysql/
name: MySQL name: MySQL
- link: /features/datasources/opentsdb/ - link: /features/datasources/opentsdb/
name: OpenTSDB name: OpenTSDB
- link: /features/datasources/postgres/ - link: /features/datasources/postgres/
name: PostgreSQL name: PostgreSQL
- link: /features/datasources/prometheus/ - link: /features/datasources/prometheus/
name: Prometheus name: Prometheus
- link: /features/datasources/testdata/ - link: /features/datasources/testdata/
name: TestData DB name: TestData DB
- name: Explore - name: Explore
link: /features/explore/ link: /features/explore/
- name: Alerting - name: Alerting
link: /alerting/ link: /alerting/
children: children:
- link: /alerting/rules/ - link: /alerting/rules/
name: Engine and Rules name: Engine and Rules
- link: /alerting/metrics/ - link: /alerting/metrics/
name: Metrics name: Metrics
- link: /alerting/notifications/ - link: /alerting/notifications/
name: Notifications name: Notifications
- name: Image rendering - name: Image rendering
link: /administration/image_rendering/ link: /administration/image_rendering/
- name: Templates and variables - name: Templates and variables
@ -286,33 +286,6 @@
link: /plugins/ link: /plugins/
- name: Install plugins - name: Install plugins
link: /plugins/installation/ link: /plugins/installation/
- name: Develop plugins
link: /plugins/developing/
children:
- link: /plugins/developing/development/
name: Developer Guide
- link: /plugins/developing/dataframe/
name: Introduction to data frames
- link: /plugins/developing/code-styleguide/
name: Plugin Code Styleguide
- link: /plugins/developing/plugin-review-guidelines/
name: Plugin Review Guidelines
- link: /plugins/developing/auth-for-datasources/
name: Authentication for Datasource Plugins
- link: /plugins/developing/defaults-and-editor-mode/
name: Plugin Defaults and Editor Mode
- link: /plugins/developing/apps/
name: Developing App Plugins
- link: /plugins/developing/panels/
name: Developing Panel Plugins
- link: /plugins/developing/backend-plugins-guide/
name: Developing Backend Plugins
- link: /plugins/developing/datasources/
name: Developing Datasource Plugins
- link: /plugins/developing/snapshot-mode/
name: Snapshot Mode
- link: /plugins/developing/plugin.json/
name: plugin.json Schema
- name: HTTP APIs - name: HTTP APIs
link: /http_api/ link: /http_api/
children: children:
@ -363,14 +336,41 @@
- name: Users API - name: Users API
link: /http_api/user/ link: /http_api/user/
- name: Developers - name: Developers
link: /developers/
children: children:
- name: Developer resources - name: Plugins
link: /developers/developer-resources/ children:
- link: /developers/plugins/ - name: Overview
name: Plugins link: /developers/plugins/
- name: Packages reference - name: plugin.json
link: /developers/plugins/metadata/
- name: Data frames
link: /developers/plugins/data-frames/
- name: Authentication
link: /developers/plugins/authentication/
- name: Backend plugins
link: /developers/plugins/backend/
- name: Legacy plugins
children:
- link: /developers/plugins/legacy/
name: Overview
- link: /developers/plugins/legacy/style-guide/
name: Code style guide
- link: /developers/plugins/legacy/review-guidelines/
name: Review guidelines
- link: /developers/plugins/legacy/defaults-and-editor-mode/
name: Defaults and editor mode
- link: /developers/plugins/legacy/apps/
name: App plugins
- link: /developers/plugins/legacy/panels/
name: Backend plugins
- link: /developers/plugins/legacy/data-sources/
name: Data source plugins
- link: /developers/plugins/legacy/snapshot-mode/
name: Snapshot mode
- name: API reference
link: /packages_api/ link: /packages_api/
- name: Contribute
link: /developers/contribute/
- name: Contributor License Agreement (CLA) - name: Contributor License Agreement (CLA)
link: /developers/cla/ link: /developers/cla/
- name: Docs Archive - name: Docs Archive

@ -11,7 +11,7 @@ weight = 1
Besides the wide range of visualizations and data sources that are available immediately after you install Grafana, you can extend your Grafana experience with _plugins_. Besides the wide range of visualizations and data sources that are available immediately after you install Grafana, you can extend your Grafana experience with _plugins_.
You can [install]({{< relref "./installation.md" >}}) one of the plugins built by the Grafana community, or [build one yourself]({{< relref "./developing/development.md" >}}). You can [install]({{< relref "./installation.md" >}}) one of the plugins built by the Grafana community, or [build one yourself]({{< relref "../developers/plugins/_index.md" >}}).
Grafana supports three types of plugins: [panels](https://grafana.com/grafana/plugins?type=panel), [data sources](https://grafana.com/grafana/plugins?type=datasource), and [apps](https://grafana.com/grafana/plugins?type=app). Grafana supports three types of plugins: [panels](https://grafana.com/grafana/plugins?type=panel), [data sources](https://grafana.com/grafana/plugins?type=datasource), and [apps](https://grafana.com/grafana/plugins?type=app).

@ -1,8 +0,0 @@
+++
title = "Developing Plugins"
type = "docs"
[menu.docs]
parent = "plugins"
identifier = "developing"
weight = 3
+++
Loading…
Cancel
Save