grafana / iot-sitewise-datasource

IoT Sitewise
Apache License 2.0
18 stars 9 forks source link

Query Editor: Stop running queries on every change #274

Closed idastambuk closed 6 months ago

idastambuk commented 8 months ago

What this PR does / why we need it: A proposal for a change in behavior of the query editor.

Currently we call onRunQuery() on every change in the editor, even if the query isn't complete. This sometimes results in errors from the backend/Sitewise about incomplete queries and the constant Loading indicator while the user is editing the query is disruptive.

This removes ALL calls to onRunQuery, making it necessary for the user to click on Run Query button in the panel if they want to send the query.

Pros:

Another solution would be to add a onFilterQuery in the datasource, which will have to check every type of query in Sitewise and the necessary fields it needs. We might still want that even if we merge this PR, but I think this PR also reduces the need to implement it.

https://github.com/grafana/iot-sitewise-datasource/assets/16140639/b03e799a-6152-4876-86c9-e8b2def80a98

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

idastambuk commented 8 months ago

I like the idea of not running the query on every change. Could we add the run query button like we have in the other data sources (e.g. cloudwatch). It might not be clear for the user that the refresh button in the query editor is meant for running the query.

I was considering this too, but it looks like we're moving away from having dedicated Run query buttons in specific editors and instead rely on using the refresh button or keyboard shortcut (there's more about it in this design doc: https://docs.google.com/document/d/1G62nVl3PNoot3mH9Ir74fLFzCKMftkd52dFATQsSxUo/edit#heading=h.cnw24jsf9gsq)

idastambuk commented 6 months ago

@kevinwcyu added the header:

Screenshot 2024-03-18 at 17 13 01