grafana / scenes

Build Grafana dashboards directly in your Grafana app plugins.
https://grafana.com/developers/scenes
Apache License 2.0
133 stars 20 forks source link

Variables: Add support to read only variables and expose missing types for custom variables in core grafana #781

Closed axelavargas closed 3 months ago

axelavargas commented 3 months ago

What is this PR solving?

For snapshots (a feature of core grafana), we only store the current variable value, and don't store options for variables such as queries, datasources, ... . The problem was that the Scenes implementation does validate options against the current variable value, if the current value did not exist, it cleared up that value.

What is this PR doing ?

I added some tweaks to support read-only variables, and also exposed missing types to support a new aSnapshotVariable in core grafana (PR ), which has a similar implementation to CustomVariable, but it's read-only and does not validate options with the current variable value.
SnapshotVariables

Todo:

📦 Published PR as canary version: 4.30.0--canary.781.9463613592.0
:sparkles: Test out this PR locally via: ```bash npm install @grafana/scenes-react@4.30.0--canary.781.9463613592.0 npm install @grafana/scenes@4.30.0--canary.781.9463613592.0 # or yarn add @grafana/scenes-react@4.30.0--canary.781.9463613592.0 yarn add @grafana/scenes@4.30.0--canary.781.9463613592.0 ```
grafanabot commented 3 months ago

:rocket: PR was released in v4.30.0 :rocket: