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

Update timerange in templateSrv for queryVars #840

Closed mdvictor closed 2 months ago

mdvictor commented 2 months ago

We have an escalation around the ADS DS, where the timerange is not being picked on query. The time range is being pulled from templateSrv here, but with the new scenes architecture this range is null/never updated in templateSrv. This PR updates the timerange using the request range in QueryVariable.tsx, before querying in the plugin itself.

In the old architecture there were events dispatched on various actions to update the timerange in the templateSrv. It seems in scenes we aren't updating it at all so the templateSrv timerange is always null. Updating templateSrv in SceneTimeRange on state update should cover most cases where range in templateSrv is needed, I think.

📦 Published PR as canary version: 5.6.1--canary.840.10038144895.0
:sparkles: Test out this PR locally via: ```bash npm install @grafana/scenes-react@5.6.1--canary.840.10038144895.0 npm install @grafana/scenes@5.6.1--canary.840.10038144895.0 # or yarn add @grafana/scenes-react@5.6.1--canary.840.10038144895.0 yarn add @grafana/scenes@5.6.1--canary.840.10038144895.0 ```