Skip to content

Example: how to implement template variable support in data source #141

Open
@mckn

Description

@mckn

The available method on the datasource plugin class is marked as deprecated. Without any examples or documentation on alternative approaches. We should provide some examples covering the different ways of adding a template variable support to data sources.

This is how you add the variable support to the data source:
https://github.com/grafana/grafana/blob/main/public/app/plugins/datasource/grafana-testdata-datasource/datasource.ts#L37

This is an example of how you implement the standard variable support:
https://github.com/grafana/grafana/blob/main/public/app/plugins/datasource/grafana-testdata-datasource/variables.ts

StandardVariableSupport = Extend this class in a data source plugin to use the standard query editor for Query variables
CustomVariableSupport = Extend this class in a data source plugin to use a customized query editor for Query variables
DataSourceVariableSupport = Extend this class in a data source plugin to use the query editor in the data source plugin for Query variables

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    • Status

      💡 Ideation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions