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

MultiValueVariable: Fixes setting value from url when url value is a custom all value #738

Closed torkelo closed 4 months ago

torkelo commented 4 months ago

Ran across this if statement in the old variable system a few weeks ago, https://github.com/grafana/grafana/blob/main/public/app/features/variables/state/actions.ts#L423 , I have had it on my todo to fix this in the new variable system.

The condition fixes this issue https://github.com/grafana/grafana/issues/28635

It's for variables with custom all value, when we interpolate a datalink with ${varName} we do not use the URL state for all value ($__all) as we do not really know if the link is targeting Grafana or an external system, so that will always interpolate to the real value, so if the value is All then it would be all values or if a custom value is defined (say .*) the URL value will be .* .

This new code (condition) will translate the URL value back to our meta All value ($__all) when it matches the custom all value.

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

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